• Recent Tutorials

  • Application Planning & Design - The quick 101

    This example necessitates your program broken down into blocks which I like to call a module. If you consider that a module does one specific task (in the OOP philosophy) each module has to talk to its other modules in order to perform more complex tasks. Eg. Your cells work together to keep oxygen in the blood and the blood flowing to keep you alive (no offense to androids or aliens out there).

    A flow chart/spider diagram (mind map as some people say - I have no idea which is correct). To illustrate, here is a picture of a map I had to do to make my life so much easier when dealing with the Prometheus rewrite: its modular and shows what module depends on what other module:



    From that image alone I can tell one thing - the first thing I will be working on will NOT be PM_Window. Why? Because for that to happen I need PM_X11Window, PM_Event and so on. If I draw up PM_Window and I say I just need a few variables, then arrive to write the PM_X11Window module and find that for that to happen I need a more complex, unimplemented datatype. Or worse, I start work on PM_Window and write it up. In the process, I find I need a common module like PM_Debug, so I quickly write that up too. But after I write up PM_Window doing so I find it clashes with procedures from PM_Utils (No, that actually happened). I must now tear up PM_Window to fix this because PM_Debug needed to talk to other, non WM related modules. Before you set out making stuff, at least know how it fits together...

    Comments 11 Comments
    1. LP's Avatar
      LP -
      Can you please modify my quote in the article to something less cluttered like this:

      Depending on the project type, there are different Software Development Philosophies. If project is done in smaller teams, one of Agile Development techniques can be used. Some common architectural solutions are described as Design Patterns. There is also a book with the same name.

      There are several code refactoring techniques that should be used to improve the overall quality of the code. In this topic, take a look at Quality Attributes and Non-functional Attributes that should be taken into account when developing the project.
    1. paul_nicholls's Avatar
      paul_nicholls -
      Hey Ben, that attachment didn't work in your "What goes where and how?" installment of this article so I can't see the image...
    1. code_glitch's Avatar
      code_glitch -
      @Lifepower: Sure thing
      @Paul: Might be from when I had to transfer it into the right section, I'll see what I can do.
    1. SilverWarior's Avatar
      SilverWarior -
      If you think that you examples of Application planning with the help of paper and pen will convince other in using similar methods I'm afraid you are mistaken. Why? Most pepole who ever created any computer game or have strong logical sence would come up with idea of that complexity in a few minutes and thus won't even bother writing it down.
      But when doing real planning the rough plan would look like something like this:

      1. Check if the game is already running (using mutex or similar method). If it is running notify user about that with a message and later close second one or make sure that the already running game is shown and then close second one. If the game isn't already running continue to step two.
      2. Load the esential libraries needed for graphic interface and sound system. Also if your game has support for joysticks, gamepads, and some other hardware load neccesary libraries for those to.
      3. Load settings
      4. Create a window and initialize a graphical engine.
      5. Initialize sound system.
      6. Initialize control system.
      6.1. Show main menu. For this use a gamesteate property.
      6.1.1. Alow user to browse trough other submenues of the main menu (ingame options, credits, etc.)
      6.1.2. If a user selects a new game start game initialization proces. Show a loading screen here.
      6.1.2.1. Initialize necessary classes and records
      6.1.2.2. Load predesigned map or create a random map
      6.1.2.3. Create necessary ingame objects (characters, buildings, etc.)
      6.1.2.4. Hide the loading screen and draw initial state of the game.
      6.1.2.5. Start the game loop
      6.1.2.5.1. Check fo player input.
      6.1.2.5.2. Proces game changes, based on player input and other variables and game procedures. This proces can be divided into multiple subsections based on the game design.
      6.1.2.5.3. Draw game graphics
      6.1.2.5.4. Play necessary game sounds and music
      6.1.2.5.5. Fire some special effects (force feedback etc.)
      6.1.2.6. When the loop ends free used ingame objects
      6.1.2.7. Unload maps
      6.1.2.8. Free unneded clases and records
      6.1.2.9. Show main menu again. And continue with main menu code.
      6.1.3. If player selects load saved game, then do similar as in new game but instead load initial game data from savegame file
      6.1.4. If player choses Exit start with game closure procedure
      6.1.4.1. Unload input controlls
      6.1.4.2. Unload sound engine
      6.1.4.3. Unload graphical engine
      6.1.4.4. Free rest of the application's resources
      6.1.4.5. Terminate.
    1. code_glitch's Avatar
      code_glitch -
      @SilverWarrior: Thats exactly the problem, I average around 94% on exam scores involving logic as a fundamental (chemistry, physics, biology, maths etc) - I NEVER used to think planning everything like that was needed - I just HAD the idea.

      BUT, consider the number of individual statements in the following:
      Code:
      1. Setup the appropriate sound & video environment for the OS and its specific setup & HW
      2. Load your config file and ensure it all works
      3. Process input, take action and etc
      You get the idea
      Even where you say
      Code:
      6.1.4.3. Unload graphical engine
      You could still be looking at a few dozen lines. Having that plan in my head as well as my code is just a tad unnecessary. Brushing your teeth is not hard, neither is remembering an essay, combine the two and its quite hard - and try it while you drive: now thats a proper challenge for us people with 4 limbs. Kids, please don't try that either at home or on the roads
    1. SilverWarior's Avatar
      SilverWarior -
      That is the most comon problem in newbe game or appliction developers. They have a great general idea but don't have the necessary knowledge about what all needs to be done to make that general idea a reality.
      I myself am full of general ideas and have ended with many unfinished projects, becouse I never figured out what all is needed to make that idea a reality.
      Now I'm slowly beggining to understan all of this. And since I'm a pasionate gamer I learned alot just by observing how games works. While most pepoles see games just as bunch of graphics and sounds I look at them compleetly differently. I don't se graphics I see sprites or 3D objects, I know that there are complex mechanich behind every game, etc.
      Actually I never looked at games or at other applications as most of the pepole does. I always knew in a whay that they are formed from various parts (buttons, functions, etc.). That's why I started programing, becouse I wanted to learn exacly what is going on behind the scenes.
    1. LP's Avatar
      LP -
      Quote Originally Posted by SilverWarior View Post
      I myself am full of general ideas and have ended with many unfinished projects, becouse I never figured out what all is needed to make that idea a reality.
      Actually, this is common especially in the most ambitious projects. Sometimes even trivial projects with minimal requirements end up being very large and time consuming, not because of lack of planning but simply because of time underestimation being very common among even the most advanced developers and engineers.

      This subject is more of philosophical nature and in this context, there is a work Unskilled and Unaware of It. The idea is that the more you know about some subject, the more accurately you can estimate your own knowledge of it and vice-versa: if you know little about some task, you'll most likely overestimate your own skills on this task. In other words, the more you learn about something, the more you realize that you actually know very little about it.

      There has been a related work (unfortunately, I've lost this reference) that mathematically proved that if you consider yourself above the average in certain knowledge, probabilistically it is more likely you *are* the average.

      There was another very interesting research, although I've lost this reference as well. The idea was that you need to dedicate fully at least 10 years into one specific area to become master of it (btw, if someone has reference to this paper, *please* let me know).

      To resume, keep working on projects, even if they are unfinished, learning how they are done and never stop at this task; in ten years you'll most likely succeed.

      There's one quote related to this phenomena of having many unfinished projects. When they asked Edison, what it felt like to fail 1,000 times to invent the bulb, he replied that he did not fail 1,000 times, rather than he found 1,000 ways how it should not be made (or in other contexts, that the development of light bulb involved 1,000 small steps).
    1. code_glitch's Avatar
      code_glitch -
      @LifePower: If you ever get the chance, perhaps take a look at a book called 'Dreaming in Code' or http://en.wikipedia.org/wiki/Dreaming_in_Code for a quick rundown. Quite a good read, follows the development of the Chandler program (time management software). It covers quite a lot of the morals of planning and time management on software development.
    1. LP's Avatar
      LP -
      Quote Originally Posted by code_glitch View Post
      @LifePower: If you ever get the chance, perhaps take a look at a book called 'Dreaming in Code' or http://en.wikipedia.org/wiki/Dreaming_in_Code for a quick rundown. Quite a good read, follows the development of the Chandler program (time management software). It covers quite a lot of the morals of planning and time management on software development.
      This definitely seems like an interesting book, thanks!
    1. LP's Avatar
      LP -
      Just wanted to add something to this discussion, there are some concepts that you may find interesting. Contrary to Design Patterns that I have mentioned earlier, check Anti-patterns. Also, for indications of a problem in the software check for Code smell.

      Other pages that you might find interesting are Programming rules of thumb and Programming principles.
    1. code_glitch's Avatar
      code_glitch -
      Looking quite good, and for those who want to know about my next article, I am working on it - and its a tantilising one! All I will say for now is that its targeting a very popular linux and how to get your libs running on said platform . You'll have to wait and see what its all about , development and writing is on the slow right now courtesy of mock week and me having to sit 6 hours + of exams every day
Comodo SSL