Slashdot Mirror


The Code Is The Design

danielread writes "In 1992 C++ Journal published an essay by Jack W. Reeves called 'What Is Software Design?' Many credit this essay as being the first published instance of assertions such as 'programming is not about building software; programming is about designing software' and 'it is cheaper and simpler to just build the design and test it than to do anything else'. developer.* Magazine has republished this groundbreaking essay, plus two previously unpublished essays, under the title Code as Design: Three Essays by Jack W. Reeves."

270 of 354 comments (clear)

  1. Oh Boy. by Anonymous Coward · · Score: 5, Funny

    Here we go.

    The UML monkeys are gonna have a fit!

    1. Re:Oh Boy. by museumpeace · · Score: 5, Insightful
      You are trolling but there are much better educated responses than your taunt deserves.
      Well, I am no UML monkey and I have seen software development process overdone so badly even the lowliest coder had rigor mortis. But let me share a few experiences that may be exceptional but I doubt it.
      1. I have actually worked with a programmer-turned-project-lead who often stated exactly the premise of TFA as a defense of his designs. He also used design reviews and other people's UML as target practice for a particularly nasty and apparently insecure dismissiveness. He was one of the most brilliant coders I ever met. He understood many programming principles better than others but had a pathological aversion to sharing insight. He was utter hell to work with, poison for the work and the workers in the team. His designs ultimately foundered when noone but him could extend or maintain them.
      2. Though language and architecture are not completely seperable, its a shitty design that can't be expressed in any thing but some particular language...saying UML or flowcharts or whatever gets in your way is just a huge hint that you don't know how to express your idea or you don't really have an idea.
      3. There is not much argument about the proclivities of programmers: they don't read other peoples code, not often enough, not with sufficient comprehension, not unless they are paid to maintain it. That is a generalization of course but with way too few exceptions. Comments, as others will surely point out, are more important for the longevity of code than the code itself. But commenting that can stand in for requirements and specifications? Virtually nonexistent, there is less of that than there is of good UML. I have been to the long, expensive funerals of way too many programs and sometimes, the companies that were built upon those programs to have much respect for an aproach to software that de-emphasises visibility of the big ideas and critical commonalities in code. Those are aspects that good design documents capture. Those are what make real software, software that can be changed by someone other than the author, software that can be quickly re-tooled for another market or a new platform, hang around long enough to make a company some money.
      I'd say the great failing of UML or other design languages or symbology is only that it is not tied to code in such a way that code changes back-propagate to the design document. Its just plain hard work to keep design and code on the same page [litterally and figuratively] but that's what you would pay a competant programmer to do. And that's why JavaDoc and its ilk are my preferred solution in this area[ but I can't point you to a solution that completes the higher level documentation job.]
      --
      SLASHDOT: news for people who can't concentrate on work or have no life at all and got tired of yelling back at the TV.
    2. Re:Oh Boy. by jacquesm · · Score: 4, Funny

      in the good old days code unreadability was directly proportional to job security :)

    3. Re:Oh Boy. by Anonymous+Brave+Guy · · Score: 3, Funny

      It's not any more? Damn! I just spent all day recoding the highly readable 50 lines of C++ I wrote yesterday as a single line Perl before checking it in.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    4. Re:Oh Boy. by jallen02 · · Score: 3, Insightful

      Not such a brilliant coder then ehh?

      The best way I have ever heard someone explain how you can tell of an interface is good is if you look at it and think, "Of course. How else would you do it?". The design is natural and flows well for your average *skilled* programmer. If someone is very taltented but no one else can understand their designs then the code is not maintainable. Code that is not maintainable is not good. Creating unmaintainable code is something BAD programmers do. So you should consider that fella brilliantly BAD ;) The strongest strength anyone can have is realizing their limits and working around or past them. If someone never realizes they are limited they will never grow ;)

      Jeremy

    5. Re:Oh Boy. by alpha_foobar · · Score: 1

      Why isn't there a tool that builds basic UML diagrams from source code... Or is there some [rational?] tool that does exactly this?

      Doesn't seem like it would be particularly difficult to build... hmmm.. of course it would be similar to building a compiler... and I suppose some people call that difficult... But it would be easier from something like Java Bytecode.

    6. Re:Oh Boy. by kootsoop · · Score: 1

      Sure, you can't get fired... but you also can't get promoted!

      --
      "Engineering is the art of making what you want from things you can get" - Jerry Avins
    7. Re:Oh Boy. by Doomdark · · Score: 2, Insightful
      I'd say the great failing of UML or other design languages or symbology is only that it is not tied to code in such a way that code changes back-propagate to the design document. Its just plain hard work to keep design and code on the same page

      And I maintain that UML is to programmers what bicycles are to fish...

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    8. Re:Oh Boy. by rmacapobre · · Score: 1

      complicated systems do require a modeling language for people to quickly pick it up. also design patterns ..

    9. Re:Oh Boy. by timeOday · · Score: 3, Insightful
      I'd say the great failing of UML or other design languages or symbology is only that it is not tied to code in such a way that code changes back-propagate to the design document.
      Well, Rational had (has?) their idea of "round-trip design," which in practice meant you could generate diagrams from code.

      We never found that useful, but what we did do was generate all header and implementation files from the diagrams. To change the class, you changed the diagram and regenrated the files. This way ensured the diagrams accurately reflected the static interdependecies among classes. All the real logic was in the code blocks, of course, which the tool simply copied verbatim from version to version.

      Was it useful? I guess so. I'm not sure it was more useful than the same information extracted into in a textual document more like Javadoc though.

      Anyways, yeah, you need requirements and specifications too. But don't forget those requirements and specifications are just as buggy as code that's never been compiled or run, because that's exactly what they are - very high level pseudocode, that can't be subjected to the rigor of execution in themselves.

    10. Re:Oh Boy. by cmacb · · Score: 1

      I think you are exactly right on every point. However programming prima-donnas rule the industry, and probably provide a good living for people who have to come after them and rescue a mess. I don't blame this on the programmers however so much as weak or stupid management.

      From what I gather, the original author of the article redefines "design" to mean good programming practices and "architecture" to mean good design. Of course when I was working on big OS projects we would have felt a bit silly announcing that we were going to have an "architecture" meeting tomorrow to go over the changes for the next version.... but if the current generation of programmers needs to invent a new language to get the job done, so be it. LOL, OMGWTF!1!

    11. Re:Oh Boy. by Anonymous Coward · · Score: 1, Interesting

      The issue is not that "saying UML or flowcharts or whatever gets in your way" The issue is that the Big Design Up Front model is the wrong approach to development, and unusable. Most of the true design of a program does not come from requirements gathering, but during coding where the developer and customer come together and "try out" requirements. Therefore, it isn't until you have finished writing your code that you have a meaningful document of its design.

      This is the what is taught in Agile methodology : begin with a Story - a vague "essential use case" that only describe the goal, and does not involve specific implementation details. Rapidly progress from a set of nonfuctional towards functional proptotypes, and finalize the implementation details (such as which button goes where on the screen) This approach leads to a more satisfied customer. Otherwise, you wind up spending months (in some cases, years) perfectly a design that the customer find unusable - AKA the waterfall approach.

      This article is not rapping software engineering. Most of the more progressive and experienced developers are swinging towards Agile over RUP (or have been for several years now). And you are right that the design document should propgate backwards - this functionality is actually being built into the more advanced UML tools.

    12. Re:Oh Boy. by WGR · · Score: 2, Interesting
      What is needed with UML is a way to execcute the design it creates. We need a tool that will parse the UML to generate the relationships between modules, show the data flow and transformations, allow one to make a mockup of forms and trace the consequences of the ranges of values allowed. If UML or any other design language is to be useful in the long term, it needs to be linkable directly to code. So every design change should be easily transferable from UML to code and there should never be the need to change code independently of the UML.

      This is difficult at the moment because our programming languages are still too low level. We are enamoured of language constructs that still are at the 1950's level of detail, such as worrying about word length in integers or buffer size for strings. Everybody learns C++ or Java etc. as first languages and from then on feel that they have to program at the level of these languages, only slightly higher than machine code. They force a programmer to break a high level view of the problems into tiny discrete chunks quite unrelated to the actual problem language.

      Good compilers exist for functional languages that produce optimized code as fast as C++. Even modern Fortran has more functional programming abilities than C++. We need to see our data as a whole and program for the streams rather than the bits.

    13. Re:Oh Boy. by rmacapobre · · Score: 1

      > he was utter hell to work with, His designs ultimately foundered when noone but him could extend or maintain them.

      a good programmer is a good team player. if i were to pick one whos brillant but unable to get off his superiority over someone whos average .. ill pick the guy whos average.

    14. Re:Oh Boy. by darkpixel2k · · Score: 1

      I had a friend that would always tell me that.
      But the thing is--I don't want to be promoted.
      I'm sure a lot of people share my thoughts--you don't want to be promoted to 'manager', you just want to let awesome code spew forth.

      --
      There's no place like ::1 (I've completed my transition to IPv6)
    15. Re:Oh Boy. by museumpeace · · Score: 1

      you got that right, I consider him, taken alltogther , as a sorry looser. and he actually got fired by the CEO in a very public fight one afternoon...I loved that moment.

      --
      SLASHDOT: news for people who can't concentrate on work or have no life at all and got tired of yelling back at the TV.
    16. Re:Oh Boy. by museumpeace · · Score: 1

      I still have a few friends that work at the company where this little drama played out so I will have to be coy about names and dates BUT. "...I don't blame this on the programmers however so much as weak or stupid management."
      pretty much nails the root problem. The CEO was a man with a brilliant marketing insight that put the company 4 years ahead even the best funded competition. The tragedy was this CEO was a total babe in the woods about software development and he was bedazzled by this prima donna, who was intially hired as a consultant. We blew the entire four year lead and wound up getting bought and sold twice while most programming effort was expended fixing bugs or adding stuff the "design" had never considered.

      --
      SLASHDOT: news for people who can't concentrate on work or have no life at all and got tired of yelling back at the TV.
    17. Re:Oh Boy. by Cthefuture · · Score: 1

      I'll throw in some pennies on this.

      Though language and architecture are not completely seperable, its a shitty design that can't be expressed in any thing but some particular language...saying UML or flowcharts or whatever gets in your way is just a huge hint that you don't know how to express your idea or you don't really have an idea.

      Some of the best programmers I have even known have this problem and it is a problem I share with them. It's not that I don't want to share my ideas (although I too know many like this), it is just very difficult to translate my thought processes into something concrete. From what I can tell this is very similar to the problems high functioning autistic people have with "the real world." In my case I am extremely intuitive but I have problems communicating my gut feelings into something other people can understand. People too often dismiss my ideas or just don't understand because of my poor ability to communicate. I have tried my hardest to improve but it's damn hard. It's usually several hours after a discussion before I can fully explain my thoughts and accurately respond to other people's concerns. Sometimes I meet someone who is able to understand me and communicate to others much better. I charish these people for what they can do for me and it's more than any UML diagram is going to do.

      There is not much argument about the proclivities of programmers: they don't read other peoples code, not often enough, not with sufficient comprehension, not unless they are paid to maintain it. That is a generalization of course but with way too few exceptions. Comments, as others will surely point out, are more important for the longevity of code than the code itself.

      Good programmers can read code like a book. I would much rather have well written code than comments. I say this as a consultant that does a lot of reading other programmer's code. My brain has almost developed a filter to where I barely see comments any more. You can't trust comments, but you can trust the code. The problems arise when you get poorly written code and is difficult to read and understand. Sometimes comments help but usually the worse the code is, the worse the comments are.

      --
      The ratio of people to cake is too big
    18. Re:Oh Boy. by agbinfo · · Score: 1
      What is needed with UML is a way to execcute the design it creates. We need a tool that will parse the UML to generate the relationships between modules, show the data flow and transformations, allow one to make a mockup of forms and trace the consequences of the ranges of values allowed.
      UML can do some of that but UML is not just class diagrams. It's also sequences, use cases, packaging, and more.

      Even if the tool you mention existed, if you wanted to keep these other auxiliary design documents current, you would still need to do some additional work and pay the price (maintain the documentation as well as the code).

      If you find a resistance needs to be changed in some hardware design, you don't just change the reel in the production plant. You change the BOM, the design documents and anything that might be affected.

      In software, programmers don't feel that this is needed because they're too lazy to do so - they feel that it should be done automatically or that it's somebody else's problem. Managers don't want to force this upon the programmers because they know that they won't be able to justify 2 days of work for changing a single line of code. You get what you pay for.

      The problem with UML is that it's a good tool but it's just a tool and should be treated as such. It's not a programming language. Maybe one day, it will be but until then it should be treated the same way as other tools such as engineering notes, power point presentations, requirements books, test tools (at all levels), prototypes, user documentation, ...

      All these tools have their usefulness. If they can be used to generate some of the code... great. But they are just tools. Even if one day UML can be used as a programming language, it would still need to be used when appropriate just like other programming language. Sometimes you need a hammer, sometimes you need wrench

      Nevertheless, some of these tools' artefacts need to be kept current and some less; Some are throw-aways. The trick is to figure out which is which

      Hint: don't throw away the code.

      Everybody learns C++ or Java etc. as first languages and from then on feel that they have to program at the level of these languages, only slightly higher than machine code.
      We have to program at these levels sometimes and other times we don't. Everytime you use a library, you don't. When testing the return code from a member of that library, you do.

      They force a programmer to break a high level view of the problems into tiny discrete chunks quite unrelated to the actual problem language.
      I don't think that's ever going to change. Personnally, I think that the chunks are getting bigger and better all the time.
    19. Re:Oh Boy. by iwan-nl · · Score: 1

      Poseidon for UML does that.

      --
      I'm trying to improve my English. Please correct me on any spelling/grammar errors in this post.
    20. Re:Oh Boy. by smittyoneeach · · Score: 1

      (gently-with-chainsaw)

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    21. Re:Oh Boy. by smittyoneeach · · Score: 1

      Yeah, baby: yeah.
      Easily the most important link in the whole discussion.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    22. Re:Oh Boy. by GeckoX · · Score: 1

      If there are no design documents in existence, and no spec docs even, then you most certainly are NOT dealing with 'over-engineered' software.

      You are in fact dealing with 'not-at-all-engineered' software.

      Are you able to invoke change in these areas where you now work? Because if not, I strongly suggest bailing asap.

      --
      No Comment.
    23. Re:Oh Boy. by Doctor+Memory · · Score: 1

      Rational's round-trip design theories eventually wound up in their XDE product. I used this on a prototype project, and it worked pretty well. I had used Rose in the past, so I was pretty much prepared to install this, look it over and uninstall, but it's actually pretty usable. You create the diagram, and XDE creates the code at the same time. If you update the code, XDE updates the diagram. We were writing a new system from scratch, so I don't know how well it would work in a reverse-engineering scenario, but it was totally usable (on a dual-proc P4 2GHz box with 1G memory) for us.

      Unfortunately, it didn't play well with word processors, so creating format documentation meant a lot of C&P, which of course would have to be redone when the design changed. Maybe it had something to do with the fact that it was a WSAD (Eclipse) plug-in, but it would have been nice to at least support exporting to some standard file format.

      --
      Just junk food for thought...
  2. I'll Add... by Sexy+Commando · · Score: 4, Insightful

    The code is the comments.

    1. Re:I'll Add... by Inkieminstrel · · Score: 2, Insightful

      In that case the code is misleading.

    2. Re:I'll Add... by agm · · Score: 5, Funny

      Hey, it was hard to write, it should be hard to read!

    3. Re:I'll Add... by Ohrion · · Score: 2, Insightful

      "The code is the comments." This actually only works when both the author as well as the maintainer(s) are good coders. Unfortunately in the real world, this usually isn't the case. I've read some really crap code with GoTos all over the place where the author didn't put comments in, and the names of the procedures were all similar to "DoWork". Therefore I try to promote the use of comments in our work, especially if anything gets complex or uses non-obvious APIs.

    4. Re:I'll Add... by Ann+Coulter · · Score: 2, Interesting
      Add to this the fact that comments are never compiled and you can say that comments can be anything related to the executed instructions besides the instructions themselves. That being said, it is very important to let developers (yourself, coworkers, and future developers) of the code have the ideas you had when you were writing the original code in the first place.

      An extreme extension of your statement would be that the instructions for the machine have less gravity than the instructions for the developers of the program. I myself am of the school of thought that consider machine compiled code to be cheap, and expendable. What I consider to be most important are the ideas that lead to the construction of the machine compiled code.

      These ideas should be very well developed, verified, and validated. Only after that will I begin implementing the ideas into instructions the machine can execute. It is my belief that as the program becomes more useful, it should also be less dependent on the platforms on which it was built for.

      In summary, I believe that a piece of code should always include the original ideas about its purpose, function, requirements, and possibly history somewhere. To add to this, the developer should be able to easily extract this information.

    5. Re:I'll Add... by DunbarTheInept · · Score: 4, Insightful

      That doesn't fix anything because in general I have observed that the same author who would write impossible to understand code will also write impossible to understand comments that actually mislead you more often than they help you. People who are bad at explaining a precise algorithm's details in an elegant form using Java, C, Perl, or Python are also bad at explaining it in an elegant form using English, for the exact same reasons. They're just not good at communicating carefully and clearly in general.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

    6. Re:I'll Add... by chris_mahan · · Score: 3, Interesting

      It's like english. You know, the annotated book because the author really went all out and the reader has no fucking clue:

      Ye whimsical faerie of yore
      Whence came thee upon me?
      Forlorn sit I stilled,
      Prey to thy designs.

      Now, the author wrote about his helplessness at dealing with his past.

      Just because you can't understand what he said does not mean he should not have said it.
      Perhaps it is the skill of the reader that must rise to match that of the author?

      Perhaps it should be rewritten like this:

      Memories from a hidden place make me sad?

      Still too poetic, less descriptive?

      How about: I am saddened by a memory.

      You can make good code go bad by writing for the least common denominator in your organization (always the worst programmers)

      Managers: You can raise code quality by letting go your bad coders. Not because they won't be writing bad code, but because the other coders will be able to write more powerful code.

      --

      "Piter, too, is dead."

    7. Re:I'll Add... by DunbarTheInept · · Score: 4, Interesting

      In general, when I'm using a language with embedded documentation features (like Java's javadoc, or "doc++" that does exactly the same thing for C++ comments), I prefer to write the specs using the embedded doc tool itself (write out the spec for a java class by writing out the methods as do-nothing stub routines and then describe what they will do by prepending a javadoc comment to them - then when you generate your javadocs, you have the spec - and since they render into HTML, you can actually make the specs with a lot of complex formatting and all that, just the way the bosses like it. Thus my spec is also the skeleton of the code to be filled in. This approach works better, I think, because it makes it easier to keep the spec up to date when you discover a problem during the coding phase that requires a spec change.

      Alas, of late I've been dealing with stuff that doesn't have embedded comment docs and so I haven't been able to do that as much.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

    8. Re:I'll Add... by theshowmecanuck · · Score: 1

      Don't ask me why, but I like this page. :-)

      Debug only code - comments can lie.

      --
      -- I ignore anonymous replies to my comments and postings.
    9. Re:I'll Add... by Lew+Payne · · Score: 1

      "The code is the comments."

      Yes -- that's why, if you can, you should write all your comments in C++.

    10. Re:I'll Add... by leonmergen · · Score: 1

      Use DoxyGen!

      It supports multiple languages, so it's a more generic approach to automated software documentation..

      --
      - Leon Mergen
      http://www.solatis.com
    11. Re:I'll Add... by dubl-u · · Score: 1

      People who are bad at explaining a precise algorithm's details in an elegant form using Java, C, Perl, or Python are also bad at explaining it in an elegant form using English, for the exact same reasons. They're just not good at communicating carefully and clearly in general.

      Agreed! The solution to bad programmers putting out confusing structures in code isn't to get them to produce a parallel structure of documentation.

    12. Re:I'll Add... by ShieldW0lf · · Score: 2, Insightful

      If your design is good, the code tells you what it does better than comments.

      Comments shouldn't be telling you what the code is doing, they should tell you why it's doing it.

      --
      -1 Uncomfortable Truth
    13. Re:I'll Add... by Chris+Kamel · · Score: 1

      I have observed that the same author who would write impossible to understand code will also write impossible to understand comments I'd question my own IQ if I were you. What's the poor programmer to do, he wrote the code, and the comments and you still don't understand :p

      --
      The following statement is true
      The preceding statement is false
    14. Re:I'll Add... by old+man+moss · · Score: 2, Insightful
      "writing out the methods as do-nothing stub routines"

      This can be dangerous. I once tracked down a nasty bug to a method which had been left as simply "return 0.0" (by someone else)

      The really sad thing was that there was also a test program for the code... unfortunately it only checked that f(a) + f(b) = f(a + b) ... which it did of course.

      --
      rt
    15. Re:I'll Add... by johnjaydk · · Score: 1
      Agree completely.

      Write a nice long java doc on top that describes the class/method whatever. What goes in, what goues out etc. from an outside poiunt of view.

      Notes on inside details are optional. I find that if you need to comment the details inside your methods then your code is simply not good enough. Use discriptive class/method/member names, polish the algorithm until it obvious. If it still looks like shit then you need to expand your scope and refactor some of the related classes. I consider comments inside methods to be admitting failure. There are times where you end up with code that's deep magic and you have to comment but this should be the exeption not the rule.

      Aside from that I like to have some sort of map of the whole project in order to see the big picture. Autogenerated UML plus some highlevel design considerations (can be captured in a wiki) works for me.

      --
      TCAP-Abort
    16. Re:I'll Add... by hachete · · Score: 1

      *Everything* is dangerous when taken to extremes, or picked out as small incidents. This is why we have code reviews and reviewers. In the company I work for, we have a system where each task in change request is given a coder and an approver. The approvers' job is to inspect the code precisely to pick up problems like this, so when it's done, the approver can tick the box. Of course, if the approver is as slack, then management should exercise their perogative, do some manging and tell the approver where he or she are going wrong.

      Which is why I hate STAR PROGRAMMERS. As pointed out earlier, they can be bastards to work with, and leave behind piles of doggy doo for others to prod at and look on in fear and wonder. Management only see that "wow, finished on record time and so fast as well".

      Tip for budding STAR PROGRAMMERS: checkin as much code and as near to the dead-line as you can, the more the better. NObody in the world will ever dare to challenge you. QA will never challenge it. Mgt should kick back those changes if they had the balls...but, no, he (and it's usually a he) is A STAR PROGRAMMER and they can't be touched.

      SO I guess what I saying is that code quality reflects the quality of management and the tools they put in place to ensure quality. Programmers will do what they want usually.

      h

      --
      Patriotism is a virtue of the vicious
    17. Re:I'll Add... by anvil+{UK} · · Score: 1

      Whilst there often is that correlation, usually IME because they didn't really understand what they were trying to do in the first place, documentation (both comments and the stuff you are supposed to put in docs) is there for more than just helping future coders. It also helps detail what the program is supposed to do and serves as a guide for users and integrators as to the business purpose of the code. comments and docs are good for many reasons.

    18. Re:I'll Add... by DunbarTheInept · · Score: 1


      It also helps detail what the program is supposed to do

      Not when it's written by the same person who can't write good code. Then it just helps detail misinformation about what the program is supposed to do, and makes things harder to figure out.

      The greater the percentage of lines in the source were written by a good programmer, the easier to understand it becomes. So good programmers writing good comments helps. But bad programmers writing bad comments to accompany the bad code is actually worse than bad programmers writing just bad code and leaving the comments untouched, becuase it increases the percentage of misleading stuff in the code.

      --

      Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

  3. boiler plates by BBrown · · Score: 2, Insightful

    sigh. I hope this reads better than the headers and comments I normally struggle through when trying to understand another coder's thoughts.

    1. Re:boiler plates by mccalli · · Score: 3, Insightful
      I hope this reads better than the headers and comments I normally struggle through when trying to understand another coder's thoughts.

      Fair enough, but would that same programmer have produced a decent design anyway? UML, pseudo-code, anything?

      In my opinion if their code is disorganised, their design would be too.

      Cheers,
      Ian

    2. Re:boiler plates by Rei · · Score: 4, Insightful

      Part of the problem with headers and comments is the exact same problem with pseudocode: they're not maintained. If they're wrong, the code program doesn't break. The longer they sit around, the less likely they are to be accurate. That's why self-documenting code is a lot more important. Simple, straightforward functions, long, descriptive variable names and functions, etc. If you have to comment a "section" of a function call with a relatively short but important comment, why not just break that part out into its own function call with a descriptive name similar to the comment that you'd use? It's not like the program will run slower; modern compilers can choose whether to inline functions or not better than programmers can in most cases.

      --
      Clean coal harnesses the awesome power of the word 'clean'.
    3. Re:boiler plates by Shadowlore · · Score: 1

      Part of the problem with headers and comments is the exact same problem with pseudocode: they're not maintained. If they're wrong, the code program doesn't break.
      Largely true but not required to be. Python has a test feature which has you define/code/show the test in the comments. It takes the test from the comments and attempts to execute it. If you've changed the code but not the comments, the test will report failure.

      A small step, perhaps, but a step nonetheless.

      --
      My Suburban burns less gasoline than your Prius.
  4. Less is more by tinrobot · · Score: 1, Funny

    ...unless you're from Redmond, then more is still not enough.

    1. Re:Less is more by YU+Nicks+NE+Way · · Score: 2, Insightful

      Would you like to point at a particular file about which you're going to say that?

    2. Re:Less is more by Anonymous Coward · · Score: 1, Funny

      If you look at some WinCE source it just looks like someone barfed into a voice recognition device.

      Dear EmbeddedJanitor,

      Your quote above on SlashDot is a clear violation of the Nondisclosure Agreement that we required you to sign when we allowed you to look at our source code for WindowsCE.

      Clearly, your accurate description of our coding technology and approach will actively assist others hoping to reverse engineer our code. Your willful disclosure of our trade secrets has materilly damaged our interests.

      We therefore demand that you cease and desist immediatly from any further disclosure of our coding methodology. I assure you that our legal department will soon be filing suit against you, the editors of SlashDot, and the Linux development community (who will clearly use this patented methodology to unfairly improve Linux) to recover substantial monetary damages.

      Have a nive day. :)

      Sir Wm. Gates

  5. Six Laws of the New Software by fembots · · Score: 4, Interesting

    Might be timely to revisit
    Six Laws of the New Software

  6. ideally this would be true by Anonymous Coward · · Score: 2, Insightful

    Given sufficiently high level languages (as appropriate for the app) this would be true.

    While we are at it, the comments are not needed either (there should be a compiler warning for them).

    (not completely joking)

    In practice languages are too low level no matter what you use or have "leaky abstractions" which cause problems.

    1. Re:ideally this would be true by EmbeddedJanitor · · Score: 1
      The wait for a sufficiently high level language is probably as fruitless as hoping for a system which understands "hey computer I'm sure you can figure out what I want, so just do it".

      In the "old days" we had architecture, design and coding. For all the UMLs, extreme programming, etc. we essentially have these.

      --
      Engineering is the art of compromise.
    2. Re:ideally this would be true by nate+nice · · Score: 2, Interesting

      "(there should be a compiler warning for them).

      (not completely joking)"

      I'd go a step further and throw a semantic error if suffeciant comment's were not found before certain constructs. Hell, make them part of the language. Or, at least provide an easier interface for programmers to document their code in a way similar to how many DVD's have the directories commentary attached...

      --
      "If you are a dreamer, a wisher, a liar, A hope-er, a pray-er, a magic bean buyer ..."
    3. Re:ideally this would be true by starfishsystems · · Score: 2, Insightful
      In reality the sequence always goes:
      requirements - design - implementation
      If you subsume the design into the implementation, then someone who goes looking at the implementation will have no way to distinguish between what was a design decision from what should be relatively arbitrary implementation decisions.

      Why is the distinction important? Two reasons, really. One is versatility. You don't want to constrain a design to having just one implementation. It's useful to be able to choose among competing implementations, say for the Java Virtual Machine for example, because implementation tradeoffs tend to have practical, often emergent and unforseen, consequences.

      The other is containment, an aspect of modularity. Since errors, including security vulnerabilities, can be expected to arise during both design and implementation, the most basic way to identify and manage them is to separate them during development. No implementation can make up for bad design, not if it's correct with respect to that design anyway, but at least the effects of a bad implementation can be addressed without breaking the design. But only if the two are clearly separated.

      --
      Parity: What to do when the weekend comes.
    4. Re:ideally this would be true by Rei · · Score: 1

      Yeah... for example, variable declarations like:

      map > > > x;

      Or function calls like:

      void do_work()

      --
      Clean coal harnesses the awesome power of the word 'clean'.
    5. Re:ideally this would be true by Rei · · Score: 1

      Grr... silly html parser ate my post ;) That first declaration was supposed to be:

      map< u_int32_t, map< string, pair< double, vector< SomeObject > > > > x;

      --
      Clean coal harnesses the awesome power of the word 'clean'.
    6. Re:ideally this would be true by starfishsystems · · Score: 1
      If you subsume the design into the implementation, then someone who goes looking at the implementation will have no way to distinguish between what was a design decision from what should be relatively arbitrary implementation decisions.

      I should acknowledge that you could subsume the implementation into the design, if only you had some perfect means of generating code directly from design. That's what the original post was suggesting.

      You'll still end up with an implementation separated from the design by whatever mechanism was used to generate it. Implementation errors would then be evidence of a problem with the mechanism. How you would know that is a bit of an open question.

      At any rate, if you could express the design in a completely formal way, such a mechanism would in principle be sufficient. And that raises the question of how valuable comments would be in the design document. If they were meaningful to the design, they would have to take the form of assertions in design language. If not meaningful in a design sense, they would have to refer purely to externalities.

      --
      Parity: What to do when the weekend comes.
    7. Re:ideally this would be true by russellh · · Score: 1
      The author answers you directly. You are confusing the design process with the design product. The author says:

      I am not arguing that we should not "do design." However you want to approach the process, I simply insist that you have not completed the process until you have written and tested the code.

      Furthermore:

      Some of my colleagues have interpreted my harangues on this subject as "Jack says forget design and just start coding". Nothing could be further from the truth (though I see how they get that impression). I am not against traditional software design. We desperately need good design at all levels. It doesn't matter whether we call the early process top level design, structural design, module design, or whatever. What I have been arguing for are two changes in perception. First, that we recognize that the results of the early design steps are not a complete software design any more than the first rough sketches are a complete bridge design. Second, that we capture our design thinking using a notation that is a true skeleton software design. That means using a programming language.

      The idea that a design isn't finished until the system (as implemented) has been tested and shown to work is helpful, in my opinion. After all, fundamental design problems can show up at any point.

      --
      must... stay... awake...
    8. Re:ideally this would be true by MerlinTheWizard · · Score: 1

      Haven't you considered the possibility that you are the leaky one?

    9. Re:ideally this would be true by TheLink · · Score: 1

      For slashdot: use Extrans if you want text.

      plain old text is not text. It interprets some HTML - like links.

      --
    10. Re:ideally this would be true by starfishsystems · · Score: 1
      The idea that a design isn't finished until the system (as implemented) has been tested and shown to work is helpful, in my opinion. After all, fundamental design problems can show up at any point.

      I absolutely agree.

      My comments were in response to a posting entitled "ideally this would be true" which in turn was a comment on the choice of title for the Slashdot article "The Code is the Design".

      I take it that you find the Shashdot title misleading, to which, again, I can only agree.

      --
      Parity: What to do when the weekend comes.
    11. Re:ideally this would be true by dubl-u · · Score: 1

      I'd go a step further and throw a semantic error if suffeciant comment's were not found before certain constructs. Hell, make them part of the language.

      Please don't make me kill you.

      One of my least favorite things to do when taking on a new code base is to spend hours and hours deleting all the useless comments: the obsolete ones, the redundant ones, the misleading ones, the ones that are completely obvious, and the many, many comments automatically inserted by an IDE.

      And people already do this even when the language doesn't require any comments at all. Of the last three code bases I've picked up, about 90% of the comments were worse than useless. I can't imagine what the ratio would be like if a fussbudget compiler required you to put in "// asdf asdf asdf" before every new method and every block.

    12. Re:ideally this would be true by dubl-u · · Score: 1

      If you subsume the design into the implementation, then someone who goes looking at the implementation will have no way to distinguish between what was a design decision from what should be relatively arbitrary implementation decisions.

      Well, that's only if one doesn't write tests and writes muddy code. If I want to know what a bit of code is supposed to do, I look at the method name, the class name, variable names, and the unit tests for the class. If those are good, then I don't need a spec. And if those are bad, generally the spec is useless anyhow.

      But if I'd have to pick just one thing to be right, it would be the unit tests. Everything else, I have to check by hand. But the computer can check the unit tests for me.

    13. Re:ideally this would be true by Samrobb · · Score: 1
      I'd go a step further and throw a semantic error if suffeciant comment's were not found before certain constructs.

      Then you'd get comments like...

      /*
      * I needed to put a comment here to satisfy
      * the stupid lameness filter. Next time, maybe
      * I'll just copy and paste a comment off of
      * slashdot instead of typing my fingers to the
      * bone to satisfy the stupid comment length
      * validator. Grr, still not enough text. So,
      * Four score and seven years ago our forefathers
      * brought forth a nation... that should do it,
      * I think. Maybe. Almost there...
      */

      --
      "Great men are not always wise: neither do the aged understand judgement." Job 32:9
    14. Re:ideally this would be true by russellh · · Score: 1

      wow, agreement on slashdot! I should start reading the parents of comments to which I reply, I guess!

      --
      must... stay... awake...
  7. What a lousy magazine by Anonymous Coward · · Score: 5, Funny

    developer.* Magazine has republished this groundbreaking essay, plus two previously unpublished essays, under the title Code as Design: Three Essays by Jack W. Reeves."

    I'm supposed to be impressed by this? Ten years to republish an article? What a rag. Why, here on Slashdot, you barely have to wait te--

    [sound of post getting modded into oblivion]

    1. Re:What a lousy magazine by Perky_Goth · · Score: 1

      modded down why? everyone agrees that a random algorithim would pick better articles...

  8. Regardless of whether this guy is right or not by Anonymous Coward · · Score: 2, Insightful

    Is his thesis useful, actionable in a way that is substantially different than what people were/are doing already?

    1. Re:Regardless of whether this guy is right or not by Twisted64 · · Score: 1

      I had my suspicions... and they're right. Actionable is not the word you're looking for, although it may sound nice to someone, who, say, has been working in the HR department too long. Please, please, don't make slashdot any harder to read than it already is.

      --
      Consciousness is a myth. Trust me.
  9. False Economy by Doc+Ruby · · Score: 5, Insightful

    It's cheaper and simpler for the initial programmer. After that, we have to spend time (and therefore money) decoding the original code, recognizing idiosyncracies, and retrofitting to work with other code. Even if it's the same programmer, a couple of years later. C++ is more "self documenting" than most languages, when coded properly. And it certainly seemed like the remedy to C, back in 1992 when that screed was written, and C++ was just beginning to be adopted by mainstream programmers. But there's no substitute for writing the requirements, feature definitions, scopes and dependencies first, then the comments in the code blocks, then the code, and tar'ing those docs with the source code. The initial hump is steeper, but the total area under the work curve, over the product lifecycle, is much less.

    --

    --
    make install -not war

    1. Re:False Economy by nagora · · Score: 5, Insightful
      C++ is more "self documenting" than most languages, when coded properly.

      That's what they all say. Every language is self documenting when "coded properly". C++ failed in part because of the unfounded belief that its supporters had in its abilities, all of which resided not in the language itself but in the programmer's ability to "code properly". Sadly, there is nothing in the language to enforce such coding practice and it is as rare in C++ as any language.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    2. Re:False Economy by AuMatar · · Score: 1

      And probably impossible to do anyway. Things like good variable and function names would take an AI capable of passing a turing test to check.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    3. Re:False Economy by Doc+Ruby · · Score: 1

      Actually, of the dozens of languages I know, going back to vintage 1977 BASIC, and extending from 6502 assembly through VB to JavaScript, C++ *is* the most self documenting. Lots of patterns are codified in its structure. Lots of structures among its code are explicit in its operators. There's a big difference between proper encapsulation and fake OOD - which is immediately apparent. C++ is *more* self documenting, but not enough. Hence the entire thrust of my post. FWIW, I might someday be satisfied with a self-documenting language when compilable flowcharts, with use/case animations integrated with a debugger, are the norm.

      --

      --
      make install -not war

    4. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      C++ failed in part because of the unfounded belief that its supporters had in its abilities

      I must have missed the memo that C++ had "failed". I'd call being one of the most popular languages around, still a major part of the software industry some two decades after its introduction, one of the bigger success stories in software development history.

      As for belief in its abilities: the problem C++ has is more PR than anything else. A lot of people learned it ten years ago, or were taught by or learned from books written by someone who did, and as a result there is a wider difference between "expert practice" and "common practice" than in just about any other programming language in at least moderately common use today. C++ was designed as a tool for serious programmers -- those who are going to understand and follow best practices, and who are going to take steps to avoid shooting themselves in the foot. For these people, it is an exceptionally good practical tool.

      The fact that it has also been adopted by mainstream application developers -- a market it never sought, nor was designed to cater to -- isn't really C++'s problem. Sooner or later (but, sadly, probably later) a much better general application development language will come along and most people will migrate, leaving C++ to the systems programming, high performance maths, etc. that it's best at, in the hands of programmers who will make good use of it.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    5. Re:False Economy by nagora · · Score: 1
      A) C++ failed? When?

      Err, as soon as it came out? It has not really revolutionised even C programmers, let alone the world of programming generally, has it?

      B) No worthwhile language will stop you from writing crap code, because it will also stop you from writing anything useful.

      Possibly true.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    6. Re:False Economy by nagora · · Score: 2, Interesting
      I must have missed the memo that C++ had "failed".

      In the sense that it made no real difference. The programming world today is largely the way it is because of C, not C++. If C++ had never happened, but C, Smalltalk and Simula etc. still had happened, then I don't think there would be any noticable difference in modern programming style or technique, not even much difference in syntax. I think, anyway.

      Obviously, C++ programmers might not agree!

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    7. Re:False Economy by Viking+Coder · · Score: 4, Insightful

      I can't read someone else's architectural design. I have no idea how the problem domain works. I have no idea what kinds of generalizations and concepts were used to break the problem down. I have no idea which facets of the problem were important, and which could be ignored. I don't know anything about the material sciences involved. What I don't know could just about fill the Grand Canyon.

      Why do you presume that reading a software design (source code) would be any different?

      It's hard to read a design - even a good one - until you "get it." Until you grok it. Those other documents you talk about are freaksihly important, and the author doesn't deny that - but they are not the design. They are of fundamental importance to the success of the design, but we shouldn't pretend that they are the design.

      You're absolutely right to refer to those things as "documents." They help document. But they are not the design.

      He's not saying skip design, he's saying that you do what you have to, in order to think the problem through (some design, some documentation, some testing, etc.), and then you work on the real, actual design (the source code.)

      Refering to "the initial programmer" like you do is completely ignoring everything he's saying.

      --
      Education is the silver bullet.
    8. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      Obviously, C++ programmers might not agree!

      Nor, I imagine, would Java programmers, C# programmers, ...

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    9. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      [C++] has not really revolutionised even C programmers, let alone the world of programming generally, has it?

      Given that it's likely most of the software that most of the people reading your comment use today is written in C++, I can only assume that you're trolling?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    10. Re:False Economy by aled · · Score: 1

      obligatory request: can you provide examples? because I can see no self documenting features in C++.

      --

      "I think this line is mostly filler"
    11. Re:False Economy by Screaming+Lunatic · · Score: 1
      C++ failed in part because of the unfounded belief that its supporters had in its abilities..

      C++ failed? Hmm, the last time I checked one of the two OSs that I use on a regular basis is written in C++. And the web browser, email client, instant messenger, IDE, PDF viewer, source control software, mp3 player, and word processor that I have opened right at this moment is written in C++.

      Mod parent conveniently making up bullshit or funny definition of failure.

    12. Re:False Economy by simcop2387 · · Score: 2, Funny

      yea i got that working last week, then my boss made me have it look at its own source code. the thing hasn't been sane since.

    13. Re:False Economy by Doc+Ruby · · Score: 1

      The source code isn't the design - that's the whole point. The specs, the flowcharts, the use case docs that state the issues, the problems, the solutions. In language presented to a person with competence in the human language (eg. English), and enough competence in the domain jargon to use a glossary, if necessary. The source code is too idiosyncratic to be design that's usable later - especially because procedural languages are based on inventing new vocabularies (function and variable names) for every application, even if inheriting old vocabularies from prior projects. And those vocabularies are so rigid as to introduce extra lexical complexity, more suited to computers than to humans, for development and execution performance. Jumping in and coding prematurely, even coding well, is always a recipe for unmaintainability.

      Those reasons I cite are not theoretical. They're just a description of decades of my personal experience, consistent with the experience of all the hundreds of programmers on dozens of teams I've worked with. I'm not "ignoring" his statements. I'm just strongly disagreeing, though I understand that my hindsight is superior to his relatively (1992) inexperienced enthusiasm.

      --

      --
      make install -not war

    14. Re:False Economy by Doc+Ruby · · Score: 1

      C++ is supposed to be opaque. The fundamental design principle is hidden code, and exposed APIs. The problem with C++, as I pointed out, is that most people don't document the APIs adequately. They usually document them in terms of the inner source code, or some immediate application beyond which scope the classes are intractable. Or they produce APIs so tightly integrated with other classes in the app that they can be reused only in another app with exactly the same complementary APIs. No amount of design can compensate for low quality of design.

      --

      --
      make install -not war

    15. Re:False Economy by oliverthered · · Score: 1

      Well there's the easy test....

      if(strlen(variable_name) 3)

      and the dictionary attack..

      if you adopt a standard you can check for class names being cased properly, instances being given the correct instance name, defines being properly cased etc...

      You can also check for: indentation, comment density (and verbosity) code complexity, returns used in mid function lots of nesting etc..

      and compile with -wError.

      A few simple tests and it would take the 'bad' programmer longer to work around them then to use proper names.

      Or, you could always use code review or paired programming.

      --
      thank God the internet isn't a human right.
    16. Re:False Economy by Doc+Ruby · · Score: 1

      No, because I'm not going to spend the time digging and comparing - I'm not currently coding anything in C++, certainly nothing that I've also got coded in C, or Perl, or Ruby or whatever. You're asking for a task equivalent to a BSCS midterm, and all I'd get would be the satisfaction of convincing a few Slashdotters - maybe (though probably not, on experience).

      But the self documenting features of C++ are well known. Public members, class inheritance, object encapsulation - all those required techniques explain how to use the code, how the code models the system being automated. Like any literature, it requires literacy. But the same degree of C++ literacy offers much more reliable documentation than in any other language with which I'm familiar.

      --

      --
      make install -not war

    17. Re:False Economy by iabervon · · Score: 3, Interesting

      But there's no substitute for writing the requirements, feature definitions, scopes and dependencies first, then the comments in the code blocks, then the code, and tar'ing those docs with the source code.

      Those are the worst. You have the source, which seems to almost work. Then you've got the comments in the code, which are sort of relevant, but whenever the code gets sufficiently tricky that you'd have to read any of the comments, they're simply wrong. Then there are all the dependencies, which are incomplete and only include the obvious connections and not the ones which were added later. Finally, there are the requirements, which not only don't describe the actual program, but are simply impossible.

      The best projects are ones where there's a bunch of code, which is written with names that suggest what things actually are and do, where everything is broken down into chunks which are sufficiently small to understand if you look at them, which has gotten arranged so that everything flows in accordance with the underlying problem being solved, and which is grouped logically, with related functions near each other within a file, in files, and in directories; and there is additional documentation, revised after the last change to anything it documents, which explains everything that isn't obvious from reading the code, as well as explaining where in the code to start reading.

      The sole reason that code is the best documentation is that it is never incorrect. The program will definitely do what its source says it will. All other documentation must be held to the same standard, even though there is no automatic check for it. (One advantage of javadoc-style tools is that there are some automatic checks for accuracy; you can't have javadoc which gives the wrong name for a function). The worst thing is documentation which pretends to be authoritative, but which is out of date, and any document which predates the code is going to be out of date, unless the project is so trivial that someone with no experience could do it on the first try-- because that is what the original design documents are: the first try by people who do not yet have experience.

      Personally, I think the best balance might be to start writing code with minimal planning (come up with the idea, divide the tasks, decree the coding style, arrange the process for adding tasks), but to have bitter and anal code reviews of everything that goes in. This requires the programmers to demonstrate that the code is clear enough to read and that the result including all additional documents is accurate and sufficient for someone who didn't write it to understand it based exclusively on the design.

    18. Re:False Economy by AuMatar · · Score: 2, Insightful

      The length is a poor idea. What if I'm doing GUI work- X and Y refering to cartesian coordinates make great sense. Len as a length for something does as well. It isn't as uncommon a case as you'd think at first.

      Dictionary attack- how many devs do you know who use the full name rather than an abbreviation? I can't blame them- ppm makes sense and is much easier than parts_per_million. You also have to get devs who can spell (I went through a 6 kloc assembly program misspelling the work caffeine. This word was probably used on about 300 of those lines. Never once had a compiler error, I misspelled it the same way every time- put the i before e. Didn't realise it til I handed it in and the TA pointed it out).

      Indentation- changing it once its in is a bad idea, it can hurt CMS systems. I don't mean simple ones like CVS, I mean higher level abilities like out of order removal of changes.

      Comment density- is too dense bad, or good? Probably in between, and probably depends on subject matter. I don't want a paragraph on a get function, but complex image quality algorithms deserve them. I won't get the linear algebra its doing without them.

      code complexity- I think we need a turing machine again

      Lots of nesting/mid function returns: mid function returns are good, its what stops your code from looking like spaghetti to avoid them (avoiding them usually turns into your other dislike here- increased nesting). Lots of nesting- some things need a lot of nesting (or incredibly complex if statements, which may be worse). Telling when is an exception requires a Turing AI again.

      Its a basic problem with computers- they can't judge when a rule should be followed and when not. You end up either spending a large amount of time doing pointless things to get the system to like it (a pain in the ass and leads to ugly code and unhappy coders), you get 10 billion warnings from the compiler (leading to real problems getting lost in the noise), or you get rid of the system.

      Basicly- stick to the code reviews. Your fellow devs are AIs capable of passing a Turing test. If they can't you have problems in the first place :)

      --
      I still have more fans than freaks. WTF is wrong with you people?
    19. Re:False Economy by Doc+Ruby · · Score: 1

      Code is never incorrect? Your own example is code that "almost works". Code is always incorrect, until it's correct, and then you're done. The documentation and source should of course be updated against each other. But the docs should be used to guide the development. Any dev process can, and will, be abused. But even just the extra formalism of documenting the design requires that design be done before coding, in terms of the actual problem being solved. Which is a discipline that focuses the problemsolving.

      --

      --
      make install -not war

    20. Re:False Economy by Javagator · · Score: 2, Insightful

      I would not call C++ exceptionally self documenting, but well written C++ can be very elegant. There is a chapter in Meyers Effective C++ titled, "Say what you mean and mean what you say." My copy is at work, but he mentions that the use of const, virtual functions, abstract functions, and other constructs can reflect design decisions. Also, the proper use of constructors and destructors can ensure that objects are always initialized properly, that an object stays valid over its life time, and releases its resources when it goes out of scope. Proper (as opposed to wild and "creative") uses of operator overloading and copy constructors can produce elegant easy to read and understand code.

    21. Re:False Economy by oliverthered · · Score: 1

      What if I'm doing GUI work- X and Y refering to cartesian coordinates make great sense.

      Don't the x and y's belong to something, like screenx, imagex etc.. can't you use counter instead of i?

      Dictionary attack- how many devs do you know who use the full name rather than an abbreviation?

      The kind of devs who use screenx, imagex and counter. You can put commong abbreviations in the dictionary and for the rest why not use a codeCompleting Editor and type in the extra couple of chareters.

      Indentation- changing it once its in is a bad idea
      The idea isn't 'style', I don't mind if you use two tabs and three spaces, it's bad indentation ~= messy code that hasn't been looked over.

      Comment density- is too dense bad, or good? Probably in between, and probably depends on subject matter. I don't want a paragraph on a get function, but complex image quality algorithms deserve them. I won't get the linear algebra its doing without them.

      code complexity- I think we need a turing machine again


      Part and parcil, there are lot's of matricies for code complexity and automatic checking tools that look for, how deep do you nest, loops, gotos, calls, variables used the kind of stuff any compiler looks at, (function point analysis works loosly on code complexity on a larger scale.)

      mid function returns are good, its what stops your code from looking like spaghetti to avoid them
      bollox, write good code, refactor, maybe two functions is a thousand need mid function returns, an I can cope with my checker giving me a few false positives, no Turing AI just a human to flag the functions once.

      You can probably use some simple calcualtaions to work out if the nesting is good or bad based on the flow of execution and functional complexity.
      I'll post an example as a code reply.

      code reviews are good, cvs checkin rules can be good too.

      --
      thank God the internet isn't a human right.
    22. Re:False Economy by oliverthered · · Score: 1

      As a example this is some code I'm just about to send in as a patch... well the 1st version.
      res is wine standard.

      riid and iface are windows standard, I would have at least used result normally.

      Spot the bad return in the second example

      /*** Version 1 ***/

      /* IDirect3DSurface9 Interface follow: */
      HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFA CE9 iface, REFIID riid, void** ppContainer) {
      IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
      HRESULT res;
      TRACE("(%p) Relay\n", This);

      /* The container returned from IWineD3DSurface_GetContainer is either a IWineD3DDevice,
      one of the subclasses of resource or a swapchain */
      IUnknown *IWineContainer = NULL;

      /* Get the IUnknown container. */
      res = IWineD3DSurface_GetContainer(This->wineD3DSurface, &IID_IUnknown, (void **)&IWineContainer);
      if (res == D3D_OK && IWineContainer != NULL) {

      /* Now find out what kind of container it is (so that we can get it's parent)*/
      IUnknown *IUnknownParent = NULL;
      IUnknown *myContainer = NULL;
      if(D3D_OK == IUnknown_QueryInterface(IWineContainer, &IID_IWineD3DDevice, (void **)&myContainer)){
      IWineD3DDevice_GetParent((IWineD3DDevice *)IWineContainer, &IUnknownParent);
      IUnknown_Release(myContainer);
      } else
      if(D3D_OK == IUnknown_QueryInterface(IWineContainer, &IID_IWineD3DBaseTexture, (void **)&myContainer)){
      IWineD3DBaseTexture_GetParent((IWineD3DBaseTexture *)IWineContainer, &IUnknownParent);
      IUnknown_Release(myContainer);
      } else
      if(D3D_OK == IUnknown_QueryInterface(IWineContainer, &IID_IWineD3DSwapChain, (void **)&myContainer)){
      IWineD3DBaseTexture_GetParent((IWineD3DBaseTexture *)IWineContainer, &IUnknownParent);
      IUnknown_Release(myContainer);
      }else{
      FIXME("Container is of unknown interface\n");
      }
      /* Tidy up.. */
      IUnknown_Release((IWineD3DDevice *)IWineContainer);

      /* Now, query the interface of the parent for the riid */
      if(IUnknownParent != NULL){
      res = IUnknown_QueryInterface(IUnknownParent, riid, ppContainer);

      /* Tidy up.. */
      IUnknown_Release(IUnknownParent);
      }

      }

      TRACE("(%p) : returning %p\n", This, *ppContainer);
      return res;
      }

      /*** Version 2 ***/

      /* IDirect3DSurface9 Interface follow: */
      HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFA CE9 iface, REFIID riid, void** ppContainer) {
      IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
      TRACE("(%p) Relay\n", This);

      /* The container returned from IWineD3DSurface_GetContainer is either a IWineD3DDevice,
      one of the subclasses of resource or a swapchain */
      IUnknown *IWineContainer = NULL;

      /* Get the IUnknown container. */
      if(IWineD3DSurface_GetContainer(This->wineD3DSurfa ce, &IID_IUnknown, (void **)&IWineContainer) != D3D_OK){
      return;
      } else
      {
      if(IWineContainer != NULL) {

      /* Now find out what kind of container it is (so that we can get it's parent)*/
      IUnknown *IUnknownParent = NULL;

      if(D3D_OK == IUnknown_QueryInterface(IWineContainer, &IID_IWineD3DDevice, (void **)&myContainer)){
      IWineD3DDevice_GetParent((IWineD3DDevice *)IWineContainer, &IUnknownParent);
      IUnknown_Release(myContainer);
      if(IUnknownParent != NULL){
      res = IUnknown_QueryInterface(IUnknownParent, riid, ppContainer);
      /* Tidy up.. */
      IUnknown_Release(IUnknownParent);

      --
      thank God the internet isn't a human right.
    23. Re:False Economy by dubl-u · · Score: 2, Informative

      But there's no substitute for writing the requirements, feature definitions, scopes and dependencies first, then the comments in the code blocks, then the code, and tar'ing those docs with the source code. The initial hump is steeper, but the total area under the work curve, over the product lifecycle, is much less.

      I'd agree that if you're doing waterfall, doing design docs is better than not doing design docs. But I disagree that there's no subsitute.

      Having done a few Extreme Programming projects, I much prefer that. Between continuous design, unit testing, acceptance testing, refactoring, and pair programming, I think you get much better code for less money. On a recent project, for example, a 36 developer-month effort released in October and has had a total of two bugs in production and zero downtime.

      And the code is in great shape. If a potential investor wanted to send in their technical team for a review, I'd have no fear. Heck, I'm more confident than that: if another team were taking over the code base, I'd happily give them my cell phone number.

    24. Re:False Economy by dcam · · Score: 1

      I counldn't agree more.

      One thing that frustrates me in the move from C++ to C# is the lack header files. A well written header file is largely all the documentation you need for a class.

      --
      meh
    25. Re:False Economy by Doc+Ruby · · Score: 1

      Don't think so much, Anonymous flaky Coward. Just keep scratching.

      --

      --
      make install -not war

    26. Re:False Economy by nagora · · Score: 1
      Given that it's likely most of the software that most of the people reading your comment use today is written in C++, I can only assume that you're trolling?

      No. I use Gentoo and I don't see a lot of C++ go past during updates and the programs that do use it are not particularly "self documented". As to the earlier point, Java and C# would have appeared in some form regardless of C++. They owe much more to the failure of Smalltalk to take off than they do to the supposed success of C++, while their syntax comes from C, just like the vast majority of C++'s does. Java certainly would have happened as long as no popular language had a garbage collector, which is a basic requirement of an Object Oriented system.

      Does this really matter?

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    27. Re:False Economy by brpr · · Score: 1

      Public members, class inheritance, object encapsulation - all those required techniques explain how to use the code, how the code models the system being automated.

      If you think that C++ is the only language with those features, you can't know many languages. (But then, if you like C++ at all, you can't know many languages ;)).

      The OO features of a language are only self-documenting if the problem can be described in OO terms. If it can't, then all the class definitions just obscure what the program actually does.

      And yes I know that C++ is a supposedly a multi-paradigm language, but most of the interesting things you can do with templates (e.g. simulating closures) rely on classes.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    28. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      Don't the x and y's belong to something, like screenx, imagex etc.. can't you use counter instead of i?

      You are unwise to generalise so readily. Suppose I'm writing a simple function to multiply two matrices. Do really think it's going to make clearer code if I called the matrices matrixA and matrixB and index them with variables like counter? What's wrong with the programmer-idiomatic and mathematically familiar notation, such as the following?

      M[i][j] += A[i][k] * B[k][j];

      Would you rather I wrote this statement as shown below?

      productMatrix[productRow][productColumn] = matrixA[productRow][counter] * matrixB[counter][productColumn];

      Is that really an improvement?

      mid function returns are good, its what stops your code from looking like spaghetti to avoid them
      bollox, write good code, refactor, maybe two functions is a thousand need mid function returns, an I can cope with my checker giving me a few false positives, no Turing AI just a human to flag the functions once.

      Again, you are unwise to generalise too readily. I work with mathematical algorithms every day that use literally dozens of tests within an otherwise quite simple function. If we followed your standards -- no early returns (or exceptions or breaking out of loops, presumably?) and refactor inner logic out into separate functions -- we would lose all the clarity we currently have (you can see the whole algorithm in one function of a reasonable length) and replace it with lots of small functions containing logic that makes no sense out of context anyway.

      Having done that, we would have gained no meaningful abstraction and no increase in reuse. However, we would have lost a lot of readability, and in scattering the algorithm over a wide area we would have crippled maintainability.

      Is this really an advantage? I think not. No-one who's worked with complex decision-making code of this complexity has ever questioned the approach, and pretty much all the code of this nature that I've seen is written the same way. Often I find the kind of people who think quicksort is a complicated algorithm don't really understand this, and sadly, this includes people who profess to be experts in software development, programming language design, etc. etc. Fortunately for those of us who write this stuff for a living, we aren't constrained by the coding standards of the ill-informed.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    29. Re:False Economy by oliverthered · · Score: 1

      <b>Would you rather I wrote this statement as shown below?</b>
      productMatrix[productRow][productColum n] = matrixA[productRow][counter] * matrixB[counter][productColumn];</b>

      yes, i = srqt(-1) are you using imaginary numbers for your matrix elements.

      <b>Again, you are unwise to generalise too readily</b>
      ' I can cope with my checker giving me a few false positives'
      I didn't.
      ' Often I find the kind of people who think quicksort is a complicated algorithm don't really understand this, and sadly,'

      Quick sort is an easy algorithm, it's just a binary merge with an odd name, any programmer should be able to derive it using first principals. Unfortunately many programmers are overwhelmed with what they are programming and don't know enough to write good code. They often make statements like, but I need that return their or it's much clearer that way.

      I spend some of my time picking though compiler generated assembler that does all kinds of things, and you rarely see an early return.

      <b>Having done that, we would have gained no meaningful abstraction and no increase in reuse. However, we would have lost a lot of readability, and in scattering the algorithm over a wide area we would have crippled maintainability.</b>
      How wide?

      Anyhow, I expect you are writing something like (obviously with a few more levels)

      dosomething(a,b,c,d){
      if d = 0 return NAN;
      e = b * c / d;
      if e - d = 0 return NAN
      return a / (e - d);
      }

      which could be

      dosomething(a,b,c,timeoffset){
      result = NAN;
      if(timeoffset != 0 ){
      timetaken = b * c / timeoffset;
      if(distance - timeoffset != 0 )
      result = a / (timetaken - timeoffset);
      }

      return result
      }

      Now, why would anyone use my slightly more complicated version?
      well..

      For a start I can do this very easily.

      dosomething(a,b,c,timeoffset){
      result = NAN;
      if(time != 0 ){
      timetaken = b * c / timeoffset;
      if(timetaken - time != 0 )
      result = a / (timetaken - timeoffset);
      }
      print("inputs(a = %f, b = %f, c = %f, timeoffset = %f, returning\n", a, b, c, timeoffset, result);
      return result
      }

      n.b. I have only used a, b , c because I couldn't be bothered to think of proper names.

      --
      thank God the internet isn't a human right.
    30. Re:False Economy by nagora · · Score: 1
      C++ brought object oriented programming to the mainstream.

      Since C++ doesn't do object oriented progamming, that's hard to beleive. Do you perhaps mean that it brought enough of the semblance of OOP to the mainstream to hold back the development of proper OOP systems by at least a decade?

      C++ brought exception handling to the mainstream.

      Nope, not with you on that one. Exception handling was being done for years. Did you perhaps think that programs just crashed when they hit an error in data?

      More recently, C++ brought generic programming to the mainstream.

      Again, that's not really true. Generic programming helps you get around some of the shortcomings in C++, but it was no big deal to people used to real OOP, who by and large have better ways to do the same stuff.

      What would it take for you to not consider C++ a failure?

      To see adverts for it in the job market. To find it hard to work as a professional programmer without using it. To be told by clients and employers that they require C++ skills. These things haven't happened in the last five years and they were never common. C, Java, Perl, VB are all much more successful than C++, which was and always will be an ugly hack.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    31. Re:False Economy by mOdQuArK! · · Score: 1
      To see adverts for it in the job market. To find it hard to work as a professional programmer without using it.

      Eh? You must've been looking for different types of jobs than I was - there was an entire decade where every listing I ever looked at always required knowledge of C++ (I've usually gotten jobs in system-tools development & CAD tools). And now, when I ask recruiters why they aren't asking for C++, they usually say something like "we assume every competent developer knows basic C++".

    32. Re:False Economy by Doc+Ruby · · Score: 1

      No, I know several dozen languages (and idiomatic variants on several of those) that I've used over the past 30 years, sometimes 3-5 in one day. And I've yet to see a solution that can be automated that can't be appropriately described as objects. Of course C++ isn't the only OOP, or even the grandmama of them all. But it's the most explicit that I know of, which has the effect of producing documentation. Java is close, but C++ header files are better documentation than Interface defs. Of course, all these quality comparisons are normalized to the same competence in each language, and C++ competence is harder to get than Java competence.

      --

      --
      make install -not war

    33. Re:False Economy by brpr · · Score: 1

      And I've yet to see a solution that can be automated that can't be appropriately described as objects.

      Of course any algorithm can be described using objects, but to suggest that any algorithm can be described appropriately using objects is simply absurd. If you've had so much coding experience, you must be aware (for example) that many algorithms are far more simply stated in functional languages. Sometimes, even straightforward procedural code is best.

      Part of the confusion over this is that it's entirely possible to use objects only as a means of modularising code, without actually using the interesting features of OO languages to any great effect. Of course, it's true that any algorithm can be usefully modularised, but definitely not true that there are always gains to using OO as the means to this end.

      Of course C++ isn't the only OOP, or even the grandmama of them all. But it's the most explicit that I know of

      So like I said you don't know of many. What about Eiffel, for example?

      Java is close, but C++ header files are better documentation than Interface defs.

      Header files are a hack in C, and a nightmare in C++ (mainly due to their effects on compile times, but also because of the duplication between headers and non-headers). If you want a cut down version of the code to use as documentation, you should use an automatic tool (e.g. javadoc, which produces documentation far superior to C++ headers) rather than painstakingly copying every method between .cpp and .hpp files.

      And of course C++ headers are majorly, majorly broken when it comes to template classes.

      Perhaps you are just hopelessly confused because you know several million languages and use them all in the same day, or whatever.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    34. Re:False Economy by Doc+Ruby · · Score: 1

      Maybe you're just a jerk with a language fetish. I'm not going to run down the long list of diverse languages I know, because your insults haven't inspired me to work that hard to enlighten you. No, I don't know Eiffel, because I don't just experiment with Canadian engineering students. Instead, every algorithm I use, no matter how simple or monadic, has to work with other software. Both concurrently, and in reuse at some indeterminate time, maintained by some indeterminate programmer. So encapsulating it in a class, and coding it in C, delivers everything we need from the code.

      *I* am quite clear in my perpective on languages, and the roles they most appropriately play in the kinds of development I've mastered over 30 years, across several major computer revolutions. In my posts I have stated that C++ is the most self documenting language I know of, not that C++ is "the best" language. And I've also pointed out that I use several languages combined in some projects - when they're each appropriate to their role. So it is *you* who is confused, jumping to obnoxious conclusions defined by your own prejudices. And with the attitude you spew in your posts, discussion of such a topic is hopeless. Good luck on your own - you haven't even gotten down the English language, because you just coredumped in it.

      --

      --
      make install -not war

    35. Re:False Economy by brpr · · Score: 1

      I'm not going to run down the long list of diverse languages I know, because your insults haven't inspired me to work that hard to enlighten you.

      So you can't even be bothered to Google for the names of a dozen programming languages.

      No, I don't know Eiffel, because I don't just experiment with Canadian engineering students.

      If you don't know Eiffel, consider the possibility that it might be more self-documenting than C++.

      Instead, every algorithm I use, no matter how simple or monadic, has to work with other software. Both concurrently, and in reuse at some indeterminate time, maintained by some indeterminate programmer. So encapsulating it in a class, and coding it in C, delivers everything we need from the code.

      That's nice, but 1) you can encapsulate stuff in a class in lots of languages, and 2) this has nothing to do with self-documentation.

      In my posts I have stated that C++ is the most self documenting language I know of, not that C++ is "the best" language.

      And I have stated that you don't appear to know many languages. Your childish comments about Eiffel would appear to support this conclusion.

      Apologies for the attitude, but however obnoxious I am, the fact remains that you're talking rubbish.

      --
      Freedom is not increased by mere diminuation of government. Anarchy is freedom for the strong and slavery for the weak.
    36. Re:False Economy by deadlinegrunt · · Score: 2, Insightful

      "... he mentions that the use of const, virtual functions, abstract functions, and other constructs can reflect design decisions"

      The nexus here is the inability of people to agree on a level of competency to understand how true Meyers, and your post, are. C++ is not only capable of showing what the code does (duh, it has to) but also reflecting design decisions. The only reason I can understand the people that do not accept this is because of limited understanding or total lack of it.

      Given its "hardcore" industrial toughness, C++ is an elegant [and complicated] language; all things considered. Like it or not, it is successful at acheiving its primary goals and then some.

      Yes - it has its warts, as well as its beauty. People often show disdain for things they don't understand more times than not by default as opposed to having valid reasons for doing so. Obviously it is not a silver bullet but it is an effective bullet. Boils down to who holds the gun.

      --
      BSD is designed. Linux is grown. C++ libs
    37. Re:False Economy by Viking+Coder · · Score: 1

      Imagine this mental exercise:

      You have the source code. I have all the other documents. Neither one of us was involved in producing any of that, and we can't communicate at all with anyone else.

      Is it possible for you to manufacture a new instance of the executable? Yes, you hit compile.

      Is it possible for me to manufacture a new instance of the executable? Yes, I have to type a shitload of code, and I can guarantee that my executable will be dramatically different from yours. Mine will probably have a ton of errors in it, even if there were no errors in the documents that I got. I would have to test mine like crazy to get it into working shape.

      What you had (the source code) was the design for that single instance of the executable.

      Would you rather have also had the documentation as well? Of course! It would make it easier for you to understand and modify the design for the next feature.

      Perhaps calling it "the design" is a poor choice in words, but I absolutely agree with his fundamental point about manufacturing being the mechanical equivalent of compilation, and that changing a single line of source code changes the design. And if you want to talk about what is actually produced - the finished library or DLL or executable - the comments and the sketches and the word docs don't make a lick of difference. It is only the source code that the compiler cares about. We humans care about all that other stuff - it's important for us to have a usable, maintainable, extensible design. But it's just like forgetting to tell Larry on the assembly floor to follow a step in manufacturing - you've got a different (and wrong) manufacturing process than you wanted - and the actual design is wrong.

      I'm just strongly disagreeing, though I understand that my hindsight is superior to his relatively (1992) inexperienced enthusiasm.

      Funny. Did you read his CV?

      Jack W. Reeves is a senior software developer with over 30 years experience in the
      industry. He has worked on systems ranging from simulators for the space shuttle, military
      command and control systems, air traffic control systems, medical imaging systems,
      financial data distribution systems, embedded systems, drivers, and utilities. He has
      exclusively been an OO developer for the last 15 years.

      --
      Education is the silver bullet.
    38. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      yes, i = srqt(-1) are you using imaginary numbers for your matrix elements.

      That's hardly a compelling argument, given that i is used idiomatically both by many programmers to represent a loop counter and by many mathematicians to represent a suffix.

      I spend some of my time picking though compiler generated assembler that does all kinds of things, and you rarely see an early return.

      Did it occur to you that the assembly code generated by a compiler doesn't have to be particularly maintainable or human-readable?

      Anyhow, I expect you are writing something like (obviously with a few more levels)
      dosomething(a,b,c,d){
      if d = 0 return NAN;
      e = b * c / d;
      if e - d = 0 return NAN
      return a / (e - d);
      }

      Well, to some extent, yes, but those "few more levels" make rather a difference to the scalability of your appproach. It's more like this:

      do_something(graph_node *n)
      {
      for (/* each neighbour node to 1st node */)
      {
      if (/* 1st test on 2nd node */) continue;
      if (/* 2nd test on 2nd node */) continue;
      // Several more similar tests

      for (/* each neighbour node to 2nd node */)
      {
      if (/* 1st test on 3rd node */) continue;
      if (/* 2nd test on 3rd node */) continue;
      // Several more similar tests

      // Several more nested loops later...

      for (/* each neighbour node to 6th node */)
      {
      if (/* complex test on all nodes collected succeeds */)
      {
      return /* something indicating which nodes were identified */;
      }
      }
      }
      }
      return /* something indicating that the required subgraph wasn't found */;
      }

      The nested loops here are basically unavoidable; the only alternative in a typical structured programming language is to hide them inside functions, which is a bad idea for the reasons I described previously.

      The tests could be separated into a pre-loop that filtered the relevant list of neighbour nodes at each stage prior to looping over it, but that wouldn't really gain anything in terms of clarity. More seriously, it probably involves either constructing a new list, possibly with thousands of elements, inside deeply nested loops, or introducing flagging overhead on each node. The performance and memory usage implications aren't pretty.

      Alternatively, we could continue to write our code in the style above, where anyone coming to the code for the first time can immediately see the structure of the algorithm, wrapped up in a single meaningful function. Unlike the "absolutely no early returns" approach, this style scales to a large number of conditions and/or nested loops if necessary, without compromising the readability or maintainability of the algorithm.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    39. Re:False Economy by oliverthered · · Score: 1

      That's hardly a compelling argument

      Well, you argument was you were programming maths, which is why you shouldn't use counter, and make the code look more like maths.

      Did it occur to you that the assembly code generated by a compiler doesn't have to be particularly maintainable or human-readable?

      Yes, even it the worst possible case 'static code generated to be read by a machine and not by humans' the compiler still doesn't need to return all over the place to be efficient.

      The nested loops here are basically unavoidable; the only alternative in a typical structured programming language is to hide them inside functions, which is a bad idea for the reasons I described previously.

      well, if you cannot use break, and inline functions aren't 'good enough', I expect you doing top left triangle etc... where you can not easily break out of the for loop. In that case I would recommend finding something better suited to your need than c(even if it's just a pre-processor), more a mathematical less functional language, as you said 'the only alternative in a typical structured programming language'.

      --
      thank God the internet isn't a human right.
    40. Re:False Economy by oliverthered · · Score: 1

      Well I can count sheep till the cows come home.

      my post was a generalisation based on my belief that 95%+ of all code ever written can be easily tested without extreme AI. As you have said there are always exceptions to any rule, and you should know that the exceptions apply before you write a single line of code, in which case you use test cases and tables for validation of the IO (still no super AI needed).

      Is 95% good enough to say 'always' and ignore the other 5%, well under trading standards laws yes, military spec is something like 98%.

      --
      thank God the internet isn't a human right.
    41. Re:False Economy by Baric · · Score: 1
      Often I find the kind of people who think quicksort is a complicated algorithm don't really understand this, and sadly, this includes people who profess to be experts in software development, programming language design, etc. etc
      Agreed. "Quicksort" was a complicated algorithm in my Intro to Pascal class 25 years ago. Mid-function returns are a necessity for maintaining the clarity of complex methods. What are the options? Deeply nested conditionals or breaking your method into non-intuitive SUBatomic methods.
    42. Re:False Economy by Doc+Ruby · · Score: 1

      Your contrived example is useful only in emphasizing the importance of design docs in reusing code. The only time it happens in real life, is most of the time when all we've got is source code. Having only the design docs happens almost only with stillborn "pre-alpha" project, like half of SourceForge. You propose a false choice: the real choice is between source code only, and source code + design. In our Slashdot community we're already taking the source code, rather than just the object/executable code, for granted. When the design docs are also as available, we'll look back on the undocumented past as a primitive, unworkable environment barely distinguishable from the closed-source era that preceeded it.

      "my hindsight is superior to his relatively (1992) inexperienced enthusiasm"

      I'm sure his hindsight is superior to mine. But of course my hindsight, like his own, is superior to his contemporary optimism of 1992 - that's the nature of hindsight.

      --

      --
      make install -not war

    43. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      Well, you argument was you were programming maths, which is why you shouldn't use counter, and make the code look more like maths.

      Erm, yes. And as I pointed out in my previous post, it is quite idiomatic in maths to use i as a suffix. I have a degree in the subject, and I now use it professionally every day, and I promise you I see far, far more suffix i's than imaginary ones.

      Yes, even it the worst possible case 'static code generated to be read by a machine and not by humans' the compiler still doesn't need to return all over the place to be efficient.

      It's not about efficiency, it's about readability and maintainability. The structure of assembly code output after various phases of compilation and optimisation has precious little to do with the structure of the original code.

      In that case I would recommend finding something better suited to your need than c(even if it's just a pre-processor), more a mathematical less functional language, as you said 'the only alternative in a typical structured programming language'

      Or we could just use the technique we do, which has no problems in this area other than conflicting with your personal preferences about coding style. :-)

      (FWIW, the sort of alternatives you propose aren't even close to fast or portable enough for our application. We write mathematical libraries that are shipped on dozens of platforms, and you can never have code with execution too fast or memory requirements too low in that context.)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    44. Re:False Economy by oliverthered · · Score: 1

      'the sort of alternatives you propose aren't even close to fast or portable enough for our application'

      that's a shame, it's not my personal preferences so much as functional programming is 'easier' with linear methods, it's a shame that there isn't software for mathematical applications that can produce nice fast code but have a clean, linear layout.

      --
      thank God the internet isn't a human right.
    45. Re:False Economy by nagora · · Score: 1
      Nor, I imagine, would Java programmers, C# programmers,

      I really can't see what C++ has given to Java that it didn't get more directly from C, Smalltalk, and a few other experimental languages. C# I don't know well but it seems the same.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    46. Re:False Economy by Anonymous+Brave+Guy · · Score: 1

      You're right. A lot of our work would suit a functional programming language very well, say, and probably would be significantly more concise and readable when written in one. Unfortunately, as things stand today, the performance overheads those languages incur and the need to be portable to such a wide range of platforms are prohibitive: you're almost forced to work with a filtered list in the example I gave, for example, and even though that list-handling might be quite heavily optimised in a typical functional language and/or lazily evaluated, it'll still be slower than tight C++ code written for that exact filter.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    47. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      I really can't see what C++ has given to Java that it didn't get more directly from C, Smalltalk, and a few other experimental languages.

      You mean apart from almost the entire OO framework, more recently also the generic programming concepts, and most important of all the familiarity with using these things in a language with C-style syntax?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    48. Re:False Economy by nagora · · Score: 1
      You mean apart from almost the entire OO framework,

      I take it that you've not tried Java? The OO framework is much more highly developed than C++'s and it is almost like a proper OO system; it bears no comparison with C++'s half-arsed system. It does still suffer from the C type system which is why they've had to graft on the generic programming hack which Smalltalk does not need, but that again derives from the C ancestory rather than anything learned from C++. Any such system of strong typing would have hit the same problem and, I imagine, solved it in the same way. Having said that, the Java implimentation is much better.

      the familiarity with using these things in a language with C-style syntax?

      That's hardly an argument for having derived from C++ instead of C, is it? Or do you mean to imply that C was an obscure language?

      You'd think I liked Java from all of this. I don't. The type system is too big a price to pay but it is materially better than C++, but that's nothing to crow about.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    49. Re:False Economy by Doc+Ruby · · Score: 1

      Right, and my house architect's sketches of the orientation of the house aren't designs, because the masons don't use it to pour the concrete slab. The blueprint is the only design document.

      --

      --
      make install -not war

    50. Re:False Economy by Viking+Coder · · Score: 1

      Good lord, you call that contrived? Haven't you ever gotten source code with comments in a language you can't read? So, that's one half of my example...

      And for the other half... Haven't you ever gotten design specifications with no code? This happens in reverse engineering all the time, for one. It also happens when you're trying to implement a research paper without source. Or when you're implementing what's in a patent - possibly because you licensed the patent but not the source.

      Those are absolutely not "contrived examples"! And they're not a "false choice." They really happen.

      And I think you should read my other post on the subject, to see how important design docs are in having maintainable code.

      --
      Education is the silver bullet.
    51. Re:False Economy by Anonymous+Brave+Guy · · Score: 1
      I take it that you've not tried Java? The OO framework is much more highly developed than C++'s and it is almost like a proper OO system; it bears no comparison with C++'s half-arsed system.

      That's a fascinating description, since Java's OO system is basically C++'s with the addition of the top type, the removal of multiple inheritance, non-virtual methods and deterministic destruction semantics, and minor changes such as the extra access level.

      You can start talking about the type system as a whole and arguing that late binding for everything and reflection are advantages, but then you also wind up with native types that don't derive from the "top" type and have to be wrapped/boxed/etc. to fit in with everything else. I'm not sure you can accurately describe Java's type system as "materially better" than C++'s when it exhibits this sort of inconsistency in everyday use...

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    52. Re:False Economy by iabervon · · Score: 1

      Code is never incorrect as far as documenting what the code does. It may be non-functional, broken, or inapplicable, but the closest it can be to incorrect (in this sense) is to be misleading.

    53. Re:False Economy by Doc+Ruby · · Score: 1

      Of course your tautology is correct. Who cares that the code documents all its bugs, design flaws and inappropriate algorithms? What we want the code to do is more important that what it happens to do. That is the benchmark against which we measure whether the code is correct: whether it works.

      --

      --
      make install -not war

    54. Re:False Economy by iabervon · · Score: 1

      What the code happens to do is quite important; otherwise we wouldn't bother to fix bugs. What we want it to do is also important; otherwise we would be satisfied with programs doing whatever.

      On the other hand, we don't really care about what the code used to do but doesn't any more (unless we're trying to figure out when it stopped doing that or how to make it do it again), and we really don't care about what we used to want the code to do but have since decided wasn't such a good idea.

      The thing that can be bad about documentation, and especially documentation outside of the code, is that it doesn't automatically stay up to date. The code always documents what the code does now, but the documentation can still be documenting what we no longer want the code to do.

      This is a way in which unit tests can be better documentation than plain text documentation; if the unit tests are out of date, the author will probably notice, whereas if the plain text is out of date, the author won't notice for a long time.

    55. Re:False Economy by Doc+Ruby · · Score: 1

      All these conflicts are why I want to move to executable flowcharts. Beyond harnessing a common language that everyone understands, and reflecting the movement of information and control among people and machines which our physical sensibilities can innately interpret, it's the best kind of documentation. The representation of the software to humans is the same as the one to the machine - there aren't even two sets of information to keep synchronized. UML is getting there. When we've got a really easy UML flowchart editor that compiles to instructions, we'll be a lot better off. Especially when the UML is preprocessed to C or some other lexical language, where we can continue to use all our old, reliable lexical analysis and management tools.

      --

      --
      make install -not war

  10. A nice quote by tcopeland · · Score: 4, Insightful

    > Personally, I think a person with his feet on
    > the desk staring at the ceiling can be "doing
    > design" just as seriously as someone playing
    > with UML diagrams in ROSE.

    So true. Although I find it helpful to move along these reveries by writing little test apps to put wheels on some ideas... just little 10-20 liners to help get a better handle on things.

    1. Re:A nice quote by KiltedKnight · · Score: 2, Interesting
      That's what your whiteboard is for.

      I don't know how many times I've used a whiteboard to just diagram, erase, list, or whatever. Extremely useful tool, and when it's done, you have a picture you can translate into a design document.

      --
      OCO is Loco
    2. Re:A nice quote by decipher_saint · · Score: 1
      > Personally, I think a person with his feet on
      > the desk staring at the ceiling can be "doing
      > design" just as seriously as someone playing
      > with UML diagrams in ROSE.

      I think I used to maintain that guy's code, no documentation written anywhere and the code looks like it was written as several different prototypes and then jumbled together in some form of working fashion.

      While I realize this is not always the case and I write code the same way myself, the real benefit to "writing documentation stuff down" is that it's there for future generations to maintain and build upon. Much as I like recoding whole modules because the existing code is written like ancient Egyptian without the benefit of a Rosetta stone...
      --
      crazy dynamite monkey
    3. Re:A nice quote by Qzukk · · Score: 1

      The problem with writing the documentation down at the beginning of a project is that in the "Real World" its obsolete the moment you open up a text editor. As much as everyone would wish for requirements to be laid out up front and set in stone before a single line of code was typed, it just doesn't happen in many, if not most, cases.

      And when it does happen, that documentation time and money goes down the drain. If you had simply written well documented code to start with, that new requirement could have slipped in right where it says /* Add new Edit Menu entries here, then define the appropriate function in editmenu.c */

      Of course, people who don't take the time to document outside of the code typically don't take the time to document inside the code, so you lose either way.

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    4. Re:A nice quote by Proteus · · Score: 1
      True, indeed. But don't discount UML just because it is often misused. The significant advantage of UML is that it is communication: it allows a developer to implement a design (or, indeed, component) in any langauge.

      This is advantageous when your job is to design, and pass the implementation off to someone else. Of course, using UML is not and should not be a substitute for the creative design process. I encourage designers to think out thier designs using whatever method works best: flowcharts, psuedocode, beer and pizza, or some combination. However, once the design is done, formalizing it with UML makes certain that everyone can understand it.

      Mind-reading leads to poor, expensive maintenance; UML helps keep the mind-reading to a minimum.

      --
      We may not imagine how our lives could be more frustrating and complex—but Congress can. – Cullen Hightower
    5. Re:A nice quote by Viking+Coder · · Score: 2, Interesting

      Reminds me of Richard Feynman's Problem-Solving Algorithm:

      1) Write down the problem
      2) Think very hard
      3) Write down the solution

      --
      Education is the silver bullet.
    6. Re:A nice quote by dgatwood · · Score: 1
      More than that, that's what a digital camera is for. Three of us at work designed (and later built) a large PHP/MySQL database front-end last summer. We designed the thing across two floor-to-ceiling, 8-foot-wide whiteboards.

      Now, since whiteboards lack permanance (especially around here), we then snapped high res digital photos of each board in its entireity. Those photos are now checked in as part of the project source code, so anybody can see our original design.

      There are, of course, some variations from that design now, but it is still a fairly good overview. Most of the gaps are filled in by design docs that I wrote up after the fact, based in part on those photos.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    7. Re:A nice quote by astro-g · · Score: 1

      you can get whiteboards that have a movable surface, and an intergrated scanner, and printer.

      When your done drawing things, push the button, the whiteboard surface loops through the frame, and a print comes out the slot.

      standard whiteboards and a digicam probably works better though

    8. Re:A nice quote by dgatwood · · Score: 1
      Where I work, we used to have some small electronic whiteboards that had sensors insside that detected the position of a special pen and stored it electronically, but it only ran on classic Mac OS on beige boxes (maybe serial port-based), and I don't think there are any of them that are still working.

      Besides, there's something just entirely too cool about being able to cover two walls the size of those in my TV room with notes.... :-)

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

  11. i wholeheartedly and utterly agree. by torpor · · Score: 2, Insightful

    and can only describe how much i agree with this in utterly banal terms.

    code is design.

    take any programming language, whatever virtue, whatever failure, it does not matter. the fact that it is a language at all, proves it.

    because any single language exists solely and uniquely by and for design. language is for designing things, and describing the design of things to other people, over a process called 'time'.

    design implies persistence, and as we all know, time destroys all things. language is design over time, and the multitude languages of mankind, even that of his machines, exists to design things.

    i mean to say, this is a language truth, not just a computer programming truth.

    programming languages, as language, are a designed language used to describe very specific activities.

    take any real-life problem, turn it into a virtual machine, design a language around it (or use whatever is there, in the situation being systemized, already), and you have your application done.

    language: the worlds most intentionally widely misunderstood subject.

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  12. What is Software Design? by GillBates0 · · Score: 5, Funny

    Probably something like this?

    X=1024; Y=768; A=3;

    J=0;K=-10;L=-7;M=1296;N=36;O=255;P=9;_=1<< 15;E;S;C;D;F(b){E="1""111886:6:??AAF"
    "FHHMMOO555 57799@@>>>BBBGGIIKK"[b]-64;C="C@=::C@@==@=:C@=:C@= :C5""31/513/5131/"
    "31/531/53"[b ]-64;S=b<22?9:0;D=2;}I(x,Y,X){Y?(X^=Y,X*X>x?(X^=Y) :0, I (x,Y/2,X
    )):(E=X); }H(x){I(x, _,0);}p;q( c,x,y,z,k,l,m,a, b){F(c
    );x-=E*M ;y-=S*M ;z-=C*M ;b=x* x/M+ y*y/M+z
    *z/M-D*D *M;a=-x *k/M -y*l/M-z *m/M; p=((b=a*a/M-
    b)>=0?(I (b*M,_ ,0),b =E, a+(a>b ?-b:b)): -1.0);}Z;W;o
    (c,x,y, z,k,l, m,a){Z=! c? -1:Z;c <44?(q(c,x ,y,z,k,
    l,m,0,0 ),(p> 0&&c!= a&& (p<W ||Z<0) )?(W=
    p,Z=c): 0,o(c+ 1, x,y,z, k,l, m,a)):0 ;}Q;T;
    U;u;v;w ;n(e,f,g, h,i,j,d,a, b,V){o(0 ,e,f,g,h,i,j,a);d>0
    &&Z>=0? (e+=h*W/M,f+=i*W/M,g+=j*W/M,F(Z),u=e-E*M,v=f-S*M,w =g-C*M,b=(-2*u-2*v+w)
    /3,H(u*u+v*v+w*w),b/=D,b*=b ,b*=200,b/=(M*M),V=Z,E!=0?(u=-u*M/E,v=-v*M/E,w=-w* M/
    E):0,E=(h*u+i*v+j*w)/M,h-=u*E/(M/2),i-=v*E/(M/ 2),j-=w*E/(M/2),n(e,f,g,h,i,j,d-1
    ,Z,0,0),Q/=2,T/ =2, U/=2,V=V<22?7: (V<30?1:(V<38?2:(V<44?4:(V==44?6:3))))
    ,Q+=V&1?b: 0,T +=V&2?b :0,U+=V &4?b:0) :(d==P?(g+=2
    ,j=g>0?g/8:g/ 20):0,j >0?(U= j *j/M,Q =255- 250*U/M,T=255
    -150*U/M,U=255 -100 *U/M):(U =j*j /M,U<M /5?(Q=255-210*U
    /M,T=255-435*U /M,U=255 -720* U/M):(U -=M/5,Q=213-110*U
    /M,T=168-113*U / M,U=111 -85*U/M) ),d!=P?(Q/=2,T/=2
    ,U/=2):0);Q=Q< 0?0: Q>O? O: Q;T=T<0? 0:T>O?O:T;U=U<0?0:
    U>O?O:U;}R;G;B ;t(x,y ,a, b){n(M*J+M *40*(A*x +a)/X/A-M*20,M*K,M
    *L-M*30*(A*y+b)/Y/A+M*15,0,M, 0,P, -1,0,0);R+=Q ;G+=T;B +=U;++a<A?t(x,y,a,
    b):(++b<A?t(x,y,0,b):0);}r(x, y){R=G=B=0;t(x,y,0,0);x<X?(printf("%c%c%c",R/A/A,G
    /A/A,B/A/A),r(x+1,y)):0;}s(y){r(0,--y?s(y),y:y); }main(){printf("P6\n%i %i\n255"
    "\n",X,Y);s(Y);}

    Courtesy IOCCC:http://www0.us.ioccc.org/2004/gavare.c

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
    1. Re:What is Software Design? by cmburns69 · · Score: 1

      Can anybody explain to me what this program actually does?

      --
      Online Starcraft RPG? At
      Dietary fiber is like asynchronous IO-- Non-blocking!
    2. Re:What is Software Design? by GillBates0 · · Score: 1

      Hint here: http://www0.us.ioccc.org/2004/gavare.hint

      --
      An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
    3. Re:What is Software Design? by Surt · · Score: 1

      It prints a bunch of stuff to the console. It's kind of pretty. But it seems pretty meaningless. Maybe you have to set up a specific sized console window to make it look right?

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    4. Re:What is Software Design? by darthpenguin · · Score: 4, Informative

      If you're curious as to the output of this, it is a raytracer, where you have to catch the output into a ppm file. Here is a jpg of the results, if you don't want to compile and run it yourself.

    5. Re:What is Software Design? by whynotme · · Score: 1

      Gosh, yer code is purdy!

    6. Re:What is Software Design? by dgatwood · · Score: 1
      So what you're saying is that this is:

      1. One of those magical programs that prints itself.
      2. Self-documenting code.

      Oh, my eyes.

      For another rather humorous example of self-documenting code, there's HeaderDoc. It is a large collection of perl scripts that, among other things, is capable of parsing itself and generating its own internal API reference.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    7. Re:What is Software Design? by kauttapiste · · Score: 1
      Did you do that copy-paste error in purpose? ;)

      A good one. :-)

    8. Re:What is Software Design? by Jiminez · · Score: 1

      This is beautiful.

      Code purity...

      It doesn't matter if you can read it. This is _art_. Someone send it to the *king louvre.

    9. Re:What is Software Design? by cerberusss · · Score: 1
      Hey, this looks just like the code that we got back from India today.

      *ducks*

      (I'm just kidding, Gurdev)

      --
      8 of 13 people found this answer helpful. Did you?
  13. abstract vs. meaning by lone_knight · · Score: 1

    In theory, programming is the abstract representation of thoughts and ideas that are in turn an abstract representation of the real world. All code written is a beatiful articulation of those thoughts and ideas, and the meaning is found inherently "in the pudding."

    In practice, the details and meaning are lost in the abstraction. I have spent too many hours trying to determine just WTF a fellow programmer's code is supposed to acomplish.

    I will admit I am not the first to start writing lines of code before I ever write a thing on a napkin, whiteboard, or sacrificed trees. But design implied in the code alone will very rarely work in a group! It is almost always a necessity to comment your code, and is at best polite to document the design of your code in some surface manner. Code that is never accompanied by design is hardly maintainable or reusable.

    --
    Computers are useless. They can only give answers. --Pablo Picasso
  14. The blah is the blah.... by syousef · · Score: 3, Insightful

    Does this sound a lot like "The Network is the Computer" to anyone?

    Stop with the pseudo-clever melodramatic BS already.

    Good code following the design is nothing new. Jumping straight into coding without a design document that the WHOLE team AND your clients/users can read however is insane.

    I'm all for productive laziness but this is just plain BS.

    --
    These posts express my own personal views, not those of my employer
    1. Re:The blah is the blah.... by Mr.+Slippery · · Score: 2, Insightful
      Does this sound a lot like "The Network is the Computer" to anyone?

      It does - but that phrase seems to be the submitter's invention, at least from a cursory look at the fine article. Reeves's point is much more sublte and interesting:

      The final goal of any engineering activity is the some type of documentation. When a design effort is complete, the design documentation is turned over to the manufacturing team. This is a completely different group with completely different skills from the design team. If the design documents truly represent a complete design, the manufacturing team can proceed to build the product. In fact, they can proceed to build lots of the product, all without any further intervention of the designers. After reviewing the software development life cycle as I understood it, I concluded that the only software documentation that actually seems to satisfy the criteria of an engineering design is the source code listings.

      ...

      The overwhelming problem with software development is that everything is part of the design process. Coding is design, testing and debugging are part of design, and what we typically call software design is still part of design.

      It may be that he's using "design" in a more classical engineering sense than most of us coders do.

      --
      Tom Swiss | the infamous tms | my blog
      You cannot wash away blood with blood
    2. Re:The blah is the blah.... by ftzdomino · · Score: 1

      The author's conceptions about the manufacturing world are entirely wrong.

      In the manufacturing world, seperating your design and manufacturing departments leads to parts which are very expensive (if even possible) to manufacture.

      The end goal of a small production product is not the specifications. It is typically a list of raw materials, tools, a plant specific part routing, step by step directions for every cut and alignment need, CNC programs, and a testing program. These specific instructions (possibly comparable to code) are meant to create a product which should meet the specifications. Product testing is necessary to make sure that the specifications are met.

      The product IS NOT the specification.

    3. Re:The blah is the blah.... by torpor · · Score: 1

      Does this sound a lot like "The Network is the Computer" to anyone?


      Nope. To me it sounded like a well thought-out and intelligent discourse on the problems of software development.


      Stop with the pseudo-clever melodramatic BS already.


      Why, so people who don't understand what he's saying can stop being dicks?

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
    4. Re:The blah is the blah.... by Viking+Coder · · Score: 1

      Huh. Funny. So, you're saying that the design department never touched a CNC machine, and somehow they magically produced a correct CNC program?

      Of course not. That's because design and manufacturing, in every succesful company, know an awful lot about each other.

      How much do you know about your compiler? And when you're done linking source code, how much does your compiler know about your design?

      --
      Education is the silver bullet.
    5. Re:The blah is the blah.... by Viking+Coder · · Score: 1

      Jumping straight into coding without a design document that the WHOLE team AND your clients/users can read however is insane.

      Did you even read the article? He clearly and specifically addresses this misconception of what he's saying at least three times that I can remember off the top of my head.

      To summarize it for you (since you're such a fan of laziness that you won't even try to understand someone's point before you try to shoot it down): everything you call "design" is important - really, really important - but don't trick yourself into believing it's the design. If two people modify two separate things in conflicting ways - one the UML and one the source code - which one do you think is going to actually matter to the finished product? It's the source code, of course. Does that mean UML is unimportant? NO. He doesn't say that, and you're freakishly lazy for presuming he did - since he says otherwise in the article.

      --
      Education is the silver bullet.
    6. Re:The blah is the blah.... by syousef · · Score: 1

      I did read the article and what I was saying is that his melodramatic way of stating the freaking obvious is unimpressive.

      If you put something in such a way its so easy to misconstrue while simultaneously trying to put yourself up as an nisightful guru you'd better expect intelligent people who aren't bamboozled to say "hang on a minute".

      --
      These posts express my own personal views, not those of my employer
    7. Re:The blah is the blah.... by syousef · · Score: 1

      If you put something in such a way its so easy to misconstrue while simultaneously trying to put yourself up as an insightful guru you'd better expect intelligent people who aren't bamboozled to say "hang on a minute".

      This isn't well thought out anything - its sedrivel, and the author is surprised that people don't bother to respond to his poorly thought out argument.

      The fact that you're resorting to abuse or implied abuse tells me all I need to know about you.

      --
      These posts express my own personal views, not those of my employer
    8. Re:The blah is the blah.... by ftzdomino · · Score: 1

      They all talked, and there was not much separation. If they had been separated, the design department would have designed parts which would not have been easily manufactured. I'm saying TFA's assumptions about manufacturing are erroneous. The NC program, part routing, or anything else eqiuvalent to source code in the author's analogy is not a "specification".

      Attempting to bypass standard engineering practics would have similar results as to what it does in software. Initially you'd show great progress, but you'd still end up with a poorly functioning hack which takes a lot of time to meet the original specs.

    9. Re:The blah is the blah.... by Viking+Coder · · Score: 1

      ....and what exactly have you contributed to this discussion?

      =)

      I thought the article was well-written and made some interesting points. It's started a pretty cool conversation with several of my peers, and we're reaching interesting conclusions. Between us we have a bunch of degrees in various aspects of software engineering. You're some dick on Slashdot. =) I'm not putting you down, I'm just saying that we're having an interesting conversation based on this article and you're flinging poop. Not so impressive, guy. =)

      You could join in the discussion, or you could arrogantly state that it's "freaking obvious and unimpressive." Fine. If there's nothing for you to gain in the discussion, move on. Or write your own damn article.

      Personally, I'm more interested in what you have to say, than in hearing about how dumb you think I am and this article is. One's constructive - one's just assinine.

      Especially because he never fucking said that you should "Jump straight into coding without a design document," (he actually said the opposite!) which makes you just look like a moron.

      --
      Education is the silver bullet.
    10. Re:The blah is the blah.... by Viking+Coder · · Score: 1

      Jesus. He's not advocating that people should "bypass standard engineering practices."

      He's saying that that the best engineering practice in the world is to test the shit out of everything, and be willing to make changes when you find flaws. To find flaws you have to look for them. Looking for flaws in blueprints is hard (you have to simulate, and make assumptions in your simulation, and...). Looking for flaws in a manufactured part is a hell of a lot easier (because you just try to bend the fucking thing and see if it breaks!)

      They're both valuable - but given your choice, wouldn't you rather test the real component?

      Test the real component! Write unit tests!

      It's so sad to hear you all talk about this, because he's actually calling for more rigor, and you all think he's calling for less. Maybe the article is poorly written in that respect, but it's a shame to see you throw away some of his ideas and conclusions on the basis of an easily-corrected misunderstanding.

      --
      Education is the silver bullet.
    11. Re:The blah is the blah.... by computational+super · · Score: 1

      That seems to argue the author's point, doesn't it? It's like we (the software engineers/programmers) are the designers for a completely automated manufacturing plant (which would be the compiler & the linker). So, separating design from manufacturing in the manufacturing world is like the silly practice of trying to separate "designers" from "coders/programmers" in the software world. It could be done, but it would take ten times as long as it would to just have the designer do the programming.

      --
      Proud neuron in the Slashdot hivemind since 2002.
  15. Sigh by DanielMarkham · · Score: 3, Insightful

    Perhaps slashdot should have a special section for newbies who don't want to do the hard work of creating software and would rather just hack.

    Yes, staring at the ceiling can be just as good as playing with UML. But your job is to communicate -- to the team, to the customer, to the poor maintenance programmer -- just what the heck you are trying to accomplish in your code. The "being the smart kid" should be the easy part. The "getting clarity and agreement on scope and solution space" is what they are paying you for.

    I've found that it is very hard to communicate to the customer the contents of a switch statmenet using polymorphism. Hence the reasons for layers of abstraction. Model, design, plan at just enough detail that you can communicate and agree on a strategy with all the stakeholders. Then go play with the bits and bytes.

    1. Re:Sigh by Viking+Coder · · Score: 1

      Perhaps slashdot should have a special moderation value for newbies who don't want to do the hard work of RTFA and would rather just bitch.

      The compiler doesn't care how much you communicated. Clearly you need to communicate to solve sufficiently large problems. He never said anything different! Everything you do, right up until the point where you type actual code makes no difference to the compiler. Since the finished product (the executable) is what you intend to build, and the compiler actually built it, and the only instructions that matter to the compiler are the source code - clearly your source code is the only design that actually matters to the finished product.

      Everything else you do to communicate improves your ability to work with the design.

      He's not saying "hack away!" He's saying that testing is a part of Engineering, since it changes the design. Do you really want to argue that point?

      He's saying that all activities that influence the source code are a part of design. Since design is important, all of those activities are important!

      And you've completely misunderstood the article, and have tried to read it the exact opposite way. For shame.

      --
      Education is the silver bullet.
    2. Re:Sigh by RM6f9 · · Score: 1

      A well-written design specifications document ideally should be robust enough to generate test cases from.
      Now, if only we testers could get that idea into the heads of the coders and designers...
      "Sigh" is such an apt place for this...

      --
      Take the 90-Day Challenge! http://rwmurker.bodybyvi.com/
    3. Re:Sigh by DanielMarkham · · Score: 1

      I was commenting on the other posts.

      I admit it! I didn't RTFA!

      So there. I wonder if I get any bonus honesty karma points.

      As to your comments (and not the article), sounds like hyperbolic bullshit to me. The network is the computer, the code is the design, my grandma is a trolley, etc.

      Code is what comes out of a coder. That's it. may have nothing to do with design. Could be a thousand monkeys typing on a thousand typewriters. Yes. Since there is code there is an implied design, but since you've defined design as everything, then everything must be part of design. Ergo, you have a circular argument. Either there is more depth to it or not. From the other posts, didn't look like it, so I didn't waste my time. Thanks for the comments.

    4. Re:Sigh by MSBob · · Score: 1
      Communication is important but it has nothing to do with software design.

      The majority of software project failures I've seen in my career have been due to... software design. Specifically, waterfall big-design-upfront type of projects tended to collapse and crumble under the smallest wind of change coming from customers. The inherent problem with designing software is that it's very difficult to predict the extension points and it's clearly impossible to design software that is extendible in all aspects. Design adds complexity which, when applied to wrong places, adds nothing to the end value. Finally, big-design-upfront teams often spend an inordiante time designing the minute details and even when (often) they get some aspects of the design wrong they end up trying to maintain the structure feeling that since they had already invested so much time and energy in the design, it would be wrong to scrap so much hard work. And so they plough ahead with a broken design and end up spending more time coding the needless complexity, debugging the needless complexity and working around the flaws of the desing to just get the thing working.

      --
      Your pizza just the way you ought to have it.
    5. Re:Sigh by Viking+Coder · · Score: 1

      Groovy - you win points. =)

      I think the most valuable point of this, which he didn't really harp on - is that if you change a single line of source code, you've changed the design. If you do that late in a beta-cycle, you might be really screwing up. Everyone knows what it means to "change the design," we all get that we have to go back and test the hell out of it. But if we "just change a single line of source code," the understanding of how to test that is pretty squishy.

      He's actually calling for more rigor, rather than less, in considering the importance of a single line of code, and testing having an impact on the design...

      Oh, and a point I made to a friend - the analogy he makes between HW and SW is interesting - because in HW you can test components as you build them. But the build process in SW is so atomic that we can't interject tests into it. Which is why unit tests are so unbelievably important! They're your only chance to test the individual components in a "repeatable process" kind of way, as people always do in serious manufacturing.

      I agree with you - it's kind of a "be the design!" idiotic way to make those kinds of points, but I think there's gold in them thar hills. This article may not embody the most valuable or useful or productive way to communicate those ideas - but I think it's an interesting seed for discussion.

      --
      Education is the silver bullet.
  16. My company. by inertia187 · · Score: 5, Funny

    Whenever I bring stuff like this up to the powers that be, their response is basically just, "Shut-up and code." Then conversations like this take place between employees:

    Dilbert: I'd quit and become an entrepreneur, but I don't know how they handle such huge risks.
    Wally: Denial, probably.
    Alice: We got bought by our arch-rival this morning. Their CEO says he plans to be as "humane" as possible.
    Dilbert: He sounds nice.
    Wally: Maybe we'll get bonuses.

    --
    A programmer is a machine for converting coffee into code.
  17. Flex by jwegy · · Score: 2, Interesting

    Design importance has a direct relationship to the size/complexity of the system being designed AND the "system" that is designing the system. By that I mean, design is a loose term. Me and my roomate can design better by talking about a general idea, and then sitting down and writing code while making adjustments where needed. This process wouldn't work in most coroporate cube farms where you have varying levels of skill, vision, ability to learn, types of users, and the all knowing PHB. This is a stereotype. I picture them developing a strict design that has to be followed. What is important, no matter what type of design you have in front of you is FLEXIBILITY. That designs needs to be able to change without throwing the whole system off balance. In fact, design should be a process which includes the implementation of itself.

    1. Re:Flex by lone_knight · · Score: 1

      "In fact, design should be a process which includes the implementation of itself."

      Nice quote. I agree with this wholeheartedly. The code isn't solely the design, but the implementation of the code should be considered a part of the design.

      Like the Tao, only in 1's and 0's.

      --
      Computers are useless. They can only give answers. --Pablo Picasso
  18. I agree completely by MCTFB · · Score: 5, Insightful

    There are many styles to writing code, but I think that if you are verbose with the naming of your variables, as opposed to naming your variables with unintelligible abbreviations, then that goes a long way to long term code maintenance.

    Well written code should read like a book and only need commenting for blocks of code which are not completely obvious as to what their intent happens to be (for example some hack you write up to get around a bug in a library you are using at the time).

    One of the most annoying things is the fact I choose not to use an IDE, so developer documentation inserted into the code to describe a function or class or whatever just clutters up the reading of the actual code.

    Furthermore, most of the developer documentation of your typical programmer is such that all it describes is the arguments a function takes and what is supposed to be returned, while doing nothing to explain the purpose of the function and why it might be used. In other words, most of the time documentation is useless and just gets in the way because it doesn't relate to anything which makes sense (for humans to understand something new, usually you need to relate it to something they already understand).

    So as a general rule of thumb, if you can read the code out loud (or in your head) and you don't constantly have to stop to analyze the code to see what the context of some variable happens to be at any given time, then you are doing a good job. If on the other hand your code cannot be read out loud (because of inaudible variable names), then the odds are some other programmer is going to have to review every other line of your code just to try and make sense of it all.

    An ex-employee of mine who I didn't audit very well, spent a ton of time documenting his code in some of the most anally-retentive ways. However, his code just never had any flow. To date, I have had to scrap much of what he worked on because his code was not maintainable.

    So in essence, if you have poorly written code, then all the documentation in the world won't do much because poorly written code makes your design inflexible and hard to work with, while well-written code that you can read like a book usually is simple enough that you can mold it into something more useful later on.

    So I agree that the code is the design and the design is the code. You can come up with the most elaborate UML diagram known to man, but if the code has no flow to it, and a whole lot of hacks are needed to implement a rigid design structure, then the design overall in the end is going to suck.

    If you are going to do documentation, keep your modules small and do it once you are pretty certain the modules won't be changing much from that point on. If you are uncertain, then it is probably best to just ignore the documentation process until things are more set in stone.

    1. Re:I agree completely by Sugar+Watkins · · Score: 1

      In my opinion, only a PHB type would use a vacuous phrase like "the code has no flow". It sounds like your ex-employee's problem was designing, whereas your problem is communicating (and managing).

    2. Re:I agree completely by corblix · · Score: 1
      Furthermore, most of the developer documentation of your typical programmer is such that all it describes is the arguments a function takes and what is supposed to be returned, while doing nothing to explain the purpose of the function and why it might be used.

      One can draw a different conclusion from this than the one you drew. You are right: documentation is often bad. However, the experience of many people is that documentation is often necessary. So it is worth our time to consider how to document things well.

      IMHO, the Design by Contract school of thought has done some good things in this direction. But your point about neglecting the overall purpose is a good one. One can, for example, combine pre and postconditions with a general statement of purpose.

      // innterProd
      // Returns the inner product of two given vectors
      // Pre: None.
      // Post: Return value is len(vec1) * len(vec2) * cos(alpha),
      // where alpha is the angle between vec1, vec2.
      Scalar innerProd(Vector vec1, Vector vec2);
      Surely there can be little ambiguity about what that function does, and when one would use it. And the doc's are pretty concise, too.

      But that doesn't mean DbC is the One True Way. In any case, the question of how to document code well (and easily!) is one that is worth more effort than is currently being spent on it.

    3. Re:I agree completely by MCTFB · · Score: 1

      Actually I have been a professional software developer for close to 10 years now and like any decent developer I know a wide variety of programming languages, however, PHP is not one of them (-:

    4. Re:I agree completely by devonbowen · · Score: 1

      I am required to use an IDE at my place of employment. I do not use an IDE at home. And, although I am as fast as my coworkers with the IDE, I am still much, much faster at home. Not to mention being the only one that can solve the problem when the IDE has a bug.

      Devon

    5. Re:I agree completely by devonbowen · · Score: 1
      Furthermore, most of the developer documentation of your typical programmer is such that all it describes is the arguments a function takes and what is supposed to be returned, while doing nothing to explain the purpose of the function and why it might be used.

      I'm working a contract with a large company that has a proprietary framework on which all the code is based. Much of the documentation is of this type. "setFormatter() - sets the formatter." Brilliant. Thank god it's Java. So I unpacked all the class files and decompiled it. Now I have source code without comments but I actually understand how things work.

      Devon

    6. Re:I agree completely by bigbird · · Score: 1
      I am required to use an IDE at my place of employment. I do not use an IDE at home. And, although I am as fast as my coworkers with the IDE, I am still much, much faster at home.

      you must work on very simple and small projects then. An IDE is invaluable in tracing program flow, auto-showing documentation etc etc. I really don't see how complex systems can be effectively programmed without them.

    7. Re:I agree completely by Shadowlore · · Score: 1

      If on the other hand your code cannot be read out loud (because of inaudible variable names), then the odds are some other programmer is going to have to review every other line of your code just to try and make sense of it all.

      Sounds like perl. ;)

      Just for fun sometime read a perl script aloud and pronounce each dollar sign "eater of flesh" in a somewhat lower "subscript" voice. Read each @ symbol as "devourer of souls", and each non-comment # as "consumer of wisdom".

      --
      My Suburban burns less gasoline than your Prius.
    8. Re:I agree completely by devonbowen · · Score: 1
      you must work on very simple and small projects then

      Uh... no. So you believe there were only "simple and small" projects until IDEs were invented? IDEs haven't been around all that long.

      Devon

    9. Re:I agree completely by corblix · · Score: 1
      Talk about overkill in documentation.

      I'll admit this is a silly example. Most examples are, though, in order to distill ideas down to a manageable form.

      However, I must disagree with your statement about overkill. Yes, I might change the names and the way things are stated, but this is exactly the level of documentation that I think ought to be provided for such a function:

      • Its name
      • What it does
      • Pre and postconditions, in automatically checkable form.
      Since there is no standard way to write automatically checked invariants in C++, I made them comments. The idea was that it would be easy to convert them to such. And I think it is.

      As for your more mathematical comments (which are rather off-topic, but still worth discussing IMHO): First, defining the dot product as the sum of products of corresponding coordinates is fine if you are using a coordinate-based representation. But for a coordinate-free representation, the way I have stated it is more appropriate. Second, replacing "innerProduct" with "usualInnerProduct": well, of course it's "usual". If we had to say "usual" all the time we'd never get anything done. When I say, "What is the product of 20 and 100?" no one asks, "Do you mean the usual product?" because of course I do.

  19. 13 years later and he's still right by photon317 · · Score: 3, Insightful

    I won't argue the point, as he does a better job than I could, but I whole heartedly agree with his take on the matter. Especially that paragraph in the "new" essay (2nd one of the 3 in the linked page) that makes the analogy about doctors in discussing the "Less Able Programmer" problem.

    --
    11*43+456^2
  20. The Falacy of self-documenting code. by Ungrounded+Lightning · · Score: 4, Interesting

    But there's no substitute for writing the requirements, feature definitions, scopes and dependencies first, then the comments in the code blocks, then the code, and tar'ing those docs with the source code. The initial hump is steeper, but the total area under the work curve, over the product lifecycle, is much less.

    Actually there is: Co-evolving the spec documents, comments, and code. Yes it helps a LOT to plan ahead - and it's a must if you want things to have a chance of getting done in any reasonable time. But trying to cast a spec into concrete in advance of coding is a false economy, too. The spec must remain maleable so the internal problems with it that are discovered during the coding phase can be corrected.

    The thing there IS no substitute for is documentation separate from the code itself - whether it's a spec document, good comments, or (preferably) both. Self-documenting code is a falacy - because the code only documents what the code does, not what the code SHOULD do. (Grep is a great program. But it's REALLY broken if what you wanted was cat, or ftp.) Testing doesn't check that a program is "right" - only that it matches a spec. If you're trying to verify correctness of someone else's "self-documenting" code the only thing you can test is the complier. B-)

    That applies to you trying to test your OWN code later. You are not the same person you were two months - or even two hours - after you wrote it.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:The Falacy of self-documenting code. by Albertosaurus · · Score: 1

      Self-documenting code is a falacy - because the code only documents what the code does, not what the code SHOULD do. This has got to be the single most brilliant insight I've read on Slashdot in the past half a year.

    2. Re:The Falacy of self-documenting code. by Zaak · · Score: 3, Funny

      Grep is a great program. But it's REALLY broken if what you wanted was cat, or ftp.

      Slight nitpick: cat is a subset of grep. Just use a pattern that matches every line like ".*". Granted, if you said "write cat" and your programmer wrote grep, you should have a talk with him about creeping featuritis.

      Other than that I agree.

      TTFN

    3. Re:The Falacy of self-documenting code. by Ungrounded+Lightning · · Score: 3, Interesting

      I agree with parts of your argument but disagree with others.

      Documentation that says what code should do merely moves the problem. Now you have to test the documentation.

      That's one I disagree with. It's true on its face. But it misses the underlying point of documentation - whether comments or specs.

      Having a separate representation to match against during a testing phase is actually a secondary benefit. The primary reason is to require the designers to create two, separate, expressions of the program's intent, in two languages / representation modes that are as distinct as practical.

      Thinking in different languages (i.e. english prose vs. C++) gives them more opportunities to "view the bug hiding behind the blind spot from a different angle" and spot it. (If they're written by different people with different blind spots, so much the better.)

      The idea is to have the CORRECT behavior documented in at least ONE of the representations. Then the testing process becomes one of finding the discrepancies, determining WHICH representation was right, and correcting the other.

      This is surprisingly effective - even when both representations are written by the same person.

      Documentation should be an abstraction of the code. It should describe at a higher level what is going on, so that an abstracted understanding can be achieved that is non-obvious by reading the code. This is merely to increase the efficiency of understanding unfamiliar software.

      Again this is PART of its purpose - because educating the programmer is part of its purpose. Documentation can give explicit statements of structure that is only implied in the code. Documentation can explain emergent behaviors of assemblies that are non-obvious from the component pieces. Documentation can explain pitfalls which must be avoided - which are represented in the code only by their absense. And so on.

      But documentation at a different level of abstraction also "shifts the view angle" and moves the blind spots - again helping to expose the hidden bugs by giving a "correct" representation when the code is incorrect. Documentation can also be redundant, giving more than one extra view.

      IMHO the education of programmers is secondary - while the redundant, divergent, expressions of the same algorithm is key.

      Testing will always have to be between code and end user expectation.

      That I agree with.

      Everything in between is fluff for testing.

      And as you see above, that I disagree with. The things in between are useful tools to produce two desired effects:
      - A desired behavior for the program, in the programmers' mind(s), which is reasonable, internally consistent, and well-vetted.
      - A match between the programmers' idea of what the program should do and what it actually does.

      The "design it twice in two ways" approach creates the latter two with high confidence. Then the only remaining issue is mismatch between the programmers' and end users' expectation. With bugs constrained to this narrow field they're generally few and quick to fix.

      But programmers generally have little trouble understand a reasonable user's expectations when they actually sit down to think about it and write them out. The bulk of bugs come, not from user idea / programmer idea disconnect, but from programmer idea / code disconnect. Thinking of your documentation job as SOLELY addressing the first disconnect risks disaster.

      = = = =

      Interestingly, your logic DOES correctly state the reason "program proof of correctness" is also a falacy.

      - Formal correctness proofs prove, not that the program is correct, but only that the program is consistent with a formal satatement of what is correct. (Again, "grep" might be perfect if you wanted a pattern matcher, but it's definitely broken if you wanted a web browser.)

      - To be useable by a correctness proof (whether human or automated), what constitutes corr

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    4. Re:The Falacy of self-documenting code. by FuzzyBad-Mofo · · Score: 1

      No doubt! cat is as simple as

      $ perl -e 'print<>' < textfile

      grep would probably take a couple lines, depending on which options you wanted to implement..

    5. Re:The Falacy of self-documenting code. by Kristjan+Kannike · · Score: 1

      Python docstring used together with the doctest module allow just for that: code that is as "self-documenting" as it can be, and contains specification of expected results at the same time.

      But of course, for more complicated designs doctest might not be enough.

      And alas, not all applications can be written in Python.

      --
      If God manifested Himself to us here He would do so in the form of a spraycan advertised on TV. -- Philip K. Dick
    6. Re:The Falacy of self-documenting code. by phcrack · · Score: 1

      Slight nitpick: cat is meant to concatenate two files together. It just happens that when you concatenate nothing onto the first file you end up with the same thing you started with.

      You might want to do a refresher on your Unix utils.

    7. Re:The Falacy of self-documenting code. by Frostalicious · · Score: 1

      Your central point of redundancy as a method of verification is interesting, and has some merit. However I cannot see how you can practically implement such an idea.

      There are three points where I cannot see a solution. One, as you point out, there is no method by which you can guarantee that code1 and code2 are equivalent. This can be done by a programmer, but this is extremely difficult. If a programmer was to validate the two code bases against each other, they might as well compare code1 to customer expectation. I don't see that your method simplifies this at all. You mention that this step is potentially automatable. While I agree, I don't see this technology as imminent.

      Two, your idea depends on being able to fully describe a problem with two divergent, sort of orthogonal, languages. However I don't see that such languages exist. Programming languages, with exceptions in only small details, represent similar thinking methodology. It doesn't matter if I write:

      for (int i=0; i<top; i++)

      or

      for i = 0 to top

      or

      //loop through all array elements

      These represent identical thinking. There is nothing divergent or orthogonal here. Any documentation which is sufficiently detailed to fully describe the program will resemble pseudo code, and will thus become useless in your scheme.

      Since both code bases represent identical thinking, if a programmer introduces a line level bug into code1, then the programmer has performed a logical fallacy, but then will likely perform the same fallacy when writing code2.

      It seems to me that what you should do is define a language which implements, automates and enforces this redundancy. You will have to create a second syntax which is so divergent from current thinking as to be revolutionary.

      Three, I don't see this system doing much about the more nefarious bugs, what I think of as second order bugs. First order being a logic error on a line of code. Second order being where you have two functions/classes/programs, which by themselves work correctly. However they make some incorrect assumption about each other and thus perform incorrectly together. This doesn't represent a disconnect between programmer and code, but a lack of comprehension within only the programmer.

      If you have successfully implemented such a system somewhere, I would like to read about that if there is any literature on it.

    8. Re:The Falacy of self-documenting code. by Zaak · · Score: 1

      Slight nitpick: cat is meant to concatenate two files together. It just happens that when you concatenate nothing onto the first file you end up with the same thing you started with.

      Yep, that's cat all right.

      Did you know that grep can search multiple files? And that it concatenates the matching lines from each file?

      As it turns out, I had forgotten that grep prefixes each matching line with the name of the file when you give it multiple files to search. You have to specify -h to supress that behavior if you want to simulate cat.

      Thus, cat is a subset of grep. Just like I said it was. :)

      You might want to do a refresher on your Unix utils.

      Good advice, thanks.

      TTFN

  21. Dangerous.... by Anonymous Coward · · Score: 2, Interesting

    While it may be true that designing is the most critical part of coding, it's dangerous to equate the code and the design. Because that implies, obviously, that writing code is the same as designing it, so just skip any forethought about design concerns and launch right into the coding.

    I will admit to being a project manager, not a developer. And I know that thinking through requirements and design specs is the "eat your vegetables" part of programming, and no one really enjoys it nearly as much as writing code. But I constantly see "code without design" being one the the easiest ways to get code that crashes, throws unidentifiable errors, won't handle valid input, or will produce invalid output.

    Good design matters. Good coding matters. They go together, but they're not the same.

    1. Re:Dangerous.... by dubl-u · · Score: 3, Insightful
      While it may be true that designing is the most critical part of coding, it's dangerous to equate the code and the design. Because that implies, obviously, that writing code is the same as designing it, so just skip any forethought about design concerns and launch right into the coding.

      Sweet Jesus! Did you even read the articles linked? For example, this part?
      Nevertheless, people keep insisting that my contention of "the source code is the design" means "don't do design, just code." I never said anything of the sort.

      If you're going to misunderstand the guy, you could at least do it in a new and interesting way.

      I will admit to being a project manager, not a developer.

      Ah, so that's why you feel qualified to give opinions on something you didn't even take the time to do the reading on.
  22. Yet Another Metaphor About Carpenters by reallocate · · Score: 5, Insightful

    It's always seemed to me that design and coding are more than a bit like buiding a house and using carpentry tools. The world's best carpenter won't build much of a house unless someone's done the design (even if it's just one more 3-bedroom ranch he's built many times before -- that design is imprinted in his memory.)

    But, you can't live in a design, so both skills are needed.

    In the end, people who stand around and argue that good carpenters don't need designs, or vice versa, miss their completion date and lose the customer.

    --
    -- Slashdot: When Public Access TV Says "No"
    1. Re:Yet Another Metaphor About Carpenters by eraserewind · · Score: 2, Insightful

      The whole point about software is that the "carpenter" is supposed to be automated. If the design is complete there is no need for manual translation of the design to the code. Unfortunately it's often far from complete, making many design documents a)next to useless, b)out of date the instant coding begins. That's what stuff like UML tools are trying (and largely failing miserably) to solve.

    2. Re:Yet Another Metaphor About Carpenters by waveclaw · · Score: 3, Insightful

      It's always seemed to me that design and coding are more than a bit like buiding[sic] a house and using carpentry tools.

      I find it funny that you and many other people use Carpentry as a metaphoric model for coding. However, after working as a carpenter for over half a year I have to say that it is appropriate.

      The world's best carpenter won't build much of a house unless someone's done the design

      Houses are built as a variation on a template for their entire neighborhood. In richer areas, more variation occurs, but then more money is poured into the project. In older areas, the variation in house styles is mainly due to renovation by the various tenets over the years.

      Unfortunately, most code written is mostly re-inventing of the wheel at the design and implementation level. Closed source techniques necessitated this for a long time (the highly-copyrighted Numerical Recipes books, anyone?) Open source should change the re-inventing of the wheel, but I still see a lot of people re-inventing the wheel 6 or 7 times out of 10 projects. The 8th and 9th will probably shoehorn in a custom library of crufty utility code they wrote years ago for college homework.

      But, you can't live in a design, so both skills are needed.

      Never owned a house, have we? People who can't afford to spend a long time in a motel/hotel/vacation-resort will live in half finished (but up to code) houses and use kitchens that are being actively remodeled. Similarly, you can go grab open source projects from sourcefroge.net to do little more that compile and jump right in. If I recall correctly, I had to code a Ethernet driver module for the 1.7 kernel series. No driver existed for my card. My RedHat Linux 5.6 would loose network functionality after the install. I this any different from living in a multi-story house while the bathrooms on the other floors are being built?

      In the end, people who stand around and argue that good carpenters don't need designs, or vice versa, miss their completion date and lose the customer.

      A lot causes schedule slippage in both coding and carpentry. Both in carpentry and in programming projects regularly go over schedule. Customers are told that sickness and surprises will cause the schedules to slip on any construction. With programming projects it is hard to tell people that extra, unexpected work is needed. Showing customers the termite damage in a wall is easy, showing the hacks in a networking library is not.

      The correct people and only the correct people talk to customers. These people typically are the people or work with the people who do the design. With coders/software-designers being stereotyped as uncouth and kept away from the customer, the design may not reflect reality. When the customer is not aware of what they are asking (i.e. requirements creep) it is easy to tell them that additional carpentry and materials are not free. Management and the Customer seem to think that additional software features are not free. Your customer facing people must know when to say 'No' and when to say 'it will cost THIS much,' not pander to the idea that coder-time is free because the results aren't physical.

      With trim and paint to cover errors, you can get away with 'rules of thumb' in carpentry[1]. Some voids are needed to allow for expansion and contraction of joints. Management never seems to understand the need for well-defined APIs or plug-in architectures (let alone security or data integrity.) Plus, the computer is a little less tolerant of taking the software equivalent of power tools to the virtual memory manager.

      Come to think of it, carpentry is a very bad model for programming[2].

      ------
      1. Literally a thumb used as a ruler. With the massive non-squareness of some people's idea of a *square wall*
      you have to hate the flexibility of wood over long periodic thermal cycling. Here's a hit: like with bad code, a slightly off wall creeps further out of square with t

      --

      "You cannot have a General Will unless you have shared experiences. You cannot be fair to people you don't know."
    3. Re:Yet Another Metaphor About Carpenters by bluGill · · Score: 1

      Good carpenters do not need a design. They can start building. In fact up until about 100 years ago that is how the houses most people lived in were built. The carpenter just started building with an idea, and stopped when it was done. They made a lot of junk back then too, you just don't see it because those houses have fallen down already. The good houses built that way last because they were over built. Today's houses are built to a well designed spec, which isn't overbuilt.

    4. Re:Yet Another Metaphor About Carpenters by reallocate · · Score: 1

      I indicated houses are typically templated versions of a standard design. So are most software designs. I don't believe open source leads to a burgeoning of new design ideas.

      Yes, I can grab code written by someone else and compile it. But that doesn't elminate the need for design and coding. They're just passed off to someone else. Knowing how to feed a file to a compiler doesn't make anyone much of anything.

      Of course, lots of thing delay projects. I certainly did not say bad design and bad coding were the only causes.

      Seems to me that carpentry remains an excellent metaphor for coding. Coders, like carpenters, use tools to build things. If they don't know how that "thing" is supposed to work and look (design), they're just winging it?

      Would you spend a million bucks on a house that was built without blueprints?

      --
      -- Slashdot: When Public Access TV Says "No"
  23. Yes, I read tfa by chris_mahan · · Score: 4, Interesting

    The idea is that great code resembles a picasso more than a f-16 fighter.

    Picasso could not tell people how he did it, or rather people could not understand picasso's explanation.

    An F-16 fighter, however, given enough years of schooling, could be explaned in great detail to anyone. This is why, although incredibly complex, there are thousands of F-16s out there. Yet there are only Picasso's picassos.

    Likewise a great coder can't really explain how he wrote the great code. He just could. You can see the result, admire it, copy it even. But to apply the same "creative process" to a different problem, you'd have to be the original programmer.

    I say this is why great programming is art and bad programming is not. Just like picasso is an artist and the guy who repainted the wall is not. It's because the "creative process" can't be passed on. It has to be self-invented.

    Anything Shakespeare is Shakespeare. Nobody else can write Shakespeare, because they don't have the same creative process he did.

    You can study Shakespeare, Picasso, Beethoven all your life and never be able to emulate them. Likewise a great coder's code can be copied, but the process that made the code can't be replicated.

    --

    "Piter, too, is dead."

  24. Re:The Code Is The Design by ZeroExistenZ · · Score: 4, Funny

    You haven't seen my code. Nothing designed about it.

    I assume you work for Microsoft?

    --
    I think we can keep recursing like this until someone returns 1
  25. Low Level vs. High Level by kkoning · · Score: 2, Interesting

    Ultimately, I'd agree that "code is design", but that this is an overly simplified view. Looking at "x = y + z" and knowing an addition operation is being performed is one thng, but what do these symbols stand for? Why is the operation being done? How does this fit into the overall function of the software? These questions start to become more difficult and time consuming for a human being to answer without an overall design as a project increases in size and complexity.

    For example, I might be able to look at an init script and, sans documentation, quickly understand what's going on to the point that I can understand and modify the script. It's hard to argue that I could use the same process for contributing a patch to say, PostgreSQL. I guess I'm trying to say that the relative efficency of people using different forms of design (either code, or explicit design documentation) is analagous to algorithmic complexity for programs.

  26. I agree with basic Idea I think by Anonymous Coward · · Score: 2, Insightful

    For me, I can stare at the ceiling fan and draw bubble diagrams for weeks, and actually have a decent plan ..... for some definition of "decent".

    Then I start coding, and about 10 lines into it I realize I've got a major flaw in my design that I could seen weeks ago if I'd been coding. So insofar as "The Code is the Design" stands in opposition to and absolutist commitment to "Da all Design First, Code Later" I'm 100% for it. Insofar as it stands in opposition to "Think about what you are going to do, then do it" I'm against it. Design should start out big a fluffy, and implementation should start out small and concrete. So by the end of the project, The Design==The Code, but while you are making it, you better think of designing as something different than coding, or you'll end up having no design at all.

    I'm starting to sound like "the panther", so I'm stopping now.

  27. experiment by k4_pacific · · Score: 5, Funny
    I thought I'd test to see if the code really is in the design.
    > chmod +x project_design_overview.ppt
    > ./project_design_overview.ppt
    Segmentation Fault
    Nope.
    --
    Unknown host pong.
    1. Re:experiment by CarlDenny · · Score: 1

      You forgot to compile, noob! It's the *code*, not the executable.

      try:
      cc project_design_overview.ppt ./a.out

      I'm sure it'll work! ;)

    2. Re:experiment by P-Nuts · · Score: 1
      You forgot to compile, noob! It's the *code*, not the executable.
      try:
      cc project_design_overview.ppt ./a.out

      I think you meant:
      perl projeect_design_overview.ppt

      C is a bit fussy over syntax.

    3. Re:experiment by Just+Some+Guy · · Score: 1

      Lucky you. I tried the same thing and it installed SP2 on my Debian box. That's the last time I run code found on Slashdot.

      --
      Dewey, what part of this looks like authorities should be involved?
  28. ph34r my 1337 c0d1n9 5ki11z by roman_mir · · Score: 3, Insightful

    Yeah, the code is the documentation and the requirements and the business definition. Of-course it is if you have nothing else. That's what it becomes if noone bothers to update the docs.

    Let me tell you something about that. I have worked on way too many projects (including the current one) where this was the case - there was only code, or the docs were so out of date that really, there was only the code. It's horrific in most cases. Certainly there are horror levels but I am serious, it is just freaky.

    Do you know what happens to a project without documentation? Let me tell you what happens: the only way someone can maintain it, given strict deadlines and/or budget constraints is by fixing the bugs without actually understanding the design. So your fix becomes just a special rule for a special case and in the worst scenario it is also a fix that only works for a special kind of data. So what happens at the end with such a project? A 30 year old COBOL program situation - too many rules that are not generalized all over the place with all kinds of side-effects. Good luck supporting that shit.

    I will take a high level document describing the system any time instead of jumping into the code right away. I prefer to know the components of the system, the main players, where the configurations are, what patterns are used to develop the system before jumping into the code. It is just too damn bad that it does never happen that way.

    1. Re:ph34r my 1337 c0d1n9 5ki11z by sapped · · Score: 1

      Let me tell you something about that. I have worked on way too many projects (including the current one) where this was the case - there was only code, or the docs were so out of date that really, there was only the code.

      You have just described the problem. If the documentation is so far removed from the code then it no longer gets updated. I'm currently working on a project like you described too.

      The major pain comes in when companies like mine suddenly decide they are going to "improve the documenation". We are now so awash in documentation that the following happens; (I swear I am not making these numbers up - I pulled it out last week to show my manager what a farce our system has become.)
      Time to find and make the code fix: 2 hours.
      Time to test the fix: 2 hours.
      Time to document the fix and get it into our production system: 9 hours.
      I have to document the change that I have made (using almost the same language, but not quite) in 6 different documents. Six!!!
      None of this documentation is generated automatically from my code or from other documents.

  29. Re:But we want F-16s by chris_mahan · · Score: 1

    Beside the fact that you post as AC, which is most reprehensible, you should then be content to hear that f-16 computer code will never be cheap, simple, elegant, and developed quickly. In short: J2EE with session EJBs or some awful monstrosity from the Sir Redmond's bestiary.

    --

    "Piter, too, is dead."

  30. His titles are misleading. by Ungrounded+Lightning · · Score: 4, Insightful

    The article title is misleading.

    It makes it sound like he's talking about coding with no forethought and eschewing all documentation (including all comments) in favor of letting the code be the documentation (the "self-documenting code" falacy that has been touted - and known to be false - since at least the early '70s).

    What he's actually arguing is that the steps of the process are misnamed - and that this results in mismanagement. The documents currently called the "design" are just requirements and a high-level / overview documentation of early thoughts. The process currently called "coding" is actually most of the design work.

    This is recognized in the silicon industry - where CAD tools have evolved the process of "designing a chip" into something virtually identical to "writing an application". But in the silicon industry the nomenclature is still "designers" for "programmers" - and "verification-" or "design assurance-" engineers for "test engineers".

    (The latter, by the way, is a highly skilled specialist {in either software or hardware operations} that many software shops don't use, substituting "testers", or confusing them with testers when they happen to have gotten one by mistake. On the "hard side of the force" such people are normally recognized as high-status (and high-pay) pros - the architect's police force and the designers' respected teammates and designated rescuers.)

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:His titles are misleading. by jechonias · · Score: 1

      Excelent summary. Now only one question remains, which is the one I am looking for on this page, is his asertion true or false?

      If it is true, we have misnamed the steps, and the proof is in reality, what do we need to do to change reality and ensure delivery of projects on time - on budget - to requirements?

      And if it is false, lets see the proof.

      None of the stakeholders (*the ones who are paying for the software) care one jot what the programmers and designers call themselves or the steps. They simply care that when someone says "that'll take $500k and 1000 man hours to give you what you want" that it really does cost that to deliver. And works, first time. Just like most houses / bridges / other engineering works!

      jech.

    2. Re:His titles are misleading. by Xiaran · · Score: 1

      None of the stakeholders (*the ones who are paying for the software) care one jot what the programmers and designers call themselves or the steps. They simply care that when someone says "that'll take $500k and 1000 man hours to give you what you want" that it really does cost that to deliver. And works, first time. Just like most houses / bridges / other engineering works!

      I do not agree with this statment. There are quite often times when the stakeholders care and interfere quite a lot in the design and development process. Ive worked on such projects. Think, "you will use RUP, everything will be done in Java, You cannot use struts". Literally these were the rules. Even when it meant following the rules meant the project would fail. I actually got into trouble for breakign the rules(we were using a SOAP library that was closed source and had a serious flaw that meant we could do what we wanted to do... I subsituted it with the AXIS lib and found it worked fine... I didnt get into to much trouble... I was the lead designer/architect/what ever they call it these days).

      As the guy said in the second article... there has to be a happy medium in software development. Between the extremes of rigidity and complete hackiness anarchy. But trying to turn the process into somethign that can be completely automated and down by robot clown monkeys just aint gonna happen. There aint no silver bullet. Of as my Mom always said... producing anything worthwhile is hard work. This doesnt just apply to software development.

      I think one of the other problems is people not realising this fact(still... after 40 years now!). Good software requires thought, intelligence, dillegence, creativity(not is the art sense), patience, determination, passion, attention to detail, communication(this is probably the most important one these days) and lots of hard work. No silver bullet. Software design is managing complexity cause software is complex. Businesses hate to hear this because businesses(non software ones usually) like to be able to put things into neat little boxes and timeframes. Its makes the accountants happy dont you know ! (Oh... and any software developers out there... never ! ever ! work for accountants... I have and it was the most frustrating experience of my career).

    3. Re:His titles are misleading. by computational+super · · Score: 1
      And if it is false, lets see the proof.

      Well, first we start with the base case.

      • Let n = the amount of time spent designing. When n = 0, there is no design work, therefore the impact of design on code is irrelevant, and n = 0 is true.
      • Now we form an induction hypothesis for the case k <= n and assume that k is true.
      • Finally, for the case k + 1, if we remove one hour of design work, we see that k + 1 = ( k ) plus the one hour we removed. Since ( k ) is true by the induction hypothesis (above), it remains to be proven that the one removed hour is also true. This can be proven by examining the fact that, for the fucntion f(x) = x, lim {x -> 0} f( x ) is in fact zero, therefore the one hour of design which was removed is irrelevant, completing the proof.

      Wow, this computer science degree came in handy after all.

      --
      Proud neuron in the Slashdot hivemind since 2002.
    4. Re:His titles are misleading. by themba · · Score: 1

      False.

      He has a point, well made through his manufactuing analogy, but he doesn't carry it far enough.

      When a machinist makes a part on a lathe (s)he takes the blueprint (engineering's contribution) and machines the part to specifications then takes a micrometer and checks it (testing phase) and then passes it along to the QA dept. for final testing. Engineers who are also machinists (though ususally not qualified as either -- ie hackers and inventors) often make prototypes and say just what the author said: "Here it is. The documentation is in front of you. Yes, there, in that piece of metal."

      The problem that the author is exposing here is, imo, that there is in fact no such thing, as yet, as a mature software engineering discipline. Think about the two hundred and fifty year gap between John Harrison's first accurate chronometer and the golden age of modern steam turbines -- both incredibly complicated, critical, mature designs. Harrison is the genius programmer / software engineer of today, but he was, like today's programmers, operating without an engineering map.

      A good set of blueprints and engineering specifications lets an astute and experienced outsider, in only a few minutes, grasp the entire operation of the machine; any particular minutae he cares to focus in on are exposed as well. No such method of documentation, afaik, exists today for complex software designs.

      The reason this distinction is critical is not evident in the actual product under consideration. It comes later, in the design of the second product, and the thirtieth, and in the repair of the product (think Y2K), thirty or fifty years later. Solid engineering produces long term benefits, and a lack of an engineering discipline only becomes apparent when people start bitching about how the field is becoming stagnant, a complaint I've been hearing quite regularly about software design.

      --
      /t
  31. There are many "levels" of design by syousef · · Score: 2, Insightful

    Take something more tangible like a car design. If you lumped destailed descriptions of all the blueprints for the individual components in a nicely bound document without any overall design schematic how hard would it be for anyone to get an overall picture of how the car would look and feel?

    What if you asked your average customer to work out if they'd like the car based on these ideas?

    This is very much like what you're asking business analysts and users to do if you provide a source code listing and nothing more. If I was in charge of a project, and that's what you handed me after I gave you business requirements, I'd seek to have you removed from the project.

    --
    These posts express my own personal views, not those of my employer
  32. read the damn article by Anonymous Coward · · Score: 5, Interesting

    man did anyone actually read the damn article?

    He's not saying you don't do traditional software design work, or document. He's saying that if you compare the work that a software engineer does, it is equivlant to the design phase of normal engineering, not the manufacturing phase. That the program you deliver, is in essence, a completed "design" not a manufactured "product".

    When you roll out and install this "design" in the target environment, this is the step which equates to normal manufacturing.

    It's actually pretty insightful.

  33. Design paralysis by QuantumG · · Score: 3, Funny

    Does any other programmers suffer from the paralysis caused by "design staff"? For every project my company starts, someone inevitably gets assigned the task of "designing it". The result is a bunch of incoherent scribbles, quasi-UML documents and vague ideas that us programmers are expected to work from. When we ask for more detail we get an insufficient answer. When we just go ahead and use our own initiative the design dude will moan that we havn't done it exactly how he wanted us to. The whole time I feel like smacking the design guy in the face and saying "why don't YOU fuckin' code it?"

    --
    How we know is more important than what we know.
    1. Re:Design paralysis by MSBob · · Score: 1

      Your design guy is basically in a nice cushy job where he produces shit and can totally avoid taking any responsibility for the final product. Mostly because software design cannot be validated by an sensible means and the end result is that people tasked with doing nothing else but design software end up generating bullshit and humping the dog while coders are tasked with making it work and when it doesn't the pressure goes downwards not up. I'm also willing to bet that the design guy is good friends with some executive at the company. Quit your job because companies are typically very resistant to culture change. Where you are you'll always be overworked and under appreciated while they "high level design" fella will keep getting the praise and the bonuses.

      --
      Your pizza just the way you ought to have it.
    2. Re:Design paralysis by QuantumG · · Score: 1

      My technique is to do nothing and then complain at the weekly meetings that I don't know what I'm supposed to be doing. It's called learned helplessness.

      --
      How we know is more important than what we know.
    3. Re:Design paralysis by dubl-u · · Score: 1

      The whole time I feel like smacking the design guy in the face and saying "why don't YOU fuckin' code it?"

      Some of the worst code I have ever seen is produced by places that have 'architects' that sit around and pontificate rather than working directly on projects.

      I think that's inevitable. Taking your best programmers and keeping them away from the code is idiotic. In the short term, you're cutting the them off from all of the little details that the need to know what the right design is. And in the long run, you make sure their skills are stale and atrophied. And as a bonus, you imply that the rest of your programmers are drones, mere assembly-line workers. That's great for morale.

      More than once I have told a client that the best possible thing they could to is take all their architects and make sure they spend at least half their time coding with the teams they advise. And the next best thing would be to take away their power to issue mandates, so that they have to act like a resource to the people doing the real work, rather than just being a bloviating bureaucratic burden.

  34. I have to agree by studog-slashdot · · Score: 3, Insightful
    Having RTFA, I agree with Mr Reeves.

    We have ISO at my orkplace. The hardware guys have a sequence of steps of design and manufacture that are well laid out. Getting this applied to the software guys has been more difficult.

    One allowable thing is to write test apps to check out areas of coding that one isn't familiar with. This mimics the hardware steps of mockups and prototyping.

    Recently I wrote a network app for the first time. Once that experimentation/research was done, I had some useful info to add to the Design (text) Doc. Once I had this much done though, when the time came to "develop" (according to ISO) the developing consisted of nothing more than cutting and pasting my test app, and tweaking some parameters.

    I've been wondering about this for a while because it didn't seem right, that I must have been doing something wrong, but the article filled in the missing understanding.

    ...Stu

  35. Re:Free UML by Tony · · Score: 1

    I've not used them (can't stand UML myself), but I've noticed that Eclipse has some UML tools. Try this, for instance.

    Again, I have no idea about the quality of the plugin. Just one I've noticed along the way.

    --
    Microsoft is to software what Budweiser is to beer.
  36. Interesting by PepeGSay · · Score: 1

    He doesn't say what you would do different if you follow this approach though.. at least not that I can tease out of it.

    1. Re:Interesting by Zcipher · · Score: 1

      Extrapolating from the text, the main difference is that the top level design is a sort of rough outline of what you want, then you refine that, then you code it, then you document what you ACTUALLY HAVE, rather than declare your original design faultless and code from it regardless of whether there's a better way, cause heck, we already wrote all this great documentation for our infallible design!

  37. No! by Locke2005 · · Score: 1

    You just proved that the design isn't really the code, not that the code isn't really the design!

    --
    I've abandoned my search for truth; now I'm just looking for some useful delusions.
    1. Re:No! by Anonymous+Brave+Guy · · Score: 1

      [Double-clicks PowerPoint logo]

      [Clicks File]

      [Clicks Open...]

      [Double-clicks my_project.exe]

      This application has attempted an illegal operation and will be shut down.

      Nope, the code doesn't work too well as the design, either.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  38. The Microsoft Solution Framework by PepeGSay · · Score: 4, Interesting

    Upon reading this again... I realize that the Micrsoft Solution Framework really gets at this idea very well, while still being applicable to large projects. It also attempts to protect against "releasing demo code". It heavily advocates early and continuous builds with an ever expanding capability, so that the development is always *technically* at a releasable stage (within reason).

    Flame away for mentioning MS in a good light.

  39. How High is Sufficiently High? by handy_vandal · · Score: 2, Funny

    Given sufficiently high level languages (as appropriate for the app) this would be true.

    And God said, "Let There Be Light."

    God uses a very high level language: four words, and the hard work is done.

    -kgj

    --
    -kgj
    1. Re:How High is Sufficiently High? by agbinfo · · Score: 1
      God uses a very high level language: four words, and the hard work is done.
      Sure but look at how many bugs were generated.
  40. Observations by BigLinuxGuy · · Score: 1
    Hey, just because someone was wrong ten years ago doesn't mean that we can't keep recirculating bad ideas so a new generation can get screwed up by them.

    1. 60% (or better) of the total cost of a software system occurs after the initial deployment (read that as enhancement and maintenance)
    2. Most developers simply reimplement an application because there is nothing that documents how the application is supposed to work
    3. Many programmers are ill-disciplined
    4. Many programmers don't spell well
    5. Many programmers don't write well
    6. Many programmers don't know how to design
    7. Programmers who don't know how to design wind up going down a lot of blind alleys
    8. Many programmers choose cryptic names for variables, functions, modules to demonstrate their "kewlness"
    9. Many programmers think the above practice leads to job security
    10. Many programmers don't understand scalability, reliability, etc.
    11. Corollary to the above: Many programmers have never worked on a system larger than a single desktop
    12. Computer science curricula seems to gloss over requirements, analysis, design, and testing in favor of teaching languages
    13. Many programmers don't get the point that you can't bolt on performance or quality after the fact
    14. Many programmers don't pay attention in microeconomics so they don't understand how businesses work


    15. Nuff said.....
  41. Re:You want art, get some finger paints and play by chris_mahan · · Score: 1

    Is that why so few people understand regression?

    Just because your manager and the junior asp programmer can't understand the code and your explanation of the code does not mean it's not perfect for the job.

    If you want to make your boss happy, code something so wicked that it is already done by the time the design specs are out, so simple that it fits on a piece of paper, and so robust that its uptime will outlast you.

    Anything else, and you're not good enough as a programmer, so you'd better learn, and stick to the design docs. Remember the Unix Way.

    Do you think my boss understands SSL? or MD5? Should I not use them then?

    --

    "Piter, too, is dead."

  42. That's Just Wrong by GaryPatterson · · Score: 1

    But there are *very* few great programmers out there. What do the rest of the programming world do?

    There's room for great talent in coding, but if the cost is that the code cannot be maintained that talent itself becomes a business risk.

    If your boss can't understand your code, that's not really such an issue. But if you tell your boss that you are the only one who can now, or will ever be able to maintain that code, you will see a very different reaction to the one you seem to be expecting.

    Coding is not an art. It's a science. No matter how good the code is, it can be taken apart and understood by others. After all - it's written in a known language (unless you roll your own languages just to code an app). It's not in the realms of Picasso, but more in the realm of engineering.

    A final thought - there are many, many projects whose complexity makes the most detailed application or operating system look like a kid's crayon drawing. The engineers behind these projects put massive effort into developing them and making sure that everyone involved is crystal clear on what's going on. These sorts of projects rarely (if ever) fail. They're not art, although some approach it. On those sort of projects, a developer who couldn't explain what they were doing would be lethal, and would be sacked immediately.

    1. Re:That's Just Wrong by chris_mahan · · Score: 3, Insightful

      Writing is not a science, it's an art.

      You can codify writing like Heinlein, Herbert, Dickens and Rand.

      No matter how many average writers you put together in a room, you won't end up with the Dune saga.

      Complexity is the enemy of elegance and power.

      C, Lisp, python are so popular because they are elegant, simple, and thus powerful.

      It's not its complexity that makes a system great, it's its simplicity.

      Likewise Shakespeare.

      >Coding is not an art. It's a science. No matter how good the code is, it can be taken apart and understood by others.

      Likewise Shakespeare, Heinlein, Asimov, etc. Yet still art. Because while you can reduce it to 26 + punctuation, it's the organization in time and space that makes them unique.

      Great code just works, and nobody needs to go back and fix it later, because it's never going to be broken.

      If it needs to be modified, you say.

      I reply, why?

      Because it no longer performs the needed business function you say.

      I ask: And that means its broken?

      You say: No, it means it needs to do something else.

      I Reply: You mean, a different function?

      Exactly, you beam.

      I counter: Follow the Unix Way: Each program does one thing: What you need is another program.

      You slouch. You know I am right.

      Zen lesson over.

      --

      "Piter, too, is dead."

    2. Re:That's Just Wrong by GaryPatterson · · Score: 1

      Creating fiction is art.

      Creating code is not.

      You resist.

      You confuse the two.

      You make logical errors.

      You know I'm right.

      Your position is no longer defensible.

      Coding is not a solitary function unless you are doomed to small projects.

      You must yield.

      Consider the fish. Meditate upon its nature and discern the link between that nature and your programming.

      You must yield.

    3. Re:That's Just Wrong by chris_mahan · · Score: 1

      I make an interface for you, clear, concise, simple, powerful.

      Do you know if I program in php, python, or java on the back end?
      Do you know if I store my state in pickles, session vars, or in a bean?
      Do you know if I iterate using a fancy algorithm or via brute force?
      You do not.
      And you should not.

      If the service I provide to you never fails, and through much testing you come to the conclusion that the result is predictable and reliable, you just use my service, not needing to know the how or why.

      I care not what you do with it, I care not who you are, what you want.

      I create art by placing a node that alters the pattern of your program, and yet you know nothing of it.

      That is the unix way.

      As far as the fish, consider not the fish, but the stream. See stream and you will know where the fish goes.

      --

      "Piter, too, is dead."

    4. Re:That's Just Wrong by chris_mahan · · Score: 1

      Condescending are we?

      I shall refer you to book 5 of Miyamoto Mushashi's book.

      No more AC

      --

      "Piter, too, is dead."

    5. Re:That's Just Wrong by SoupIsGoodFood_42 · · Score: 1
      No. Programming is a science most of the time. Not many scientists are like Einstein, either. Put a large group of average scientists in a room, and that doesn't mean they would have come up with the theory of relativity. But does that make Einstein an artist? How about Pythagoras?

      If what you are doing has a precise purpose and goal, then it falls into the relms of design/science/engineering/etc.

    6. Re:That's Just Wrong by GaryPatterson · · Score: 2, Insightful

      I really can't believe this has been modded so highly.

      Saying that it should just work is great, but what does that mean when an OS is being developed, and what happens if it doesn't just work?

      What happens if circumstances change and the code needs to be modified to take a new situation into account?

      This philosophy ties the programmer to the code for life. That means you don't get promoted, you don't get to work overseas, you don't get much. And if you leave, the code will be replaced eventually, no matter how perfect it was at the time.

      Code is not an eternal thing. It is not timeless. If it were, your point would stand.

      I suspect there are a lot of developers on Slashdot who like to think they're artists, and that's why your posts are being modded so highly. You may be the best programmer on the face of the planet, but then your error is in assuming that every other programmer is as good as you.

      Art, however, can have the ability to stand apart from Time. A great work of literature, music, painting or physical movement can be enjoyed hundreds of years after it was created. Some are not meant to last that long, and their brevity adds to their enjoyment.

      Face it. Code is not timeless. All code will require updating or replacing at some future point. You're setting your code up for removal by writing something that only makes sense to yourself.

    7. Re:That's Just Wrong by johnjaydk · · Score: 1
      I counter: Follow the Unix Way: Each program does one thing: What you need is another program.

      Correct if it needs to do something completely different. But that question is trivial to answer. None of us would mod a sportsbike to double as a tow truck.

      The question really is: The program needs to do something slightly different (the business has changed) or a little bit more (business scope has grown).

      The lesson trivialises a complex issues. Code needs to change. Acording to Brooks 80% of the cost of code lies in this area.

      Parrent should be modded funny and/or redundant.

      --
      TCAP-Abort
    8. Re:That's Just Wrong by ggvaidya · · Score: 1

      Nice! Mind if I copy this post for my quotes website? (see sig)

    9. Re:That's Just Wrong by John+Allsup · · Score: 1

      Bad science is commonplace, good science is an art form. (Consider e.g. the beauty of general relativity or complex analysis vs. the junk science to satisfy a papers per year quota that you often get.)

      The same is true of code. Good code is an art form. Bad code is commonplace. And as the exception that proves the rule, very very bad code is, alas, also an art form.

      (n.b. by art here, I guess I mean the production of some kind of work with intrinsic beauty, whatever that means...)

      --
      John_Chalisque
    10. Re:That's Just Wrong by chris_mahan · · Score: 1

      Enjoy :)

      --

      "Piter, too, is dead."

    11. Re:That's Just Wrong by chris_mahan · · Score: 1

      An ice sculpture will be gone by morning, and yet is still art.

      A sand sculpture will be gone at next tide, and yet is still art.

      Look at the source code for Emacs. It's written in a programming language created in the 1950s. (1954?) Yes, Lisp.

      Now, 50 years later, Emacs is still considered by many to be the finest text editor in the world, and runs on the finest modern operating systems.

      Lisp the language, is art. It stands the test of time. It will outlast all of us most likely. In 200 years people will study the "classical" programming languages, and those that are around (and I bet C and Lisp will be in there) will be called art because they will have stood the test of time. Britney Spears, on the other hand, will most likely have been forgotten.

      --

      "Piter, too, is dead."

    12. Re:That's Just Wrong by chris_mahan · · Score: 1

      >But there are *very* few great programmers out there. What do the rest of the programming world do?

      Study harder.

      It's not complicated. Like piano and tai-chi: find great teachers, listen to them, practice, practice, practice.

      Did I mention practice?

      --

      "Piter, too, is dead."

    13. Re:That's Just Wrong by GaryPatterson · · Score: 1

      Your own examples prove my point. I did note that brevity can be part of art. Perhaps you shoudl re-read my post. But then you brought out your 'big guns'. eMacs was developed in the 50s. By your argument, this application should have had absolutely no changes since then. No modifications, no updates, no security patches, no alterations to bring it into line with modern operating systems. But that's not true, is it? The application, possibly perfect when developed, needed updates to run on other computers, in other operating systems. It had to be maintained. And yet your whole point is that a perfect app needs no maintenance. Give up. Code is not timeless. The best example you could come up with is fundamentally flawed. I have to agree with another poster earlier - you're being paid to write code. You should do your job well and write code that can be maintained by another programmer. Doing just the code is not doing the job.

  43. Maybe embedded systems are different by Anonymous Coward · · Score: 1, Insightful

    Sorry, I work embedded. Without some clue of what the physical interfaces are and are intended to be. Without some way of getting a system's engineer to be able to understand the code's design in the context of the hardware design, electro-mechanical components, etc, the code is useless, probably even dangerous. I'm not saying UML is the answer (actually, I believe it's part of the problem because it leads to lazy, incomplete definitions of the system), but some formal, reviewable (by folks other than other programmers) requirements and design product is crucial to a successful embedded project. Maybe the app engineers have an easier time just making pretty code, or maybe I'm not skilled enough to read-the-minds of the system's engineering folks.

    BTW: I can but hate reading schematics and VHDL to figure out what that damn FPGA does. Thank g*d for hardware engineers who write down what the registers are, how they work, etc. How do you think the system's engineer (or your QA engineer) feels about having to read your code to figure out what the damn firmware does, let alone what it's supposed to do.

    Worked on a project once where I was asked to update a broken power control system. I asked what the system had to do (i.e. what are the requirements and interfaces) and the answer was, "Well, we didn't and don't have time to write requirements and interface definitions down. Why don't you read the existing code to figure that out." Grrr.

    Folks, if you're going to do the "code is the design" thing, PLEASE don't write any safety critical software. Thanks.

  44. Literate Programming, Anyone by kap1 · · Score: 1
    Donald Knuth advocated something calle "Literate Programming" (see http://www.literateprogramming.com/). To quote from DK:

    I believe that the time is ripe for significantly better documentation of programs, and that we can best achieve this by considering programs to be works of literature. Hence, my title: "Literate Programming."

    Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

    The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that reinforce each other.

    The idea is that the code and documentation are written together and that you use a tool to "weave" a document from the source for a human to read and another tool to "tangle" that same source into computer compilable source code.

    I've written quite a few large scale C and C++ LP's in my time using the tools Nuweb and Funnelweb. Those programs I wrote are all still in use these many years later and maintained by developers many employment generations removed from me. Since moving into OOAD, I've gotten way from that practice, since the IDE's I use aren't really suited for doing Literate Programming. Maybe it's time to take another look.

  45. Question from a Newbie by jpcardier · · Score: 1

    I'll be the first to admit to not being a real programmer. But I love to read coding books, and occasionally hack something out.

    I read the fine article. According to the Pragmatic Programmers, one of the first principles of good coding is: DRY or Don't Repeat Yourself. In other words there should only be one primary, authoritative version of the data, and all others should reference it.

    Now the article seeeemed to be arguing that the source code should be that primary source. The other folks here feel that UML or a design spec of some sort should be the primary source.

    Should the code meet the spec or the spec meet the code? The Pragmatics believe that you should have a method for generating code and documentation from the specs. Is this truly doable?

  46. Only if you were already old by bluGill · · Score: 1

    True, but you don't work there anymore. In fact I know very few people who work for the same company for even 10 years. In that time they often work on several different projects. Then the company hits the down side of the cycles and lays them off.

    If you want to be stuck working on the same code all day, everyday, code that only you have a hope of understanding, be my guest. I don't want to do that though. I have enough trouble figuring out what I was thinking yesterday when I write readable code, much less intentionally unreadable code.

  47. i think in uml therefore why draw it by cheekyboy · · Score: 2, Interesting

    I can visualize lots of code/processes as UML type
    diagrams, but I see spending 4hrs drawing some crap as a waste when I could have completed the code by then.

    I tend to write my code as nice as possible that even a drunk coder could understand it.

    I may code up stuff fast with out UML diags, but if people/others need to maintain it, doing a high level UML or layout diag is easy enough to do on demand. Somethings are sometimes too easy to comprehend so id rather not waste hours doing fancy diagrams putting me to sleep.

    Try imaging the UML diag for just IE, I bet theres a high level one, but not one down to each class/logic IF statement.

    If UML is soooo important ,then perhaps it should be part of an IDE, when you hit NEW PROJECT. Do away with source files and include files and have the whole source in a database with each class in each 'file' or 'table', but do away with files as such, just make em transparent.

    --
    Liberty freedom are no1, not dicks in suits.
    1. Re:i think in uml therefore why draw it by stonecypher · · Score: 1

      If UML is soooo important ,then perhaps it should be part of an IDE, when you hit NEW PROJECT.

      I believe the first such IDE showed up in 1996. It's always helpful to find out whether something exists before opining that it doesn't, especially when it's potentially ten years old.

      --
      StoneCypher is Full of BS
  48. Creative...process. Yep. by nsaneinside · · Score: 1

    You might recall the play-within-a-play from Midsummer Night's Dream, Pyramus and Thisbe.

    This ancient story was written long before Shakespeare's time; one might note, too, the striking similarities that Romeo and Juliet has to it.

    I find it hard to not question our favorite playwright's sources of "creativity"... Plagiarism, no. But let's give credit where it's due.

  49. Apply this logic to other fields... by Money+for+Nothin' · · Score: 1

    House-building: The wood and glass structure is the design!

    Car building: Just slap it together - it's faster and cheaper than actually having an engineering diagram!

    Financial planning: Forget about planning for retirement. Just save your money however seems to fit best! Your life's finances *is* the design!

    Building a Wintel box: Don't research hardware incompatibilities beforehand - just put the parts together and see which ones work!

    I've heard a quote that goes (paraphrased) "if you can't keep the design in your head, you're not qualified to be a developer." I think there's some truth to that.

    But there is still a design involved in that theory, and I've worked on a couple projects in which a written, documented design, although probably not necessary (they were relatively-simple (about 5,000-6,000 LoC) projects), still proved to be useful occasionally. Mostly they were there to please management, but nonetheless, they weren't worthless.

    Were they worth the time I spent creating the designs? Hard to say...

    In general though, I think design documents are useful, if for no other reason than to be able to more-clearly explain what it is you're doing to people who wouldn't otherwise have a clue (read: management, your family, etc.)...

  50. Pathetic by pkesel · · Score: 1

    The fact that this can even be entertained as a rational suggestion is all the evidence necessary to conclude that the software industry is not about providing long term viable solutions to real business problems.

    Robust, maintainable, well-behaved software that will stand the tests of time and budget CANNOT be arrived at by a PROGRAMMER. A PROGRAMMER will not acknowledge that there are more meaningful measures of design value than a nice algorithm or the latest industry buzz words.

    --
    - Sig this!
  51. Picasso counter example by Gorimek · · Score: 1

    I actually met the guy who did the Picasso painting on the WHO head quarters in Geneva. And he was not Picasso.

    As it turned out, Picasso could and did provide him with a detailed explanation of what to paint.

    I realize this has no real bearing on your actual point, but still...

    1. Re:Picasso counter example by chris_mahan · · Score: 1

      Interesting...

      --

      "Piter, too, is dead."

  52. It's all about the Billrate by PimpDawg · · Score: 1

    The billrate is my design. If I can pocket $70/hr doing UML, while some punk jockey H-1B coder monkey gets $20/hr for implementing my design, I'm pretty happy about that. I design, the H-1B codes, one year later I move on while the team gets outsourced to India.

  53. Software Design Still Hard, News at 11 by Greyfox · · Score: 2, Insightful
    Back in the day you did flowcharts or pseudocode to get a good idea of what you wanted the computer to do before you put card to keypunch. Today you do UML or pseudocode to get a good idea of what you want the computer to do before you start coding. Oddly, despite the new "paradigms" and "methodologies," project failure rates seem to remain constant.

    Over the years, management has attempted to quantify software development. They've pointed to the visible tools of the trade, the flow charts and the UML, and a lot of them have mistaken that for the process of designing software. In fact the only thing that you really need to design software is an understanding of your customer's requirements (Or your requirements) and the know-how to turn that into a working system. Unfortunately that's not quite so easy to quantify, and so most management types ignore those traits in their programmers.

    The folks who are always going on about six-sigma and CMM level 5 always seem to be stumped as to why they can't just give a chmpanzee a UML generator and churn out working project after working project. Turns out that despite all efforts, software design still requires you to think about your problem and how to get from where you are to where you want to be. Go figure.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    1. Re:Software Design Still Hard, News at 11 by sapped · · Score: 1

      The folks who are always going on about six-sigma and CMM level 5...

      We are currently chugging our way up the CMM scale (just moved from 2 to 3). Quite honestly, I would like to take the people that thought this idea up and lay them flat on the ground. Then I will pile all the paperwork they have generated for the last three months on top of them. I suspect they will not make it out of there alive and the world will be a better place for it.

  54. Literate programming by RoboProg · · Score: 1

    Don't write the documentation and the code in separate platforms.

    Doesn't fly well with managements love of chartoons and MS-Office, though.

    Alas, the typical development organization is not composed of a bunch of Donald Knuth-s.

    [/flog horse="dead"]

    --
    Yow! I'm supposed to have a plan?
  55. Moron Programmers by agbinfo · · Score: 1
    The real problem is that genius just isn't very scalable. Ten moron coders[1] who catch mistakes only half of the time will still collectively produce better results than a lone genius who is 99% accurate. (If we assume the morons find bugs independantly, the odds of not finding a bug are (1-(0.5 ** 10 ) ) = 99.9% accuracy. The genius is "only" getting 99% accuracy working alone himself).
    Morons will find the obvious bugs sure. They will even tend to find different bugs - which makes the average go up.

    On the other hand, they won't know how to fix the bugs; They will add several lines of code to kludge the problem when all that was required was to remove a line; They will create side effects which they won't know how to test and therefore create even more bugs. Moron programmers will also cut-and-paste the same lines of codes instead of writing a new function; They will make every method and every attribute public to make sure you can never figure out what the API is; They'll comment out old code instead of removing it so that you can have a history of every line that was ever written into a file; ...

    Senior programmers shouldn't have to write "down." I agree that they shouldn't use "clever tricks" either but they shouldn't have to unfold for-loops and stop using callbacks and design patterns just because some moron doesn't understand them.

    Also, junior programmers are not moron programmers. Moron programmers remain moron programmers until they leave or until they get promoted.

    Be careful! If you keep enough moron programmers around, your junior programmers will tend to program like the morons.

    1. Re:Moron Programmers by agbinfo · · Score: 1
      Agreed.

      As I said in my post, I don't believe that programmers at any level should use "clever tricks."

      I also think that people should not confuse good programmers with programmers that can write fast code using bit-wise operations, and asm() instructions.

      Anybody can write code that's hard to read. The good programmer's code will generally look like it was easy.

      This is why I objected to your argument that 10 morons can do better (or equivalent) to a good programmer.

      My experience has shown that a job that can be done by 5 good programmers in 5 months will usually take 10 poor programmers 10 months. As a side benefit, the good programmers will generate reusable components as well as maintainable and testable code.

      By the way, the reason I am going through the trouble of making these clarifications is that too many people actually believe that you can replace good programmers with poor programmers if you have coding standards and a good process.

      Finally, I can't speak for the ggp but I believe that s/he was making the argument that when one is well versed in English literature, one will not need a bunch of comments in the margins to explain the most basic meanings. Similarly, if a programmer creates a structure with two floats called r and i and names the structure 'complex', then comments explainling that r stands for real and i for imaginary are simply wasted. On the other hand, if the ggp's intention was to excuse obfuscated code then I believe that s/he is wrong.

  56. This is how I do it by carnivore302 · · Score: 1

    The code is the design is just as worse as UML everything to death. What I have found to be the best approach is something in between: Just use a regular word processor to write a document stating the intentions of the program and for any complex data types the reason they are there and how they interact.

    Simple, and it doesn't cost a lot of time. Do most of it upfront, and you have already thought out most of your design. Implement it, notice that you need to modify it slightly and just update the documentation accordingly.

    I have found that using this approach almost anybody can understand what is happening in a program. Not to mention yourself when you revisit the code after a half year break.

    --
    Please login to access my lawn
  57. coding by timmarhy · · Score: 1

    i've alwyas maintained that if you can't code anythign yourself, then your going to suck with anything like UML or or design software. it's the same mistake managment makes. sitting up there completely oblivous to what's really happening or how things are actually done

    --
    If you mod me down, I will become more powerful than you can imagine....
  58. [OT] Sir William by Anonymous+Brave+Guy · · Score: 1
    Sir Wm. Gates

    As an off-topic aside, he won't be "Sir William", but rather "William Gates KBE". In today's enlightened global family, you're only allowed to be "Sir" if you're from a Commonwealth nation. Go figure.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  59. Variation by willCode4Beer.com · · Score: 1

    Lately, I've been taking your technique one step further.

    During design meetings, I code up the interfaces (Java) and maybe some abstract classes to tie things together. Code, even non-functional code, gives a good validation of the design. Its also easier for other developers and myself to visualize the design with code.
    If anything is unclear, or we debate some detail, its easy enough to write some simple implementation classes to test these ideas.

    A benefit of this technique, it ensures everyone is coding to interfaces instead of classes. This keeps the code simpler and easier to test. At dev time, you just have the developers grab an interface and implement. No one gets assigned to a task that they are not starting immediately. If we bring in other resources, they don't need to understand the whole project. They can simply work on a component.

    At the end of the meetings we reverse engineer (using the tool in WSAD) the interfaces and abstract classes into UML diagrams for the PHB's. I've found most UML tools slow and unwieldly to use. For me anyway, its just much faster to code a skeleton and generate diagrams from it.

    --
    ----- If communism is a system where the government owns business, what do you call a system where business owns govern
  60. Clean-up code by Anonymous+Brave+Guy · · Score: 1

    Blockquoth the AC:

    Mid function returns are evil, causing duplicated or worse, skipped, cleanup code.

    If that's a problem for you, either your programming language or your knowledge of it is insufficient. Learn to use destructors/finally blocks/macros (real ones)/whatever the resource management idiom is in your programming language of choice.

    Many modern systems need this sort of architecture whether you allow explicit early returns or not, because of the potential effects of exceptions, parallel processing, etc.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  61. The point is that the source is a design by StrawberryFrog · · Score: 1

    there are thousands of F-16s out there.

    And there are more than thousands of running Linux kernels other there. The point of TFA is that you can build a new program any time. Just copy the executable. The source is a design for that executable.

    Imagine describing the F-16 to "anybody", and expecting them to come up with the design for a new fighter jet. That's the equivalent of describing the source, and expecting its techniques to be applied in a new program. You'd have to be some kind of engineering Picasso to do that.

    --

    My Karma: ran over your Dogma
    StrawberryFrog

  62. Debugging Reality by handy_vandal · · Score: 1

    Sure but look at how many bugs were generated.

    "Those aren't bugs -- those are features."

    -kgj

    --
    -kgj
  63. No current language is up to the task by p3d0 · · Score: 1

    I have yet to see any programming language that can capture design concepts. Eiffel is probably closest. For every other programming language, the design would have to go into comments.

    --
    Patrick Doyle
    I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  64. Check Out My Website by pyroboy1080 · · Score: 1

    My Website (bear with me, it is still a work in progress...)

    1. Re:Check out my website by p3d0 · · Score: 1

      It says "Please Login".

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  65. Check out my website by pyroboy1080 · · Score: 1