I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design Wishful Thinking Design
end Edit
I pulled this up from the comments
... what do you mean by real DateTime objects.I was converting to string cause I was passing this to the .aspx page for visualization, similar to a ViewModel but not sure if I can call it this way.
Regarding datetimes as strings: Each differently formatted datetime essentially becomes its own type. I must give each format special handling or else code is blowing up. I cannot pass these things except to other specialized methods; that means duplicate code. Datetime arithmetic is severely hampered. Converting to a real DateTime defaults undefined parts (parts not in the string) which will probably cause errors down stream. And passing a date-as-string is a violation of SRP. Let the client decide how it want's the date to look.
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I pulled this up from the comments
... what do you mean by real DateTime objects.I was converting to string cause I was passing this to the .aspx page for visualization, similar to a ViewModel but not sure if I can call it this way.
Regarding datetimes as strings: Each differently formatted datetime essentially becomes its own type. I must give each format special handling or else code is blowing up. I cannot pass these things except to other specialized methods; that means duplicate code. Datetime arithmetic is severely hampered. Converting to a real DateTime defaults undefined parts (parts not in the string) which will probably cause errors down stream. And passing a date-as-string is a violation of SRP. Let the client decide how it want's the date to look.
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I pulled this up from the comments
... what do you mean by real DateTime objects.I was converting to string cause I was passing this to the .aspx page for visualization, similar to a ViewModel but not sure if I can call it this way.
Regarding datetimes as strings: Each differently formatted datetime essentially becomes its own type. I must give each format special handling or else code is blowing up. I cannot pass these things except to other specialized methods; that means duplicate code. Datetime arithmetic is severely hampered. Converting to a real DateTime defaults undefined parts (parts not in the string) which will probably cause errors down stream. And passing a date-as-string is a violation of SRP. Let the client decide how it want's the date to look.
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I pulled this up from the comments
... what do you mean by real DateTime objects.I was converting to string cause I was passing this to the .aspx page for visualization, similar to a ViewModel but not sure if I can call it this way.
Regarding datetimes as strings: Each differently formatted datetime essentially becomes its own type. I must give each format special handling or else code is blowing up. I cannot pass these things except to other specialized methods; that means duplicate code. Datetime arithmetic is severely hampered. Converting to a real DateTime defaults undefined parts (parts not in the string) which will probably cause errors down stream. And passing a date-as-string is a violation of SRP. Let the client decide how it want's the date to look.
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I pulled this up from the comments
... what do you mean by real DateTime objects.I was converting to string cause I was passing this to the .aspx page for visualization, similar to a ViewModel but not sure if I can call it this way.
Regarding datetimes as strings: Each differently formatted datetime essentially becomes its own type. I must give each format special handling or else code is blowing up. I cannot pass these things except to other specialized methods; that means duplicate code. Datetime arithmetic is severely hampered. Converting to a real DateTime defaults undefined parts (parts not in the string) which will probably cause errors down stream. And passing a date-as-string is a violation of SRP. Let the client decide how it want's the date to look.
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit
I know this logic has to happen or be written somewhere, even if it's in a different manner, but I am not sure how to approach it.
Class Design
A good class model manages complexity. A good class hides state and exposes functionality.
This code is deferring all the details of all the construction of all the objects to the very last possible moment and then instantiates the entire HotelInformation
universe in a big bang. This is the antithesis of object oriented design.
Instead, a logical hierarchy of objects gets built up in layers if you will. With each class/object encapsulating its own state details the overall effect is that at any given point in a class composition, the construction is simple.
Random Observations
- Be wary of using LINQ as an inappropriate device for things that should be encapsulated in a class
- Use real
DateTime
objects. - Think real hard about each class and its purpose. Apply the Single Responsibility Principle mercilessly. SRP is the most important "bizz" of the SOLID buzzword.
Edit
Refactoring.
It's nice to say do the right thing from the beginning, but it is refactoring that will save your sanity with that codebase. You must get a long term perspective and accept that it will take patience, persistence, and study. But it is your ball of mud now and getting control of it is a very satisfying experience.
- Refactoring: Improving the Design of Existing Code
- get. this. book.
- The seminal work on the subject. A recipe cookbook for specific refactoring problems.
- Brownfield Application Development with .NET
- Working with Legacy Code
- Big Ball of Mud
- My recent watch on the subject. Yes, it's about refactoring, not Ruby
- RailsConf 2016 - Get a Wiff of This
- Everything in here is applicable. You will get that "OMG there is hope" feeling. The examples will give you LINQ deja-vu.
2 Big Bangs for the Buck
- Put version control on your computer. This will free you to boldly go where no refactoring has gone before.
- Wishful Thinking Design
- My answer to Avoiding Cascading Refactoring
end Edit