Property Design In An Object-Oriented System

Published: March 17, 2021, 10 a.m.

One of the most prevalent topics of consideration in an object-oriented system is property design.  We can keep them simple or create more classes.  The first approach is simpler and faster to implement.  However, we can use objects to provide hooks we extensibility and scaling out our features.  There are trade-offs to be aware of, but we can use some guidelines to shorten the design process.

Property Design Considerations

For purposes of this episode, we will look at two paths available.  We can use a simple type (native) or use a class to define a property.  While we can also utilize collections as properties, those still boil down to one of these two paths.  You will either have a collection of native values or object instances.

A Software Upgrade

A primary benefit of the object approach for a property is that it allows us to upgrade or "power-up" a class.  A simple example of this is a greeting for a class.  We can leave it as a string, or we can provide a greeting object.  That object could start by displaying a greeting in English.  When we want to upgrade the getting, we can add support for other languages or even an interactive greeting object.

The Plugin Approach

The above example can be viewed as a plugin.  We can use this approach to provide a "quick and dirty" for the initial release and then improve it later.  This pattern is excellent in an Agile environment in particular.  We can build out functionality in one class.  Then, we can inherit and extend that class later.  The original features and functions are still available for instances built in the prior version.  Yet, we can use the new approach for new instances.  We get scalability along with stability.  We have designed our solution for growth and flexibility.  These are essential traits for an agile system.