Programming tactics
Well The idea of this topic is to get a wide spread on how people think abstractly on there thinking process when it comes to programming. This gave me the idea when i watch the movie the Social network. How they sit down on a computer and say they are "wired in." That was there tactic. In my opinion it was a very inspiring movie and maybe i will get there. Well lets not get carried away now. Now getting back to the main topic.
When i start to approach a topic to start programming:
- I sit down and write down on a piece of paper what my objective is and what i want it to do.
- I think of different methods on how i should program it because there is no one way to programming.
- I sit down for quite some time trying to code this ting.
- Take breaks because my brain gets fried.
- Get back on to it.
Now my tactics are not all sufficient to everyone else. Some people say how i plan or decide to do something can be more difficult than others. Now this topic can go very broad on how in-debt you want to explain your tactics. Just want to get a general idea how how people go about there programming tactics.
- Get the idea for the program/game to create.
- Start drawing up some diagrams and thinking of the classes I want to use, as well as the design patterns to implement.
- Write some code
- Evaluate code and redesign as needed
- Carry on
- Back to 3 until finished writing code
- Optimize code.
That's about it for me!
The systems/software engineering way for a complex application would be to do the following:
-
Draw a tree diagram of the system and subsystems (What the program performs overall and what its individual processes/algorithms are) This is known as the top-level design.
-
Split those sub systems in to what a system engineer would call a set of modules and components.
I suppose if you were thinking along the lines of any C type language, the "modules" are close to writing all the function prototypes or class prototype (C++) The "components" are really the individual function definitions (IE the code to carry it out) Obviusly, think about any inputs and outputs and what those are likely to be and note them down on the block diagrams or along side.
- Then to implement it, you simply work from the bottom level upward. Since you've drawn out the diagrams you can verify each individual module/subsystem at various stages.
This method exploits the use of abstraction at various levels which makes it easier to understand the program flow overall right down to the code that carries it out. This method can be overkill for a trivial program, and is really only useful when you have a large application and a team of developers/engingeers.
===
However, I've never really had to write something that has required the previous method - if it were a professional piece of code I would use it since you can sit that right next to the client specification.
The way I go about proogramming is to:
-
Let the idea(s) develop in my head and think through all the stages it must complete, note them down in a text document. Usually interaction between functions, whether a class or set of structures are best. At that point I will often decide which language is appropriate for the task - depending on factors such as speed of execution, ease of programming and whether I am doing it as a learning exercise in that language.
-
Then I will think out the code in that language - Will it need any 3rd party libraries? (or write from stract) What WinAPI functions will help with (blah)?.
-
Then I open a text editor stick down all the ideas, maybe type out a basic program flow or just layout the program in the target language so that there is a framework.
-
Write the code. If things are not working out or I come accross a logistical problem I will often make a second copy and experiment with another method. Sometimes, I will see if another language maybe beneficial for simplicity of implementation (as a model) then return to the language I wish to write it in.
-
If there is any strictly unnecessary code/variables I will then remove them (usually where I've stuck it in for debugging purposes). Simplify any code that is wasteful - for example, where I may have used multiple loops just for clarity of implementations' sake where one could be used…
Jim,
- Brainstorm
- Refine
- Prototype
- Solution
- Support
Brainstorming ideas comes in many different forms. From writing down every idea that pops into my head, to talking with friends, and epiphany's in the bathtub.
Once I have an idea I refine it by writing up requirements documents, making charts, graphs, and thinking out the finer details of the application.
Now that my idea is refined and I think I have most of the details worked out I will prototype my application. Often using a scripting language like Python I can create a full mock up of what my app will do. Sometimes however I only create and test certain features of my application to get the idea of how to implement them. During and after this phase I may go back and refine my ideas some more depending on the results of my testing.
When I am confident that I can implement features of my application and my idea has been well thought out I will begin a more stable development of my application. Often using a more production quality language, and organizing my source code into a project is enough. I may also create a repository online for team development.
After an application is released and considered stable development may continue , users may require help using the app, and developers may need documentation for your code. It is up to you what, if any services you provide for supporting your software. I at least make my email available for users or developers to contact me. I make my best effort to get back to anyone who mails me.
- Think about it
- Do it
Repeat as necessary.
Optional steps inserted wherever you wish is: not sitting around doodling unstructured random ideas like a fucking third grade kid trying to write a story for class. Personally I very much enjoy this step since if I am to program something, I first, you know, know what the program is meant to do…
Meh, it depends on the complexity, but generally it's something like this:
- Pick a method
- Layout the basic code
- Code
- Test/Fix errors
- Repeat 3/4
I sort of "wire in", depending on the time of day. If it's late, I typically just throw some headphones on and code like hell. During the day I take breaks for stuff like checking the news or playing some games.
- Just start coding/copying the Utils class and the main class, form or menu which I always have.
- If all is easy and well continue coding. If not then take a piece of paper and draw the problem (usually path-finding and such or matrices ARGH)
- Continue programming.
- Drink enough water (If not I'll regret it at the end of the day)
- repeat step 3 and 4 unless: >> I go ZzzzZzz and brainstorm about any possible solutions for the unsolved problems. >> I remember that even a programmer requires food. >> I want to smash the PC trough the wall (idclip?) because the code just doesn't work. Usually taking a short break helps and then I just see the mistake after 30 seconds.
- (may be weeks or months later) Re-factor the code and being silently embarrassed about how many optimizations can be applied.
Or in a more professional manner: 1: Proof of Concept 2: Implement the skeletal structure (menu's or classes depending on the type of project). 3: Create the library with lots of debug code and unit testing 4: Create the actual project's main code 5: Test 6: Test more 7: Test even more 8: Add error handling and logs and the credits section and so on. 9: beta 10: RC1 11: Making sure to skip writing any documentation or convincing the project manager that there is no need for any documentation because the code is so 'clearly written' and the 'GUI is so user friendly' :happy:. I HATE that. No documentation also makes me more valuable :D
As autistic as I am, I spend 95% of my time designing an architecture, without breaks, unless its a gigantic project which takes multiple days, weeks, months.
After that, I just write all of it out.
– I draw the architecture/design pattern out on papers, so my desktop looks like this.
Not even going to mention my room.