Post Reply 
C++ Was a Joke
03-05-2014, 09:11 PM
Post: #12
RE: C++ Was a Joke
Robust programs require clear code and well defined interfaces. You can do that well, or poorly, in any language.

OO helps me define the interfaces. You can wrap things up in nice little packages (objects). Consider RPL objects for example. All objects have a prolog. Then can be executed, skipped and displayed (converted to text). It's natural to define an "object" class with a prolog and methods to execute, skip and display the object. A real advantage of this comes when you need to define a new object: You know that you have to write the execute, skip and display methods.

But the real advantage comes in things that are easy to overlook. For example, you can create an array of any object type, even the variable length types. If you want to access to 87th element of an array, then you'd really like to skip right to that element if the elements are all fixed length. Rather than add logic in the array code that says "if it's an array of reals or complex numbers or characters then skip right to it" you can add a "fixed length" flag to the object and the code can say "if it's an array of objects that are fixed length then skip right to the correct place."

Now when you go create a new object, you know that you need to define that flag. Otherwise, you'd have to somehow remember to go change that obscure code in the array processing - only you wouldn't remember to do it until Joe Horn found the bug after the code was released. Smile

Dave
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: 4 Guest(s)