OO Design Question: Should *everything* be inside a class

Started by
10 comments, last by JD 19 years, 3 months ago
To all that posted, thanks for the discussion, it helped a heap. I have realized that my view of what classes should be was perhaps too strict, that they should not nessesarily be limited to real world objects and secondly most people here tend to think that mixing a bit of OO with C is not a bad thing as such cause C++ gives you that freedom, so maybe I was being too strict on myself there as well.

Most important of all i realize now that this is an area of discussion and debate, which means I am not the only one thinking about it.

Its all good, I am doing some C++ now looking at some source code and i think i will get the balance right as i go along.

Once again, thanks for the help.

[Edited by - Mr Lane on January 2, 2005 10:02:36 AM]
Advertisement
Mr Lane, very well said. Sometimes though, your objects can reflect real world like objects and sometimes your objects will have no equivalent in real world. You might want to look up embedded C++ programming in how they deal with OOP because they must invent objects a lot. Their problem space is very close to hardware. In C++, you don't have to put everything into a class. You can have helper functions that work on objects. You can put them inside a namespace if you want. You can have globals for faster access if speed is your concern. So instead of passing function params down thru a chain of functions you can bypass it and access a global from the lowest function in the chain. I always say that if we didn't have to worry about efficiency then programming would be lot easier as we could afford less efficient but better designs.

This topic is closed to new replies.

Advertisement