Original Post
Hi all, All right, so I was revising for my Software Engineering exams when I come across the "holy grail" of OO, which is reusable objects. This leads me to wonder how achievable is that goal, really. But from my limited experience of coding in OO (Java mostly), it seems to be an unachievable pipe dream. I was reading a book on Aglie Development the other days and the author presented a simple example of lamp and an on switch. This problem is easily solvable with just 2 classes, but if you want to make the objects resuable, you must introduce three or four other interface classes and etc. One practical example I ran into while coding my own engine the other time was this - say I have an Entity class, which does all the logic (calculating distance moved, setting its state and etc.). I really want this Entity class to be a black-box, which means I can use it into another engine if possible. But let say I have my own logging utility. I want my Entity class to log useful debug messages to a .txt in case of crashes. And usually, logging is implemented as a singleton. But if my Entity class uses the logging singleton, it won't work in a project which doesn't use the same logging singleton. I probably can achieve this by having lots of abstract interfaces, but this means in the end I will up with a rather large component which may be a pain to intergate it in with other projects. So is reusable OOP feastible really?