473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

How to understand (reverse engineer) other people's code?

4
I have been given the happy task of attempting to document software which only has sparse doxygen comments throughout. I have identified an entry point (first class/method called) and vaguely sketched out UML activity and class diagrams which is an on-going process in the attempt to understand the code structure and processes. I do have other developers to throw my questions to but I don't think I have comprehended enough of the code to have got to that point yet.

It's mainly an unstructured approach that I'm taking, as I haven't had a lot of practice in doing this. My question is, can anyone suggest an approach one might take when handed source code, to firstly understand the processes and structures within, and secondly to generate documentation from it. If a uniform approach does exist, I'd like to try it out here!

Additionally, could anyone suggest a URL (or URLs) which may have this sort of information.

thanks.
Jun 4 '07 #1
8 2470
svlsr2000
181 Expert 100+
I have been given the happy task of attempting to document software which only has sparse doxygen comments throughout. I have identified an entry point (first class/method called) and vaguely sketched out UML activity and class diagrams which is an on-going process in the attempt to understand the code structure and processes. I do have other developers to throw my questions to but I don't think I have comprehended enough of the code to have got to that point yet.

It's mainly an unstructured approach that I'm taking, as I haven't had a lot of practice in doing this. My question is, can anyone suggest an approach one might take when handed source code, to firstly understand the processes and structures within, and secondly to generate documentation from it. If a uniform approach does exist, I'd like to try it out here!

Additionally, could anyone suggest a URL (or URLs) which may have this sort of information.

thanks.
there are whole lot of way to do this, what i would prefer is putting some printf in all the functions, then we can come to know about the function calls.
Then take any function of your intrest and trying figuring out what its doing. Again you can use printf or any debugger.
Jun 5 '07 #2
Little OffTopic, but just for the sake of Information

HOW to Prevent Reverse Engineering (mainly for Java programs)

Code Obfuscation. This is done mainly through variable renaming

Suppression of End Of Line Characters. This makes the code difficult to parse.

Use of anonymous classes for handling events. This seems not to be handled by many Decompiler

Class file encryption. This implies some overhead for uncyphering at runtime.

Replacing the method names with certain characters e.g '/' or '.' in the class header causes the popular decompilation tools such as JAD to dump the source code which is incomprehensible (you cannot determine the control flow from the source). (case for JAVA)
Jun 5 '07 #3
blazedaces
284 100+
I have been given the happy task of attempting to document software which only has sparse doxygen comments throughout. I have identified an entry point (first class/method called) and vaguely sketched out UML activity and class diagrams which is an on-going process in the attempt to understand the code structure and processes. I do have other developers to throw my questions to but I don't think I have comprehended enough of the code to have got to that point yet.

It's mainly an unstructured approach that I'm taking, as I haven't had a lot of practice in doing this. My question is, can anyone suggest an approach one might take when handed source code, to firstly understand the processes and structures within, and secondly to generate documentation from it. If a uniform approach does exist, I'd like to try it out here!

Additionally, could anyone suggest a URL (or URLs) which may have this sort of information.

thanks.
Take it step by step. Do one method at a time. In every method, document the input parameters, what is returned, and what might be thrown (exceptions). Then try and describe what happens as clearly and as detailed as possible. If you don't understand a called method look up the class online (if it doesn't exist online it's probably a part of your code/project.

As you begin to describe different methods you should begin to notice patterns (make note of them in the documentation even!) Things like overloaded methods and reasons why methods exist, why they were implimented in this way. It'll start out as bits and pieces. It's like your putting together a puzzle, but slowly you can start to fill in the gaps.

I've never done what you're suggesting, but I've never found code hard to understand, and I personally have to learn most of my programming the hard way (simply by looking at how others might have done it, improve upon it because it's almost never very efficient).

I'm sure there are websites out there, have you tried searching via search engines? Just a suggestion.

Good luck dude,

-blazed
Jun 5 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
Let me add to blazedaces since I have done this.

The approach blazedaces suggests is workable. I suggest to checkout other people's documentation, like Microsoft MSDN or Platform SDK, to get a feel as to how methods and classes are documented.

Know your audience. Most likely these will be developers so your topics have to include information needed by a technical person.

Develop a topic documentation template using your word processor. Create all topics in the same format. Be sure your doc design supports hyperlinks. If this goes on a web page be sure you use an appropriate editor.
Jun 5 '07 #5
shlape
4
Thanks to all who replied, your suggestions have been very helpful, and informative (re: java reverse engineering).
I was doing something like what blazedaces suggested, but maybe in too large steps. I'll try the "one method at a time" approach.

thanks again!
Jun 5 '07 #6
AdrianH
1,251 Expert 1GB
Thanks to all who replied, your suggestions have been very helpful, and informative (re: java reverse engineering).
I was doing something like what blazedaces suggested, but maybe in too large steps. I'll try the "one method at a time" approach.

thanks again!
Sorry I'm late. ;)

You said you have UML sketches? What type are they? They could be invaluable way of understanding what is going on.


Adrian
Jun 6 '07 #7
shlape
4
Sorry I'm late. ;)

You said you have UML sketches? What type are they? They could be invaluable way of understanding what is going on.


Adrian
I've sketched out a UML activity diagram to understand the execution process and a static structure of the system to help with understanding how things fit together. I'm using visual basic's debugger to help with the activity diagram.
Jun 7 '07 #8
AdrianH
1,251 Expert 1GB
I've sketched out a UML activity diagram to understand the execution process and a static structure of the system to help with understanding how things fit together. I'm using visual basic's debugger to help with the activity diagram.
As long as you got everything under control. Good luck.


Adrian
Jun 7 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Smith | last post by:
A friend's small business has gotten themselves in trouble. Their only programmer has recently skipped the country and did not leave the source code or any design notes for a couple of program...
2
by: Markus Stenzel | last post by:
I have a Python software for Windows, packed into a single exe file and accompanied with a few dll and package files. Is there any way to reverse engineer this packet by extracting the source...
1
by: Paul | last post by:
With my set up of Visio (2003) and Visual Studio (.Net 2003 Enterprise Architect) I can only reverse engineer C++ code into the class-tree. Is it (supposed to be) possible to generate a static...
8
by: xiao zhang yu | last post by:
me was sorry if this question are present before DotNet, no matter VB.Net or C# all they are compiled to IL, and yes, that IL will totally same as "open-sourse", every IL will easy to decompile...
9
by: TCMA | last post by:
I am looking for some tools to help me understand source code of a program written in C++ by someone else. Are there any non-commercial, open source C or C++ tools to reverse engineer C or C++...
7
by: Martin | last post by:
Hi, I am trying to reverse engineer some software in C. Ideally I would like to use a free program that would scan for function calls and map the route of function calls in programs in a tree...
6
by: bluekarthik | last post by:
Hi , Hi, has anyone tried reverse engineering a .drv / .dll file ? Plz tell me some techniques to reverse engineer .drv / .dll files !! karthik bala guru
2
by: microsoft.public.dotnet.languages.csharp | last post by:
I have Visio Professional that comes with the MSDN Universal subscription. I need to reverse engineer a database using Visio and create the DDL. I can only find information on creating the script...
6
by: Herby | last post by:
Hi, Im interested in Reverse Engineering C++ source code into a form more comprehensible than the source itself. I want to write a basic one myself, obviously i need to write a parser for the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.