On Sat, Jan 27, 2007 at 01:22:24PM -0800, Godfrey DiGiorgi wrote:
> On Jan 27, 2007, at 10:08 AM, John Francis wrote:
> 
> > ... Mind you, the important qualifier there is "well-written". ...
> 
> Aside from the fact that I think you're the *only* person who ever  
> said to me that they found C++ easy to read, I agree with this part  
> 100%. That said, it's easy to make a mess in nearly any language,  
> including English. ;-)
> 
> Do you find it easy to write well-written C++? I never could: no  
> matter how I tried, I could not find a way to format the code that  
> didn't give me a headache at some point or another.

Writing clear, concise code is never easy.  But if you start out
with a well-written piece of C code with clear distinctions between
functional elements and sub-tasks, and a clearly-defined API for
tasks that cross module boundaries, it's not too difficult to shuffle
the code around into C++ code which is at least as easy to understand
as the original C.

Fortunately for me, that pretty much matches how I design and write
code.  I'll start off with some fairly straightforward linear code
that performs the task in question.  Then I'll look for chunks of
code that perform pretty much the same kind of subtask, and see if
I can abstract them into methods operating on a class object (and
maybe add a subclass/superclass to handle variations).

Basically if you have the kind of mind that's good at spotting
patterns you should be able to write fairly good C++ code.

I've been doing object-oriented programming since before the term
was invented; for just one example, kernel I/O programming (back
in the days before Unix came to dominate the mainframe world).
The various calls between the core kernel and the device drivers
are really just methods, and the device data block is an object.
In fact I/O all levels, from the kernel to the usel-level APIs,
is a task which seems a perfect fit for object-oriented code.


-- 
PDML Pentax-Discuss Mail List
PDML@pdml.net
http://pdml.net/mailman/listinfo/pdml_pdml.net

Reply via email to