|
message: 6
date: Mon, 10 Feb 2014 16:35:27 -0600
from: Scott Klement <c400-l@xxxxxxxxxxxxxxxx>
subject: Re: [C400-L] C coding
Frank,
In my opinion, C (and C++) are very well suited to writing things like
tools, compilers, OSes, drivers, and similar things. In my job, I use
it for 5250 emulation products, modernization tools (5250 screen
refacing, Open Access handlers that produce web applications, etc.)
It's a very different experience writing this sort of code, since it
rarely uses a database at all, doesn't really ever do number crunching
or totalling, etc. Very different from business logic. I find RPG to be
a much better environment for business logic. (And, in fact, where I
work we use RPG as well, using C where it's appropriate, and RPG where
it's appropriate, etc.)
We certainly do serious coding in ILE C on IBM i. (Sorry, I will not
say "on AS400", as I don't want to appear _that_ outdated.)
You can write very nice, maintainable code in C. Just as with any
programming language (C, C++, Java, PHP, RPG, JavaScript... doesn't
matter) it's always best to divide your code into modular parts that
stand alone, and for each part to have a 'well-defined interface' that
consists of a prototype (called "signature" in some languages) that
defines what is allowed to be passed into the routine, and this is the
_only_ way that variable data gets passed on a call.
This assists with encapsulation: You don't need to understand the logic
within the routine to call it, you only need to understand the
interface. It also assists with reusability... you don't have to
worry about it affecting something outside of the routine, because
everything is internal, except the bits you can see in the interface.
It also assists with maintenance and agility, because you can rewrite
the internals of the code without worrying about it affecting the
callers, as long as you keep the interface compatible.
The other stuff you mention (loop on a single line of code making it
hard to step thru in a debugger, etc) is just a matter of coding style.
I wouldn't even try to debug an intermediate representation of the
code (IBM doesn't give us debugging tools for that, anyway) but if I
needed to debug it, I'd simply insert some line breaks into the code so
it's not all on one line... then I can use a normal debugger. It's not
that big of a deal.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.