How to REALLY start thinking in terms of objects?
Posted
by
Mr Grieves
on Programmers
See other posts from Programmers
or by Mr Grieves
Published on 2011-03-17T20:51:14Z
Indexed on
2011/03/18
0:18 UTC
Read the original article
Hit count: 273
object-oriented
I work with a team of developers who all have several years of experience with languages such as C# and Java. Most of them are young enough to have been shown OOP as a standard way to develop software in university and are very comfortable with concepts such as inheritance, abstraction, encapsulation and polymorphism.
Yet, many of them, and I have to include myself, still tend to create classes which are meant to be used in a very functional fashion. The resulting software is often several smaller classes which correctly represent business objects which get passed through larger classes which only supply ways to modify and use those objects (functions). Large complex difficult-to-maintain classes named Manager are usually the result of such behaviour.
I can see two theoretical reasons why people might write this type of code:
- It's easy to start thinking of everything in terms of the database
- Deep down, for me, a computer handling a web request feels more like a functional operation than an object oriented operation when you think about Request Handlers, Threads, Processes, CPU Cores and CPU operations...
I want source code which is easy to read and easy to modify. I have seen excellent examples of OO code which meet these objectives. How can I start writing code like this? How I can I really start thinking in an object oriented fashion? How can I share such a mentality with my colleagues?
© Programmers or respective owner