home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.linux.misc      Linux-specific topics not covered by oth      135,536 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 135,147 of 135,536   
   Lawrence =?iso-8859-13?q?D=FFOlivei to All   
   Re: The Value of a 2nd Look At Code   
   25 Jan 26 19:16:30   
   
   From: ldo@nz.invalid   
      
   On 25 Jan 2026 11:07:20 GMT, Stéphane CARPENTIER wrote:   
      
   > That's why it's stupid to consider the best programmer as the one   
   > who produce more lines of code than others.   
      
   I once took a program of about 8000 lines of code, written by someone   
   else, and cut its size in half.   
      
   Actually the basic idea behind the simplification was very simple. The   
   program was a plugin doing import and export of object definitions   
   between the host application’s internal format and an external   
   database. The import function was one gigantic sequence of handlers   
   for all the database fields, which generated corresponding attributes   
   for application objects, while the export function went the other way.   
      
   What I did was replace the bulk of both functions with a single table   
   of the correspondences between the two data representations. That   
   shrank the import and export functions down to just a couple of dozen   
   lines each -- they became just interpreters of table entries. I also   
   found some discrepancies between the two original functions, which   
   disappeared as a result of using the common table.   
      
   This is called “data-driven” or “table-driven” programming. It’s   
   quite   
   a common technique for reducing code size. Less code to write means   
   less code to maintain going forward, and less opportunity for bugs to   
   sneak in. Win-win.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca