Reading open source software code

In summary: Be prepared to do your own leg work and to take the time to read and understand the source code and related documentation. In summary, a new programmer should read through the header files of an open source project to understand what functions are present and what inputs and outputs they need. They should also use a profiler and debugger to understand how the code is used.
  • #1
Eus
94
0
Hi Ho! ^^v

I know that open source software can be reworked by many people.
Because of that, it grows rapidly.
Frankly, I wonder how people can rework it if they don't have a good technique in reading the source code.
When reading Emacs source code, I really confused from where I should work.

How about if I want to know what the original source code before any modification is? Is there any way to figure it out?

Is there any suggestions regarding this problem?

Thank you very much! ^_^
 
Computer science news on Phys.org
  • #2
I think the "code development cycle" and "coding practices" are the things that are kept common so that all developers can understand each other.
 
  • #3
what do "reworked" mean ?
 
  • #4
Eus said:
Hi Ho! ^^v

I know that open source software can be reworked by many people.
Because of that, it grows rapidly.
Frankly, I wonder how people can rework it if they don't have a good technique in reading the source code.
When reading Emacs source code, I really confused from where I should work.

How about if I want to know what the original source code before any modification is? Is there any way to figure it out?

Is there any suggestions regarding this problem?

Thank you very much! ^_^

I think you are looking at this wrong. You expect professional programmers to be able to open a project like EMACS up and immediatly know what is going on. That never happens. Generally, a programmer new to a project will talk to programmers currently involved in the project. The new programmer will sit down with a pad a paper and a pencil and read through the header files (the .h files) to understand what functions are found inside and to see what inputs and outputs each function needs and returns. The new programmer will take a lot of notes while tracking the flow of the new project. The new programmer will not simply sit down and open up EMACS and understand what is going on.

This is true for large projects and small projects. If I were to read through a new project I'd do as I described above. Even if it was a small project or I was only working on a small portion of a larger project the above must still be followed. No one can sit down and immediatly know where to begin on a new project.

Reading through EMACS and understanding everything could take a few days or even weeks for a professional to a few months for a novice.
 
  • #5
This is my technique. Your mileage may vary.

I use profilers and break points. Additionally most software trees also have a mechanism for generating trace messages (you just have to look through the docs to find the right switch or compile constant). Use the profiler and trace mechanism to run the program you are interested in under a couple of typical scenarios. Find out which functions are most heavily involved (require the most time, called most often) and understand them first. You can use this technique to find out what functions compose what subsystem and which functions call each other.
Next, if the system is really large run the process under a debugger, or attached a debugger to a running process, and put some break points in the section of code you are most interested in (say for instance emac's buffer switching mechanism). Upon the break, view the stack to understand how/why this function is called. Step the function to help understand what it does.
Then you should be reasonably familiar with whatever subsystem you need to modify to add/enhance your feature. NOTE: you do not need to understand the entire source tree!

As faust9 suggests, take notes and mailing lists are valuable resources. But only if you do your homework beforehand. If you ask a general question you will most likely only receive unhelpful or insulting replies.
 

What is open source software code?

Open source software code refers to any type of computer program that is made freely available to the public for use, modification, and redistribution. This code is typically created and maintained by a community of developers who collaborate and share their work with others.

Why is it important to read open source software code?

Reading open source software code is important for several reasons. First, it allows developers to learn from the work of others and improve their own coding skills. It also promotes transparency and allows for community collaboration, leading to the development of high-quality software. Additionally, reading open source code can help identify and fix bugs or security vulnerabilities.

How do I read open source software code?

Reading open source software code can be done by accessing the code repository on a platform such as GitHub or by downloading the source code files from the project's website. Once the code is accessed, it can be viewed using a text editor or an integrated development environment (IDE) which provides features like syntax highlighting and code navigation to make reading and understanding the code easier.

What are some tips for reading open source software code?

Some tips for reading open source software code include starting with the documentation or README file to get an overview of the project, understanding the project's structure and organization, and identifying the main functions or modules. It can also be helpful to read through code comments and use online resources or forums for clarification on any unfamiliar code.

Can I contribute to open source software code?

Yes, most open source software projects welcome contributions from the community. You can contribute by fixing bugs, adding new features, or improving the existing code. However, it is important to follow the project's guidelines and communicate with the developers before making any major changes to the code.

Similar threads

  • Computing and Technology
Replies
3
Views
2K
Replies
5
Views
2K
Replies
3
Views
2K
  • Computing and Technology
Replies
24
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
252
  • High Energy, Nuclear, Particle Physics
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
11
Views
874
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • STEM Career Guidance
Replies
2
Views
1K
Back
Top