DEV Community

Cover image for How to write an object oriented program that doesn't suck

How to write an object oriented program that doesn't suck

Naveen on November 17, 2016

It is fairly obvious that object oriented program has been used as a silver bullet in the modern day programming. Whether you are working as a tech...
Collapse
 
thedeemon_lj profile image
Dmitry Popov •

In _accountType == "SavingsAccount" you're comparing an int with a string. Just saying. ;)

Collapse
 
mhmd_azeez profile image
Muhammad Azeez •

Great article, one thing though: ExType is not defined in the multiple logger types example

Collapse
 
postsrc profile image
PostSrc •

This article is really SOLID :D

for the last part Customer constructor should be Account right?

Collapse
 
aqeelse profile image
Aqeel Ahmad •

Nice explanation of SOLID principles with good examples.

Collapse
 
rrconstantin profile image
rrconstantin •

Some people (myself included) say that logging also pollutes your class and violates srp. That's why I switched to AOP logging.

Collapse
 
lluismf profile image
Lluís Josep Martínez •

Using obj as a variable name for the Loggers is bad.

FIX : rename it to logger

Collapse
 
imthedeveloper profile image
ImTheDeveloper •

Really enjoyed reading this as I'm looking into patterns and code structure. The usage of real world examples and requests from the business are excellent.

Collapse
 
stefandorresteijn profile image
Stefan Dorresteijn • • Edited

If you're really trying to learn about OOP, read Sandi Metz's Practical Object-Oriented Design in Ruby and 99 Bottles of OOP. They'll teach you solid OOP.

Collapse
 
elwinbran profile image
ElwinBran •

This article is a fine introduction to the ideas of maintainable OOD and OOP.

Collapse
 
bmontgomes profile image
Bruno Gomes •

That was a pretty solid read! (no pun intended) Your examples were great. :)

Collapse
 
simplymanas profile image
Manas Ranjan Dash •

Good one for every level..

Collapse
 
samizan profile image
Samer Azani •

Cool solid examples :)

Collapse
 
theavuthnhel profile image
Theavuth NHEL •

Good Idea (Y)

Collapse
 
djubreel profile image
Jubril Edu •

Awesome write-up

Collapse
 
gordeevd profile image
Dmitry Gordeev •

neat

Collapse
 
mshwf profile image
mshwf •

Very good, thanks