from where do i start? is there anything i should take care?


 
Thread Tools Search this Thread
Top Forums Programming from where do i start? is there anything i should take care?
# 1  
Old 01-12-2003
Question from where do i start? is there anything i should take care?

now i am going to read sourcecode of some software. Where should i start from? what should i take care of ? thanks !
# 2  
Old 01-13-2003
your question is too vague. if the source is provided with the software then all you need is a text editor.
# 3  
Old 01-14-2003
sorry, i mean now that i have all the soucecode of some software, how can i analyse it? where should i begin? ( as you know, the amount of the soucecode is a little huge)
# 4  
Old 01-14-2003
When I need to look at a large amount of source code, I use a "bottom up" approach.

First I locate all of the functions.

Then I figure out which functions call which functions.

Then I start with the bottom functions, those which do not call any other functions. Once I understand them, I move up a level.

I repeat this until I hit the top level.
# 5  
Old 01-15-2003
thank you, that sounds a good means. however , i wonder if it can apply to other fields, such as object-oriented, or script writing ,etc.
# 6  
Old 02-11-2003
Whenever I take on new code, whatever the language, I usually find that it has poor commenting and bad indentation.

Many programmers have their own styles it is true, but then again many programmers are untidy and inconsistent.

A good way of learning a new piece of code is to go through it and tidy it up.

By adding comments and correcting indentation you will find you have to think about what the code is doing on a line by line basis.

Although this may seem a trivial or pendantic exercise I have always found it a useful technique in learning some else's source code and most importantly How They Are Thinking!

Be careful though not to change the functionality of the code you are tarting up. At a minimum:

1. Always provide a module banner (comment block) describing the source file e.g source file name, author, date, desription, project

2. Always provide a function banner describing the function. e.g. function name, description, input and output parameters


Perdabo suggests looking at fuctions to understand how the program is constructed. Another method at looking at a program which might be a bit more immediate when fixing faults, is to look at a variable in the program and see what happens to it. Just pick on the variable you are interested in an use the editor to search for the name.

Although this may seem old fashioned now, some people, still prefer to print out a program to paper and read it and understand it away from the computer. This method does allow you to write notes against the code which may not be suitable for commenting. The print out can also be used as a basis for a peer review meeting where comments or critiques of the code can be written on the listing.

Hope this helps.

MBB
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

SAN and Disk I/O ... do we care?

Hi all, My main function is as a DBA. Another person manages the server and the SAN. I just want to know if I should be worried about high disk I/O or is it irrelevant as the I/O "load balancing" will be "taken care" of by the SAN? For example, I have hdisk1-5 and I can see that there are... (2 Replies)
Discussion started by: newbie_01
2 Replies
Login or Register to Ask a Question