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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/17/11 08:37
Read: times


 
#180641 - Always good to read code
Responding to: ???'s previous message
Andy Neil said:
David Good said:
Jack Ganssle once observed that while students in most professions spend an appreciable amount of time studying quality examples of their craft

I think the key thing is that this happens under the guidance of a "mentor" - who can provide a commentary on what the "apprentice" is seeing.

The trouble with just looking at existing designs (whether hardware or software) is that it just shows you what the designers did - not why they did it.


Even without a mentor, it's meaningful to read lots of code.

You soon learn to like or dislike different code. But you need to know enough to understand the code in the first place, so that a reasonable amount of brain capacity can be spent on looking at details of the code. How things are declared. How timing issues are handled etc.

Even without a mentor, it will soon be obvious if a design pattern results in "clumsy" code.

A big trap for a reader who doesn't know the quality of the code is to spot potential timing issues - code that may look elegant, but ignores what happens when an 8-bit processor have non-atomic updates of multi-byte variable from ISR and main loop without protection etc. Such issues are almost impossible to spot until you do know about them and know what to look for.

In many situations, it may be enough to read code and have access to a web forum where it is possible to ask questions about specific things seen in code - with publicly available code it is easy to post a link to the source.

List of 37 messages in thread
TopicAuthorDate
Studying good code?            01/01/70 00:00      
   Apprenticeship            01/01/70 00:00      
      Always good to read code            01/01/70 00:00      
   I assume you write ...            01/01/70 00:00      
      Nice! :)            01/01/70 00:00      
   Becoming an "efficient firmware architect"            01/01/70 00:00      
      Professional training classes            01/01/70 00:00      
   A call to the 8052 community            01/01/70 00:00      
      Stumbling stone is commercialism            01/01/70 00:00      
      my initial offerings            01/01/70 00:00      
         Great!            01/01/70 00:00      
      A more fundamental problem            01/01/70 00:00      
         Hardware-specific vs. "good code".            01/01/70 00:00      
            source of inspiration            01/01/70 00:00      
               Intentionally bad vs. unintentionally bad?            01/01/70 00:00      
                  Hard to intentionally write really bad code            01/01/70 00:00      
                     why it's hard to write bad code...            01/01/70 00:00      
                        Standard mistakes.            01/01/70 00:00      
                           Brilliant link            01/01/70 00:00      
                     Bad code that actually works.            01/01/70 00:00      
                     it takes a genius            01/01/70 00:00      
         Good code for teaching            01/01/70 00:00      
            _More_ than just MISRA? *heartattack*            01/01/70 00:00      
            Pedagogical            01/01/70 00:00      
            and there's the rub            01/01/70 00:00      
               Problem with commenting too            01/01/70 00:00      
               Many hands make light work            01/01/70 00:00      
         Arduino            01/01/70 00:00      
            No need for reference hw            01/01/70 00:00      
               Beautiful Code            01/01/70 00:00      
                  There are lots of books on good coding practices ...            01/01/70 00:00      
                     And that was the OP's specific question!            01/01/70 00:00      
      Another Fundamental Tenet            01/01/70 00:00      
         Critisism            01/01/70 00:00      
   studying code ...            01/01/70 00:00      
      Even high-end embedded suffers            01/01/70 00:00      
         I agree, but            01/01/70 00:00      

Back to Subject List