Guru on Rails

if you don’t sacrifice for your dream then your dream becomes your sacrifice.
Sydney, Sat 01 Jun 2019
Crucial steps of Object Oriented Design
Thu 16 Aug 2018

The topic today is again Object Oriented Design. We just have three words O-O-D though.

Naming

I’d like to say that OOD is not just about Inheritance. When we put some classes there and make them inherits each other with a bunch of public and private methods. We say that this is OOD then. No, it’s not. If we are still doing that, we are going in the wrong track.

OOD is “Object Oriented – Design”. The very first important here I want to say is the “Design”. This is the first glance when we name the classes. When we put the fingers down to write the very first lines of code. It’s crucial. Because we will make that impact to our application forever. It affects the design in the future as well. And because of that, your design will be going wrong since that time no matter you will put how much efforts to this application in future.

Moreover, if we are doing an assignment for job interview. We failed at that time – the time we name the classes.

Coding is just the thing to reflect the logic. If we are in a hurry to code while not really clear about the design, we are just wasting time. We spent hours and hours but then the recruiter will throw our code as trash. It’s like a photographer is taking photos. Nice try! But he put already the wrong layout. Layout is the very first important thing as important as the focusing. Or maybe he suddenly finds that he made out-of-focus pictures at all. He made the good layouts though.

Inheritance hierarchy

The Inheritance hierarchy is the next one after naming classes. To be good at this point, we need to understand clearly the context of each class, the boundaries to distinguish from each other (DRY). We also can rely on the attributes and behaviors.