Subscribe to RexGrammer's Closed Loop World        RSS Feed
-----

The ways to approach a problem

Icon 1 Comments
Just the other day I've realized that there are only two ways (at least that I know of) to approach a problem in programming, or any other field of study for that matter. That two ways are:

  • The empiric way
  • The analytic way


They differ in many things and have so much in common. There isn't a 'better' way nor a more 'appropriate' one.

The empiric way is an experimental approach. You write some code (most of the time with some errors) and then you correct the errors, add more functionality to your program, make your code more efficient, etc. etc. In other words you whip us some test code, and then you iron it out. There are a few pros and cons to this approach:

Pros:
  • Quickly create effective code
  • Small amount of effort
  • No planning required
  • The only planning is done while writing the code


Cons:
  • Can't use this on big projects
  • Some errors will probably be present in the first try
  • No way of knowing if that's the best design
  • No overview of what you're doing and what are your goals


You would use this approach to make quick prototypes of your program, to create small applications or to quickly test out your idea. This isn't recommended for large projects, because this way you will most probably be lost in the sea of ideas and possibilities, especially since you don't have a good overview of your starting idea or the progress you made.

The analytic way involves much more planning then the empiric way. With this approach you most likely spend more time planning your development then actually writing code. This way you will most likely select the best design for your application and have a good overview of your goals and progress, but the time required for this approach is considerably larger than for the empiric. The pros and cons of this approach are:

Pros:
  • Good application design
  • A good overview of your goals and progress
  • Efficient and clean code
  • Documenting code is easier


Cons:
  • The amount of effort doesn't pay off when doing small projects
  • A lot of time is required
  • A whiteboard or some way of writing down your thoughts is necessary


The situation where you would use this approach are big projects with a big class structure or when you need well documented, clean and efficient programs. You shouldn't use it in small projects, because the sole amount of effort and time needed to do this approach doesn't pay off.

At the end you should also know that the ability to differentiate projects that should be done in one way or the other comes with experience, so if in the start you're not sure what approach to use, sit down and think how will you realize your project. Will you just make it up 'as you go'? Or are you going to plan it?

1 Comments On This Entry

Page 1 of 1

pablo9891 Icon

19 January 2012 - 01:26 AM
I believe that in some way all the applications should be written using the analytic approach because in some way this would guarantee that your solution is the more optimal for the problem you're dealing with, this approach also gives you the valid justification of the solution you're coming with and sets the perfect base to a future efficiency analysis, because everything is documented and well explained. For me this is the way in which programming should be teaching, because it involves a lot of thinking process that you wouldn't do if you just sit and start to code without even think about which is the best way to solve the problem.

This is a theoretical way of thinking, in practice this two approaches are balanced because you have a big problem which is time, you have to hurry things and perhaps the analytic approach is no convenient in some points of the developing process, maybe you just need to have some fast coding and have something done quickly, so i agree with you when you say that the experience of who is working is the key to decide which approach should be implemented
0
Page 1 of 1

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

July 2014

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
272829 30 31  

Recent Comments

Recent Entries

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)