develpreneur podcast

Finding Balance In Your Object-Oriented Design Complexity

There are many areas of life where moderation is required.  Object-oriented design complexity is one of those situations.  We can create a solution that is highly granular and flexible or one that is monolithic and simple.  However, as is often the case, the best solutions find some middle ground that keeps our application flexible and limits complexity. A Balanced Object-Oriented Design Every solution is unique and has its own constraints and requirements.  Nevertheless, we have guidelines to avoid a solution that is either over-simplified or over-engineered.  They may appear obvious but are often overlooked. Isolate unique functionality – we will not get much re-use from it. Look for repeated actions or manipulations. Focus on a unit of work. Do not... Read more

develpreneur podcast

Documentation Of Our Object-Oriented Solution

It is hard to think of a facet of software development that programmers dislike more than documentation.  This task is almost always pushed to the end, and shortcuts are used wherever possible.  However, we also are quick to complain about a lack of documentation when we pick up others’ code.  Maybe we need to give so we can get.  that is the focus of this episode. Documentation Begins With A Signature All good documents start from an outline.  There is either a written or mental plan that the author follows.  In software, this objective comes from the signatures of the class and methods.   We have a set of details we must provide for every method out there. What are the... Read more

develpreneur podcast

Test-Driven Development – A Better Object Oriented Design Approach

Testing and Design are often at opposite ends of the software development life-cycle.  However, test-driven development is an excellent way to drive our design.  It can help us build better classes and improve re-use.  This episode focuses on TDD and how it can point us to full-featured classes with better error handling and messages. Test-Driven Development For Design We previously looked at unit testing and class-level quality assurance.  While those are important tasks once we get the class implemented, they are better incorporated into the design process.  When we do, it ties our testing (validation) more directly to requirements.  Thus, we have goals for each bit of code to achieve.  We drive our implementation by the tests we need to... Read more

develpreneur podcast

Testing Object-Oriented Code – A Better Design Approach

We have spent a lot of time on the core concepts of object-oriented design and programming.  However, testing object-oriented code is at least as essential to our practical approach.  We need to ensure that our code is written with a quality that makes it worth re-using.  Otherwise, it is a better use of time to write new code instead of wrangle low-quality code with the idea of re-use.  We have all seen these situations where it is easier and faster to start from scratch than building on previously written code. Testing Object-Oriented Code Through Design We will focus on test-driven development in the next episode.  However, our implementation and approach to a solution can be improved with the inclusion of... Read more

develpreneur podcast

Destructors And Cleaning Up An Instance: Object-Oriented Design

When we get to the end of our use of a class instance, we need to clean up after ourselves.  This is where destructors come into play.  They are similar to constructors in a mirror fashion.  While a constructor creates an instance, a destructor removes an instance. Destructors And Resource Release Many languages have a default destructor, much as they have a default constructor.  These methods likely free up some pointers behind the scenes.  However, we also have resources and properties or even notifications that may be needed as part of this process.  That leads us to a process that effectively undoes the creation and initialization steps.  We first release resources (reverse the initialization).  Then we remove the instance from... Read more

develpreneur podcast

Constructors And Initializers In Object-Oriented Design

When we create an instance of a class, we often need to do some initialization.  Constructors and initializers achieve this goal.  These are two different ways to get our data into an instance and are an essential part of our design.  In this episode, we examine the design decisions we need to make as we decide how to use these common methods. Constructors And Initializers – The Distinction A constructor and an initializer method can be thought of in very similar ways.  However, there is one particular trait that differs between the two approaches.  A constructor returns an instance of a class, whereas an initializer sets values on an instance.  This may seem to be a minor difference.  It is... Read more