View Single Post
Old 10-10-2008, 10:30 PM   #29
Japo
Autonomous human
 
Japo's Avatar


 
Join Date: Mar 2006
Location: ,
Posts: 4,615
Default

Quote:
Originally Posted by Data View Post
But the Cism are actually smaller and for me at least as intuitive as the C++ things.
True, maybe people who have learnt to program oriented to objects from the start don't get how all those abstractions are both added power and added burden. You have to learn the object libraries. And in some cases a more low-level code is not more clumsy nor illegible and sometimes the contrary. That's why I think of objects as a tool rather than a philosophy for the whole of all projects; and they don't really show their full power but as an interface between different programmers. Using object orientation as a way to make learning programming easier just creates bad programmers in general.

Usually you can't be sure if you can really get away with "C-isms" and the like. Something may not be in the standard and yet your compiler may support it and others won't. (It's not the case and your code is robust.) And you're not supposed to know, because information hiding is a sought effect of object orientation.

As a matter of fact using an overloaded assignment operator with a string is not a C-ism at all... Actually the robust C code to clear a string or check if it's not empty is very brief and immediately recognizable:

Code:
*templine = '\0';
Code:
while ( *templine != '\0' );
(Actually I could write just 0 instead of '\0', couldn't I? Hm better safe than sorry.) Of course templine would here be a C string (pointer to char), not a string object. I can't do this stuff with objects and I'm not supposed to, their innards are "private".

But I'm rambling...
__________________
Life starts every day anew. Prospects not so good...

Last edited by Japo; 10-10-2008 at 10:57 PM.
Japo is offline                         Send a private message to Japo
Reply With Quote