Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sun Nov 19, 2017 6:51 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Coding Standard
PostPosted: Mon Jan 07, 2008 10:02 am 
Offline

Joined: Wed Apr 04, 2007 9:56 am
Posts: 2
I'm with Brian on header issue. Mos all of the "headers" give no information about the function, so what is the point? In API.C there are about 220 fuctions, all with functions headers. Guess how many function headers give any information other than the name... Ok, ok, maybe API.C is a bad example, let's look at message.c, a file with 40 functions, all of them have function headers, only 12 say anything other than the function name (and what is said isn't very helpful when you're the new guy). Maybe filesys.c is a better example with 58 functions (all with function headers... was this enforced somehow?)... but only 16 have more than just the function name. None of them tell me anything about input parameters or much about the function/algorithm itself (and some of the functions are non trivial... some over 700 lines.... total file lines = 8550). I'm sure I can find more examples as most of the firmware seems to be a vast waste land of code devoid of comments.



Don't get me wrong... All in all, I'm impressed with the code we have here at QSI and I'm happy to be associated with it. I'm the first to point out that customers don't pay for comments, they pay for systems that do what they need. So when schedules get tight we write code, not comments, we are busy debugging and comments are often an after thought. In times past I've been mislead by comments and so in general I first look at the code when I want to know how things work. It is nice, however, to have some high level descriptions here and there... especially when I come across a 10000 line file and when I'm new and unfamiliar with the subsystem.



All I'm saying is that to require a function header with nothing more than the name seems like wasted human effort to me. My editor parses out all functions of a file for me. I can easily jump from function to function. If I need a visual, a simple comment line that spans the entire screen width (80 or more characters... that is another topic) seems sufficient.



Paul J.


Top
 Profile  
 
 Post subject: coding standard
PostPosted: Mon Jan 07, 2008 11:01 am 
Offline

Joined: Wed Apr 04, 2007 9:56 am
Posts: 2
Just a couple of other thoughts...



1. I favor spaces not tabs.



2. I do occasionally print code.



3. Code standards/style has always seemed to be an "art form" to me. Over the years, I've been involved in several heated discussions about "what is better, easier, simpler, etc". Has anyone ever found a tool to measure "readability", "understandability", "maintainability"? We really need a device similar to a network analyzer that can draw bode plots of the frequency response a circuit and then we can all evaluate the "phase margin" so we know when our circuit (in our case code) is "better" rather than just "different". Something mathematical, scientific, irrefutable. Imagine if such a device did exist so we could measure the "phase margin" of our code... such things could then be studied and taught in our institutions of higher education, we could know when we have "adequate phase margin" to meet reliability/stability needs.



Paul J


Top
 Profile  
 
 Post subject: Re: Coding Standard
PostPosted: Tue Feb 09, 2010 11:03 am 
Offline

Joined: Thu Jan 03, 2008 1:17 pm
Posts: 3
The coding standard should mention warnings. Warnings are typically a sign of an crash waiting to happen. They should be treated as errors. A good application should compile with zero compile warnings.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group