#5– Episode 67

Episode 67 – Object Oriented Mistakes

Presented by Joe Zack, Michael outlaw and Allen Underwood, the group addressed many object-oriented mistakes that coders often make. I found this to be an interesting podcast because like many of us upcoming coders, we are taught mistakes that cause problems when attempting to develop in an object-oriented environment. From the previous design patterns episode, we were able to understand the best situations and the proper design pattern that should be used. For example when using domain designs, we have learned not to use domain anemic models. Before we continue, anemic model is the use of a software domain model where the domain objects contain little or no business logical validations, calculations, business rules etc. These are typically called bags of properties with getters and setter without any kind of behavioral type method. The domain model objects cannot therefore guarantee their correctness in any moment due to lack of validation and mutation logic which is usually placed somewhere outside the class being addressed. One would ask, why is this considered an anti-pattern in todays programming world, well first of all, it disrupts the concept of object-oriented design. This design contracts what is implemented when on opts to use the object oriented design. Object orientation allows objects to have states and sessions but anemic causes stateless objects. It is great for just a simple application because there is a clear separation between logic and data unlike object oriented programing. Simple applications also do not require a ton of logic to be implement. They do not need methods with behavioral code in them. After this point, Micheal spoke of another anti-pattern. This pattern was known as the base bean anti-pattern. This is when you inherit functionality from a utility class instead of delegating to that utility class. The issue associated with this practice is that defeats the purpose of inheritance. Inheritance is used for the wrong reasons. The main purpose of inheritance is to create a hierarchical order in which code information can be managed and understood. Wrong implementation of inheritance disrupts object properties and class properties. Overall, design patterns are created for incoming developers and even intermediate developers to have a guide that can be used as a reference. Thy provide us with a way to getting things resolved or better yet, the first solution that solved the problem. It is up to every developer to learn beyond that and recognize how they can utilize the already laid out platform to their own coding needs and development.

 

 

 

Source

https://player.fm/series/coding-blocks-software-and-web-programming-security-best-practices-microsoft-net/episode-67-object-oriented-mistakes

https://en.wikipedia.org/wiki/Anemic_domain_model

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s