Skip to main content
added 1 character in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
  1. Have my class take in the two value objects it needs as a parameter. The class will then call 15 getters and then do something with the fields. Take this same approach for the rest of my classes where they take in the value objects they need

This is the anemic domain approach. Works fine if you never change DBs, tables, or fields or don't mind when such changes break many things in many places. This means your application is intimately familiar with DB details.

  1. Code up a new value object which only stores the 15 values that I need. Somewhere in my application I will have to do a mapping/conversion from these two value objects to my new value object. My class will call 15 getters and then do something with the fields. Take this same approach for the rest of my classes

This is over applying the introduce parameter object refactoring. You don't just shove every parameter of some method into one parameter object. You breakup and group the methods parameters so that you end up with fewer arguments that each hold conceptually coherent groups. These little data transfer objects can each focus part of your methods needs. They might even be reusable.

For example don't refactor this:

void draw(int x, int y, int r, int g, int b)

into this:

void draw(DrawArgs drawArgs)

ConvertRefactor it into this:

void draw(Point point, Color color)

Do that even if the DB has only the data and has no idea what points and colors are.

  1. Code up some huge value object that stores all of the data that I need for the entire second bullet point. We basically take all of our value objects and convert all the data we need to this huge value object. My class will then take in this huge value object. My class will call 15 getters and then do something with the fields. Each class that does a portion of the logic will take in this huge value object

This is called a God object. It is what happens when you give up on organizing and just dump everything in one place. It just hides the mess somewhere else.

  1. Have my class take in the two value objects it needs as a parameter. The class will then call 15 getters and then do something with the fields. Take this same approach for the rest of my classes where they take in the value objects they need

This is the anemic domain approach. Works fine if you never change DBs, tables, or fields or don't mind when such changes break many things in many places. This means your application is intimately familiar with DB details.

  1. Code up a new value object which only stores the 15 values that I need. Somewhere in my application I will have to do a mapping/conversion from these two value objects to my new value object. My class will call 15 getters and then do something with the fields. Take this same approach for the rest of my classes

This is over applying the introduce parameter object refactoring. You don't just shove every parameter of some method into one parameter object. You breakup and group the methods parameters so that you end up with fewer arguments that each hold conceptually coherent groups. These little data transfer objects can each focus part of your methods needs. They might even be reusable.

For example don't refactor this:

void draw(int x, int y, int r, int g, int b)

into this:

void draw(DrawArgs drawArgs)

Convert it into this:

void draw(Point point, Color color)

Do that even if the DB has only the data and has no idea what points and colors are.

  1. Code up some huge value object that stores all of the data that I need for the entire second bullet point. We basically take all of our value objects and convert all the data we need to this huge value object. My class will then take in this huge value object. My class will call 15 getters and then do something with the fields. Each class that does a portion of the logic will take in this huge value object

This is called a God object. It is what happens when you give up on organizing and just dump everything in one place. It just hides the mess somewhere else.

  1. Have my class take in the two value objects it needs as a parameter. The class will then call 15 getters and then do something with the fields. Take this same approach for the rest of my classes where they take in the value objects they need

This is the anemic domain approach. Works fine if you never change DBs, tables, or fields or don't mind when such changes break many things in many places. This means your application is intimately familiar with DB details.

  1. Code up a new value object which only stores the 15 values that I need. Somewhere in my application I will have to do a mapping/conversion from these two value objects to my new value object. My class will call 15 getters and then do something with the fields. Take this same approach for the rest of my classes

This is over applying the introduce parameter object refactoring. You don't just shove every parameter of some method into one parameter object. You breakup and group the methods parameters so that you end up with fewer arguments that each hold conceptually coherent groups. These little data transfer objects can each focus part of your methods needs. They might even be reusable.

For example don't refactor this:

void draw(int x, int y, int r, int g, int b)

into this:

void draw(DrawArgs drawArgs)

Refactor it into this:

void draw(Point point, Color color)

Do that even if the DB has only the data and has no idea what points and colors are.

  1. Code up some huge value object that stores all of the data that I need for the entire second bullet point. We basically take all of our value objects and convert all the data we need to this huge value object. My class will then take in this huge value object. My class will call 15 getters and then do something with the fields. Each class that does a portion of the logic will take in this huge value object

This is called a God object. It is what happens when you give up on organizing and just dump everything in one place. It just hides the mess somewhere else.

