Posted by: CJ | March 21, 2011

Coding Rant: 4 Principles of OOP edition

I saw a post today about “The 4 Principles of Object-Oriented Programming.” Seemed like one of the weirdest ideas I’ve seen. There’s one principle: you use objects. But for some reason They thought the 4 major principles are

  • Encapsulation: Only access and change an object’s data through object methods. (Accessors and mutators, in OOP lingo.) Don’t let a creator of an object monkey around with the data directly.
  • Abstraction: Who wants to think about structs and pointers and malloc and memory when you can just think in terms of Platonic ideal forms. Roughly.
  • Inheritance: Easy way to organize and reuse code for similar constructs. Nearly a must for large projects.
  • Polymorphism: Yeah, sure, late-binding is awesome. And certainly nicer than massive amounts of overloading.

Anyways, I’m just annoyed because I don’t think it makes sense to call those 4 aspects of OOP programming “THE 4 Principles of OOP Programming”. I’d probably just boil it down to inheritance, and call the rest either consequences or good coding conventions.

Then again, I’m still a neophyte, so what do I know?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: