Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/20/06 13:55
Read: times


 
#120675 - This 'other guy' agrees.
Responding to: ???'s previous message
See what the other guys say and if they agree/disagree with my comments. I'm sure there'll be a bit of discussion
This 'other guy' agrees.

One point I want to push is that while as Russell states "sometimes when we're running out of clock cycles we need to make shortcuts" the point is that you can not do so without catastrophic results, if the initial code had shortcuts.

I would say that, at most, I end up with a shortcut in one of ten projects.
Often when you think you need a shortcut, you do not. For instance, in one case I had to switch a macro to a function for space reasons. This made a process too slow. I might have handled this by making the code unintelligble by changing an array to discrete entries, some in DATA, some in IDATA, some in XDATA. This would, of course have required a 'piece of true code spaghetti' to load the array. Instead of the 'shortcut' I rewrote the function in assembler and all was good.

Now, the real issue: Most of us that have been around for a while have had some code we wrote years earlier dumped on our desk with a "we need to add ...". THAT is when you learn the value of clear, understandable code. In the early days when source was processed at 10 cps and a 30 character comment added 6 seconds (two passes) to the assembly time (had this been today I would have added ~1000 such comments) I wrote code very sparsely commented. This code was given to me 3 years later to add a feature and - oh boy. I think I spent more time figuring out what was going on than I saved in the creation of the original code for 'fast assembly' (about 3 hours for the program).

Yes, with assembly times like that (and you had to sit there to make sure the paper tape did not get tangled) I MAY have had an excuse for sparse comments, but were I to do it again, even under such circumstances, I would comment with no regard for assembly time.

what makes clear, understandable code ?
1) STRUCTURE, code that run all over the place is impossible to follow
2) FUNCTION/SUBROUTINE HEADERS, every function shall have a header that states what the function does, which inputs (and their limits) the function expect and what it returns.
3) COMMENTS that state what YOU are doing, not what the instruction is doing.

The 1) 2) 3) above does not reflect priority, ALL are extremely important.

Erik

List of 39 messages in thread
TopicAuthorDate
16x128 LED sign firmware            01/01/70 00:00      
   Schematic            01/01/70 00:00      
   Some comments            01/01/70 00:00      
      This 'other guy' agrees.            01/01/70 00:00      
         A lesson I learned all to while.            01/01/70 00:00      
            we have all heard that BS            01/01/70 00:00      
               A better cure            01/01/70 00:00      
                  Please elaborate...            01/01/70 00:00      
                     Fire him            01/01/70 00:00      
   need a schematic or, at least, a description of th            01/01/70 00:00      
   a faster, simpler method            01/01/70 00:00      
   Pray for us            01/01/70 00:00      
      Best wishes, dear Payam!            01/01/70 00:00      
      a blessing in disguise?            01/01/70 00:00      
   SCH, PCB            01/01/70 00:00      
      Additional protection circuitry recommended            01/01/70 00:00      
         reset???            01/01/70 00:00      
            ADM691, only backup control for RAM?            01/01/70 00:00      
               fot THAT money? a diode would do...            01/01/70 00:00      
                  ...and a resistor. Or two diodes...            01/01/70 00:00      
   Book            01/01/70 00:00      
      Don't believe everything you read. Sorry about Kin            01/01/70 00:00      
         Yes, Payam is an honorable man!            01/01/70 00:00      
   thanks..            01/01/70 00:00      
      you better get a superfast processor            01/01/70 00:00      
   3D Virtual PCBs            01/01/70 00:00      
      what is a .wrl file?            01/01/70 00:00      
         .wrl            01/01/70 00:00      
            no way ...            01/01/70 00:00      
               ?            01/01/70 00:00      
                  is that not an executable?            01/01/70 00:00      
                     The gov't to the rescue            01/01/70 00:00      
                        Flux in flux            01/01/70 00:00      
                           Linux, 3D and vrml            01/01/70 00:00      
                              why?            01/01/70 00:00      
                                 Try it.            01/01/70 00:00      
                                    no, under rules            01/01/70 00:00      
                        what a joke            01/01/70 00:00      
   MessagingSoftware            01/01/70 00:00      

Back to Subject List