Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should be OO and what shouldn't?

Tags:

oop

I've read a lot of people saying that some things shouldn't be written in an object orientated style - as a person learning the OO style coming from a C background, what do they mean by this?

What shouldn't be OO, why do some things fit this design better, and how do we know when it's best to do what?

like image 703
Rich Bradshaw Avatar asked Oct 07 '08 12:10

Rich Bradshaw


1 Answers

The real world is full of objects.

It's helpful to make the software world match the real world.

"What about 'system utilities'? They just deal with abstractions like sockets and processes and file systems." They sound like things to me. They have attributes and behaviors, they have associations.

If you're looking for proof that OO is better, there isn't any. Nothing is better because better is a gloriously vague term. Anyone who's clever can write any program in any style. You could adopt functional, procedural, object-oriented, or anything you feel like.

I use OO because I have a very small brain and must learn to live within its limits. OO is a crutch to help me struggle through programming. If I was smarter, richer and better-looking, I wouldn't need the help, and I could write non-OO programs. Sadly, I'm not smart. Without class definitions to isolate responsibility and structure an architecture, I'd still be writing single-file "hello world" variants.

like image 77
S.Lott Avatar answered Sep 27 '22 23:09

S.Lott