Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Re: Speed of linking Message-ID: <8805182156.AA20275@cory.Berkeley.EDU> Date: 18 May 88 21:56:50 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 49 :We all know that Modularity Is A Good Thing, right? Consider that in :C, the scoping of variables is limited to one of: 1) global, 2) functions, :or 3) to files. We also know that global variables are The Root Of All Evil :(ok, so I use 'em sometimes...). Let's assume that everyone uses :information hiding principles in functions when possible to avoid those :Evil Global Variables, so we're in good shape with variables that are :local to functions. Just because a particular variable may have a large scope doesn't mean you must use or assume it as such. Although it *is* nice to be absolutely sure of something (i.e. the language doesn't allow the variable to be any more than what you use it for), you get equivalent results by sticking in a two line comment at the beginning of your code telling other programmers 'Hey, I'm defining static variables in this file but only the ones defined at the top will be used by all the routines in this file.... those static variables defined in the middle of the file will be used only within a particular section and not beyond that'... Or something to that extent. Usually such practices are obvious even without the comment, and certainly the programmer knows *exactly* what he is doing. :In other words, other things being equal, someone with lots of little C :files is probably doing a better job of implementing structured programming :information hiding principles than someone who has a small number of :huge C files (present company excepted, of course :-). Unless he makes the source unreadable and difficult to manage by overly breaking it up. Don't get caught up in the theory.... structured programming isn't just restrictions in the language... in fact, structured programming is more personal style than anything else, and language restrictions can almost be ignored. It really comes down to how good a programmer one is... the 'bad' programmer is going to write bad code no matter what structural constraints are placed on him. (This is a general comment... I've never seen the original poster's code so I can hardly have an opinion on it!!). :Matt, I'm only criticizing your suggestion to Jack, not your actual :programming style...From some of your designs I remember seeing, it's :clear that you're a good programmer. And your software's functionality :is marvelous anyway; I just figure someone's gotta throw in the obligatory :comments about modern programming methodologies. Creating large modules :is a sin that some of us (like me) commit sometimes, but we shouldn't :advocate it. Not at all, you give me a chance to explain my philosophy! -Matt