Pitfalls of Object Oriented Programming
Tony Albrecht – Technical Consultant Developer Services
What I will be covering
• A quick look at Object Oriented (OO) programming • A common example • Optimisation of that example • Summary
Slide 2
Object Oriented (OO) Programming
• What is OO programming?
– a programming paradigm that uses "objects" – data structures consisting of datafields and methods together with their interactions – to design applications and computer programs. (Wikipedia)
•
Includes features such as
– – – – Data abstraction Encapsulation Polymorphism Inheritance
Slide 3
What’s OOP for? • OO programming allows you to think about problems in terms of objects and their interactions. • Each object is (ideally) self contained
– Contains its own code and data. – Defines an interface to its code and data.
• Each object can be perceived as a „black box‟.
Slide 4
Objects • If objects are self contained then they can be
– Reused. – Maintained without side effects. – Used without understanding internal implementation/representation.
• This is good, yes?
Slide 5
Are Objects Good? • Well, yes • And no. • First some history.
Slide 6
A Brief History of C++
C++ development started
1979
2009
Slide 7
A Brief History of C++
Named “C++”
1979 1983
2009
Slide 8
A Brief History of C++
First Commercial release
1979
1985
2009
Slide 9
A Brief History of C++
Release of v2.0
1979
1989
2009
Slide 10
A Brief History of C++
Added • multiple inheritance, • abstract classes, • static member functions, Release of v2.0 • const member functions • protected members.
1979
1989
2009
Slide 11
A Brief History of C++
Standardised
1979
1998
2009
Slide 12
A Brief History of C++
Updated
1979
2003
2009
Slide 13
A Brief History of C++
C++0x
1979