added 1 character in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
  1. Have my class take in the two value objects it needs as a parameter. The class will then call 15 getters and then do something with the fields. Take this same approach for the rest of my classes where they take in the value objects they need

This is the anemic domain approach. Works fine if you never change DBs, tables, or fields or don't mind when such changes break many things in many places. This means your application is intimately familiar with DB details.

  1. Code up a new value object which only stores the 15 values that I need. Somewhere in my application I will have to do a mapping/conversion from these two value objects to my new value object. My class will call 15 getters and then do something with the fields. Take this same approach for the rest of my classes

This is over applying the introduce parameter object refactoring. You don't just shove every parameter of some method into one parameter object. You breakup and group the methods parameters so that you end up with fewer arguments that each hold conceptually coherent groups. These little data transfer objects can each focus part of your methods needs. They might even be reusable.

For example don't convertrefactor this:

void draw(int x, int y, int r, int g, int b)

into this:

void draw(DrawArgs drawArgs)

Convert it into this:

void draw(Point point, Color color)

Do that even if the DB has only the data and has no idea what points and colors are.

  1. Code up some huge value object that stores all of the data that I need for the entire second bullet point. We basically take all of our value objects and convert all the data we need to this huge value object. My class will then take in this huge value object. My class will call 15 getters and then do something with the fields. Each class that does a portion of the logic will take in this huge value object

This is called a God object. It is what happens when you give up on organizing and just dump everything in one place. It just hides the mess somewhere else.

  1. Have my class take in the two value objects it needs as a parameter. The class will then call 15 getters and then do something with the fields. Take this same approach for the rest of my classes where they take in the value objects they need

This is the anemic domain approach. Works fine if you never change DBs, tables, or fields or don't mind when such changes break many things in many places. This means your application is intimately familiar with DB details.

  1. Code up a new value object which only stores the 15 values that I need. Somewhere in my application I will have to do a mapping/conversion from these two value objects to my new value object. My class will call 15 getters and then do something with the fields. Take this same approach for the rest of my classes

This is over applying the introduce parameter object refactoring. You don't just shove every parameter of some method into one parameter object. You breakup and group the methods parameters so that you end up with fewer arguments that each hold conceptually coherent groups. These little data transfer objects can each focus part of your methods needs. They might even be reusable.

For example don't convert this:

void draw(int x, int y, int r, int g, int b)

into this:

void draw(DrawArgs drawArgs)

Convert it into this:

void draw(Point point, Color color)

Do that even if the DB has only the data and has no idea what points and colors are.

  1. Code up some huge value object that stores all of the data that I need for the entire second bullet point. We basically take all of our value objects and convert all the data we need to this huge value object. My class will then take in this huge value object. My class will call 15 getters and then do something with the fields. Each class that does a portion of the logic will take in this huge value object

This is called a God object. It is what happens when you give up on organizing and just dump everything in one place. It just hides the mess somewhere else.

  1. Have my class take in the two value objects it needs as a parameter. The class will then call 15 getters and then do something with the fields. Take this same approach for the rest of my classes where they take in the value objects they need

This is the anemic domain approach. Works fine if you never change DBs, tables, or fields or don't mind when such changes break many things in many places. This means your application is intimately familiar with DB details.

  1. Code up a new value object which only stores the 15 values that I need. Somewhere in my application I will have to do a mapping/conversion from these two value objects to my new value object. My class will call 15 getters and then do something with the fields. Take this same approach for the rest of my classes

This is over applying the introduce parameter object refactoring. You don't just shove every parameter of some method into one parameter object. You breakup and group the methods parameters so that you end up with fewer arguments that each hold conceptually coherent groups. These little data transfer objects can each focus part of your methods needs. They might even be reusable.

For example don't refactor this:

void draw(int x, int y, int r, int g, int b)

into this:

void draw(DrawArgs drawArgs)

Convert it into this:

void draw(Point point, Color color)

Do that even if the DB has only the data and has no idea what points and colors are.

  1. Code up some huge value object that stores all of the data that I need for the entire second bullet point. We basically take all of our value objects and convert all the data we need to this huge value object. My class will then take in this huge value object. My class will call 15 getters and then do something with the fields. Each class that does a portion of the logic will take in this huge value object

This is called a God object. It is what happens when you give up on organizing and just dump everything in one place. It just hides the mess somewhere else.

added 308 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
added 308 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading