How do i go about reading source code?

Click For Summary

Discussion Overview

The discussion revolves around strategies for reading and understanding source code, particularly for beginners in programming. Participants explore various approaches, tools, and languages that can facilitate this learning process, with a focus on practical applications in game and web development.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Homework-related

Main Points Raised

  • One participant suggests starting with Visual BASIC due to its beginner-friendly environment, while noting its inefficiency compared to lower-level languages like those in the 'C' family.
  • Another participant emphasizes the importance of having prior experience with reading source code and understanding its structure before tackling larger projects.
  • Recommendations include creating or finding small example projects to analyze file structures and gradually read through the source code.
  • One participant lists essential components for learning, such as having source code to test, a development environment for making changes, and a reference for language semantics.
  • It is mentioned that understanding the organization of code bases is relative to the specific domain, such as video games or database platforms, which may require domain knowledge for effective comprehension.

Areas of Agreement / Disagreement

Participants generally agree on the importance of starting small and gradually building up knowledge, but there are differing opinions on the best languages and tools to use for beginners. No consensus is reached on a singular approach or methodology.

Contextual Notes

Some participants note that the effectiveness of learning to read source code can depend on the specific programming language and the complexity of the code being analyzed. There are also mentions of various IDEs and tools that may support different programming languages, but preferences vary.

Kott
Messages
2
Reaction score
0
I've been learning the absolute basics of a few programming languages and feel like I want to start taking a more "practical" approach to learning, so I've been looking into source code.
My question is pretty simple, where do I start? How do I identify the structure of the files that go into making a game/website/etc?
 
Technology news on Phys.org
It varies depending on the application and the specific language.
However almost every language has a subset of instructions specifically dealing with reading and writing files.
(Open a file, read stuff into memory, write stuff out from memory to a file, Close file - and some others)

I'd suggest starting with visual BASIC (assuming you are using windows OS).
The whole point of BASIC is provide an environment which is very easy for a beginner to comprehend intuitively.
BASIC is not very efficient in use of machine resources, but modern PCs are sufficiently powerful that this won't impact badly on the performance of your projects.
When you have BASIC understood you might then want to look at more 'low level' languages, probably those of the 'C' family to begin with.
 
Last edited:
rootone said:
It varies depending on the application and the specific language.
However almost every language has a subset of instructions specifically dealing with reading and writing files.
(Open a file, read stuff into memory, write stuff out from memory to a file, Close file - and some others)

I'd suggest starting with visual BASIC (assuming you are using windows OS).
The whole point of BASIC is provide an environment which is very easy for a beginner to comprehend intuitively.
BASIC is not very efficient in use of machine resources, but modern PCs are sufficiently powerful that this won't impact badly on the performance of your projects.
When you have BASIC understood you might then want to look at more 'low level' languages, probably those of the 'C' family to begin with.

Thanks!
 
Have you read through the classic C book by K&R yet?
 
Before I do a recommendation, I will assume that you have elaborated enough reading source code and explaining its structure and behavior, in the programs you have already created. This is crucial for going further to whole projects, whether it is for the web or for a desktop or mobile application.

I recommend creating or finding some small example projects on the net, see what the overall structure of the files is and read source code in steps that you can manage. Don't rush it, because this cannot happen overnight.

As rootone said, you can begin with a Windows project. I recommend using Visual Studio in this case, but keep in mind that when you create a software project, the IDE creates the necessary structure and give a lot of templates and libraries, in order to make the life of developer easier. In order to keep all this to a minimum, just start with a small project, in order to grasp how things work and go from there.

If you know - or want to learn, other languages not in the Microsoft family - although many of them are now supported by Visual Studio, you can try another IDE. Two of my favorites are Eclipse and DevC++ (there is a good 2009 edition for this). You can also create a web project, if you know some HTML, JavaScript and some server-side programming language.

There are many free IDEs and tools on the web and a good idea would be to download a WAMP software stack - Windows Apache MySQL PHP in case you have not seen this before. It includes a local web server to test your projects. The main point is the "start small - grow big" thing.
 
This is what you need:
1) Source code that does something that you know and can test.
2) A development environment where you can make small changes to the code, run it, and see what the effects are.
3) A reference source (perhaps the www) for the semantics of the language.
4) Persistence and a definite analytic bend in your thinking.

Then fiddle around - you will be learning the language semantic, the library functions (reading files or whatever, and picking up some of the programming strategies used by the author.
 
You should learn the basic programming flow for a given language and then extend this with applications to some domain.

Usually the code bases organization is relative to the domain that it is targeted for.

Video games are organized a specific way as are database platforms/engines and other specialized pieces of software.

You will need to understand both the organization of the flow control (in the language itself) as well as domain knowledge to be able to really go through any kind of code (particularly if it is extremely complicated with many tens or hundreds of thousands of lines or more).
 

Similar threads

  • · Replies 40 ·
2
Replies
40
Views
2K
Replies
1
Views
6K
Replies
7
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 133 ·
5
Replies
133
Views
12K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 29 ·
Replies
29
Views
8K