Post Reply 
C++ Was a Joke
03-09-2014, 12:28 PM (This post was last modified: 03-09-2014 12:33 PM by Marcus von Cube.)
Post: #15
RE: C++ Was a Joke
A few more or less (un)related comments:

Another big point in OO design is visibility and encapsulation of data and code. A class defining the properties and behavior of the objects it represents has data and methods which are visible from outside: This is the public interface which should be well thought out, documented, and stable in order to be useful (especially for other developers or further projects).

Then there is the protected interface. It consists of methods and data which are not visible from outside but help in extending the class by the concept of inheritance. It's meant for developers who need to provide similar or extended functionality which may require to reuse some of the internal workings of the original code without rewriting or copying it.

Last but not least there there are private methods and data. They serve like local variables and subroutines but are subject to change without notice.

A big difference between an attribute of an object (be it private, protected or public) and a local variable is that the former saves state during the lifetime of an object. A static local variable in C isn't the same because it exists just once in memory while an attribute exists once for each object. In classic C you would either need to pass the context as a parameter or use arrays and a reference index to access the right data.

The main problem of C++ is that it is a superset of C. You're not forced to follow the object oriented programming paradigm, classic C style modularization works as well with only very few differences to plain C. This leads to a wide range of coding styles. There are a few other concepts in C++ which may lead to confusion (implicit casts combined with operator overloading is a debugging nightmare!). Java has tried hard to avoid all this at the cost of some added verbosity. You simply can't write Java code without using the keyword class!

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
C++ Was a Joke - Dave Frederickson - 03-04-2014, 05:27 PM
RE: C++ Was a Joke - HP67 - 03-04-2014, 06:10 PM
RE: C++ Was a Joke - Garth Wilson - 03-04-2014, 09:42 PM
RE: C++ Was a Joke - Han - 03-04-2014, 10:05 PM
RE: C++ Was a Joke - Thomas Klemm - 03-04-2014, 11:20 PM
RE: C++ Was a Joke - Thomas Radtke - 03-08-2014, 11:07 AM
RE: C++ Was a Joke - Thomas Klemm - 03-05-2014, 06:35 AM
RE: C++ Was a Joke - pascal_meheut - 03-04-2014, 10:24 PM
RE: C++ Was a Joke - Garth Wilson - 03-04-2014, 10:35 PM
RE: C++ Was a Joke - Garth Wilson - 03-05-2014, 09:47 AM
RE: C++ Was a Joke - HP67 - 03-05-2014, 10:57 AM
RE: C++ Was a Joke - Tugdual - 03-05-2014, 07:34 PM
RE: C++ Was a Joke - David Hayden - 03-05-2014, 09:11 PM
RE: C++ Was a Joke - Joe Horn - 03-08-2014, 10:45 AM
RE: C++ Was a Joke - Marcus von Cube - 03-09-2014 12:28 PM
RE: C++ Was a Joke - Howard Owen - 03-10-2014, 01:43 AM
RE: C++ Was a Joke - Sylvain Cote - 03-10-2014, 03:11 AM
RE: C++ Was a Joke - Marcus von Cube - 03-14-2014, 10:40 PM



User(s) browsing this thread: 3 Guest(s)