• Recent Tutorials

  • Application Architecture Design AKA The program planning stage

    Now, Geoff was no slacker, he wrote a final 400 line client and 1250 server: very respectable. To achieve this it took him 4 hours of work going forwards, however he lost many times that going backwards, testing compatibility and re-writing badly planned code! All in all, it took him twice as long to finish what he thought was a simple one day project. Why?

    If Geoff had taken a little time befire he started reading some documentation and sketching out some flow diagrams and application structure diagrams, like how the threads run in parallel to what, what sockets do what and how his special protocol would send/recieve data would only take 30 minutes and ultimately save him a rewrite and re-adjustment of his application - a one day task involving over 900 lines of lost code.

    Please people - plan! In truth, I have many projects, maybe even more than a dozen, that I have never completed - yet are so close to fruition - they are not flexible and badly planned. The final result was a botch job that barely works, that pen and paper may be low tech and while others may start coding dozens of lines before you - that pen and paper lets you write to what is on your planning page and work KNOWING that what you code will work right first time, bar a few bugs form human error, but you will finish - fast, and you'll avoid a world of confusion.

    If you can - enter Ludum Dare 48h, and timelapse yourself working. Then look at your product and your timelapse. Find the winner and look at their product and timelapse - I'm willing to bet they didn't rewrite the same thing twice, leave the desk for 6 hours out of frustration, desperation and general hate at their project before coming back to a botch job...

    Remember, don't think you're doing the right thing - know you are. Otherwise its stinging nettles and brambles. A world of hurt.

    Next time: Planning suggestions, a quick 101 on how to be the invisible code architect...
    Comments 9 Comments
    1. paul_nicholls's Avatar
      paul_nicholls -
      Nice little story Ben, it was a fun read

      Talking about flowcharts...there is always Diagram Designer:

      http://logicnet.dk/DiagramDesigner/

      Completely free, and open source to boot!

      cheers,
      Paul
    1. Chesso's Avatar
      Chesso -
      I'm not a big fan of planning either, and I especially hate flowcharts (they use them at work for diagnosing electrical faults on the railways, but who can carry safe working, tools, safety gear, rule books and flow charts everywhere lmao).

      If it's a big project you obviously need some sort of planning, miss-planning under a thousand lines of code is nothing, try 90000 lines and you didn't write it, now that is a lot of fun to fix lol.
    1. LP's Avatar
      LP -
      In this matter, if you want to do professional development, I would recommend taking some software engineering courses, although you must be careful about the institution selection as there are some outdated and some new topics in this area.

      In the examples you have mentioned, they all seem to correspond to Quick and Dirty approach. However, there are other philosophies available.

      If you have are working alone or have small teams, I would recommend adapting some sort of agile development techniques. Also, remember not to reinvent the wheel and use design patterns, apply refactoring often and always take into account quality attributes, and non-functional attributes when designing your software.

      I think calling "Applications Architecture Design" the "Planning Stage" is highly inaccurate. The planning stage usually involves specifying software requirements, after which the design phase is specified. Software Architecture is a wide topic that can be interpreted differently in different contexts. I personally would call it a high-level representation of your project that exists during entire development process.

      It is a common mistake to think that making some diagrams constitutes the planning, design and/or other stages: it's actually only small part of it and sometimes even optional.

      P.S. In our own game studio we use some of the practices from extreme programming approach, focusing on iterative prototype development and refinement, and we rarely use diagrams per se.
    1. code_glitch's Avatar
      code_glitch -
      Wow, lots of feedback! Great!

      @Paul: Thats quite a nice find (Thank god it works under wine, although what doesn't these days?) I'll definitely include that in the follow-up which I hope I'll get time to write soon.

      @Chesso: I just thought of this example after my recent entry into networking and that it would be near perfect. I usually stick by a rule of thumb that if theres more than 2500 lines to it, it really deserves to be in its own unit Beyond that, the object browser becomes counter productive in the time it takes just to look for which type/class that function is in...

      @Lifepower: I think you will find that theres' a lot of 'quick n dirty' happening at this period of the digital age, after all, when one gets down to the basis of an 'app' like you find on android/the iPhone - that is effectively a quick and dirty solution to writing a better OS that has that functionality built into it. Thats a lot of links for me to digest there, I never learnt programming philosophies - I just had something to do and tried to do it best I could with my knowledge at the time. Its only from experience I found that some approaches worked better than others (or not at all).

      I just thought I might share a 'this could happen' scenario with what could be a new(er) programmer. I'll make sure I include those links in the follow-up too.
    1. LP's Avatar
      LP -
      Quote Originally Posted by code_glitch View Post
      @Lifepower: I think you will find that theres' a lot of 'quick n dirty' happening at this period of the digital age, after all, when one gets down to the basis of an 'app' like you find on android/the iPhone - that is effectively a quick and dirty solution to writing a better OS that has that functionality built into it.
      I'd speculate that OS on Android and iPhone wasn't developed using quick'n'dirty approach, but who knows.

      However, I think mobile operating systems such as those on BlackBerry and Android were developed quite intelligently - using minimal hardware-dependent implementation and a virtual machine with the rest of functionality made in Java, so for a new hardware you don't need to redo everything.

      Quote Originally Posted by code_glitch View Post
      Thats a lot of links for me to digest there, I never learnt programming philosophies - I just had something to do and tried to do it best I could with my knowledge at the time. Its only from experience I found that some approaches worked better than others (or not at all).
      I think on game development sites, especially mainstream ones like gamedev.net there is still little information about software engineering, even though the process of game development is built around an actual software product.

      My suggestion for taking courses was for everyone who wants to make the development more efficient. This is easier than learning this topic by yourself as it can get quite bulky and even boring. However, for people of all ages that don't mind putting their pride aside and learning something new, it could be a great investment. I myself am taking two courses on CUDA given by Nvidia specialists next week, even though I already had CUDA apps running and have read several books on this topic; it is still an opportunity to strengthen the knowledge and experience.
    1. code_glitch's Avatar
      code_glitch -
      Any idea why Nvidia has decided to slave on with CUDA over OpenCl?
    1. LP's Avatar
      LP -
      Well, my first guess would be that CUDA is developed by Nvidia itself, while OpenCL is an open standard. They have done it before with CG vs GLSL/HLSL. It also happens that in our game studio we have 7 Nvidia video cards, 3 Intel and only one ATI video card, so CUDA is the way to go. In any case, my interest in CUDA is mostly for research, but this is an off-topic.
    1. code_glitch's Avatar
      code_glitch -
      Fair enough. From my brief look at CUDA it looks like a battlefield to get rolling in. Anyway, best of luck to you and your CUDA code.
    1. Ñuño Martínez's Avatar
      Ñuño Martínez -
      (...)I have many projects, maybe even more than a dozen, that I have never completed(...)
      Man, this is sooooo... familiar to me.

      And yes: the only projects that I finished are those that I planned.