C coding
frank kolmann <[email protected]>
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <CAB-SQvjfeKp9jkTS5MODXV4NEOqcazhu29qN1AG=QK9srZGxTw@mail.gmail.com> |
Thanks Scott I understand now. It is the same old story, a tool is only a tool and the skill comes from user , dare I say craftsman. As ever I am thankful to sit at the feet of a master. Oh sorry about the IBM i called the AS400, (good thing I never mentioned S38) Frank >message: 6 >date: Mon, 10 Feb 2014 16:35:27 -0600 >from: Scott Klement <[email protected]> >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. -- This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/c400-l or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.