What source code is better for studying?
What source code is better for studying?
What do you think that would in general result the better suited source code to learn new things if you are to dedicate a very long time to study it and dissect all components of it?
What I'm looking for is a program that by studying can help me learn the "basic" things that will help me build up a new level of programming ability and knowledge, taking into account a balance of several knowledge branches.
What I'm looking for is a program that by studying can help me learn the "basic" things that will help me build up a new level of programming ability and knowledge, taking into account a balance of several knowledge branches.
YouTube:
http://youtube.com/@AltComp126
My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
http://youtube.com/@AltComp126
My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
Re: What source code is better for studying?
Whatever interests you most, because that's what you're going to end up studying the best.
Valix is an experiment in an interpreted userspace with object-oriented and functional design patterns. Developers needed! Join #valix on irc.freenode.net
Re: What source code is better for studying?
Well, I don't have a particular interest in any application right now, because what I'm looking for is to be able to distinguish which one could be the better "generic" learning experience to achieve a proficiency level similar to those programmers and also with the better balanced and understandable variety of knowledge.
I know that studying OS code will require to understand things "from scratch", while studying user space programs will go more towards using OS frameworks and interfaces, but both them have important things. So what is left is to determine which one would be more convenient in general terms (without any favoritism) to dedicate an important amount of attention and time.
I know that studying OS code will require to understand things "from scratch", while studying user space programs will go more towards using OS frameworks and interfaces, but both them have important things. So what is left is to determine which one would be more convenient in general terms (without any favoritism) to dedicate an important amount of attention and time.
YouTube:
http://youtube.com/@AltComp126
My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
http://youtube.com/@AltComp126
My x86 emulator/kernel project and software tools/documentation:
http://master.dl.sourceforge.net/projec ... 7z?viasf=1
- AndrewAPrice
- Member
- Posts: 2298
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: What source code is better for studying?
For a terrific (IMO) example of Object Oriented programming, you can't go past OGRE. Open source, designed to be extremely fast in real time, and an example of flexibility which can be extended in almost any where, and best of all it's widely used so it doesn't just remain theoretical.
My OS is Perception.
Re: What source code is better for studying?
Voted "other".
I believe that everything that is to be learned about coding - as in, how to structure your code, coding techniques etc. - can, yes should be learned in user space. OS / kernel space code adds a lot of "special flavor", because you're much closer to the hardware, and much of this is bound to confuse someone not really proficient in the language. At the same time, OS / kernel space code adds nothing, or only very little (and then usually not very good things), in coding techniques.
A behemoth like Firefox, on the other hand, has many "Firefox-ish" things to it, and is of a complexity (both in logic and in source structure) that makes learning from it rather difficult.
What I would recommend, is to not choose one large project, but many very small ones. Tools that do little things, so you can understand what a source file, what a function is for, so you can focus on how the code does something, not the "WTF is going on here". Because you're looking at many small projects, you'll see many different coding styles, project structures etc., see what is good readable code and what's incomprehensible, how different developers achieved similar goals, etc.
I believe that everything that is to be learned about coding - as in, how to structure your code, coding techniques etc. - can, yes should be learned in user space. OS / kernel space code adds a lot of "special flavor", because you're much closer to the hardware, and much of this is bound to confuse someone not really proficient in the language. At the same time, OS / kernel space code adds nothing, or only very little (and then usually not very good things), in coding techniques.
A behemoth like Firefox, on the other hand, has many "Firefox-ish" things to it, and is of a complexity (both in logic and in source structure) that makes learning from it rather difficult.
What I would recommend, is to not choose one large project, but many very small ones. Tools that do little things, so you can understand what a source file, what a function is for, so you can focus on how the code does something, not the "WTF is going on here". Because you're looking at many small projects, you'll see many different coding styles, project structures etc., see what is good readable code and what's incomprehensible, how different developers achieved similar goals, etc.
Every good solution is obvious once you've found it.
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: What source code is better for studying?
I would also advocate writing code at least as much as you read it. If you start writing something and it comes out badly, by refactoring and fixing it you not only learn what the proper technique is and what the improper technique is, but also *why* the proper technique is proper and *how* to turn bad code into good code.
I also personally find it almost impossible to understand a program that is more than an order of magnitude larger than anything I have written. So creating something large, even if it is slow or messy, can help you understand other large projects by teaching you to at least comprehend complexity, if not deal with it better.
Imo, the best way to understand a wheel is to reinvent it, albeit the slowest.
I also personally find it almost impossible to understand a program that is more than an order of magnitude larger than anything I have written. So creating something large, even if it is slow or messy, can help you understand other large projects by teaching you to at least comprehend complexity, if not deal with it better.
Imo, the best way to understand a wheel is to reinvent it, albeit the slowest.
Re: What source code is better for studying?
Fixing bad code can really teach you how to write good code, but some bad code is too far lost that it would actually be better in every way(other than the learning lesson) to just rewrite it.NickJohnson wrote:I would also advocate writing code at least as much as you read it. If you start writing something and it comes out badly, by refactoring and fixing it you not only learn what the proper technique is and what the improper technique is, but also *why* the proper technique is proper and *how* to turn bad code into good code.
I also personally find it almost impossible to understand a program that is more than an order of magnitude larger than anything I have written. So creating something large, even if it is slow or messy, can help you understand other large projects by teaching you to at least comprehend complexity, if not deal with it better.
Imo, the best way to understand a wheel is to reinvent it, albeit the slowest.
You may say you find it "almost impossible" I think what you mean is "almost impossible because I lose interest". I recently started a programming job with a huge(10,000+ lines) project written in Delphi. I did not know Delphi or any flavor of pascal when I walked on the job. I was fixing trivial bugs/refactoring within a week, rewriting things to work with a different type of use(as in, having to add some things and remove other things to make a new "use" for the program) in my second and third week, and now its my fourth week and I'm working on the rewrite of it in C#....
So, what my point is, is that you might not be able to understand all code as a hobby project, but if your paid to sit and look at the code for 8 hours a day, you will learn to understand even the most nontrivial of code.
and some wheels should never be reinvented. (who wants to implement sorting again!)
Re: What source code is better for studying?
earlz wrote:I recently started a programming job with a huge(10,000+ lines) project...
I think I have to readjust my scales. Of the three projects I've worked on professionally so far, none had less than 200.000 lines...
Every good solution is obvious once you've found it.
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: What source code is better for studying?
I think that studying a simple game's source (modern newbie tetronimo game) would be a great way to learn some tricks, then as you get more experienced, you can move on to more complex games, some of which (especially on consoles or older DOS games) are operating systems in and of themselves: memory allocation, file system management (compressed package files), GUI, threading system, etc.
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?
Re: What source code is better for studying?
By my standards, any project less then 100kloc is a small project...earlz wrote:I recently started a programming job with a huge(10,000+ lines) project...
I would focus more on software engineering practices~ wrote:What I'm looking for is a program that by studying can help me learn the "basic" things that will help me build up a new level of programming ability and knowledge, taking into account a balance of several knowledge branches.
Code: Select all
and managing complexity [one function does only that one function]. Studying existing programs may help with this in understanding the practices that they used in their project, but you should never stay with just one long term project. Quoting from Solar, "What I would recommend, is to not choose one large project, but many very small ones.".
Perhaps it may be better to focus on a specific area of a program's code rather then the whole program?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: What source code is better for studying?
well last few years i concentrate around operating system codding so i choose
"First Linux kernel release" to find out how linus wrote his OS and learn how to
write my OS
"First Linux kernel release" to find out how linus wrote his OS and learn how to
write my OS
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
Re: What source code is better for studying?
Solar wrote:earlz wrote:I recently started a programming job with a huge(10,000+ lines) project...
I think I have to readjust my scales. Of the three projects I've worked on professionally so far, none had less than 200.000 lines...
hmm... well I'm not too experienced I suppose lol
Re: What source code is better for studying?
Hi,
It also depends on where you live. For example, in Australia 10,000 lines is fifty times more lines than 200.000 lines, but in some other countries 200.000 lines is twenty times more lines than 10,000 lines...
Cheers,
Brendan
IMHO "lines of source code" is a fairly dodgy measurement. What you can do in ten lines of Delphi, you could probably squeeze into a few lines of unreadable C, and it'd probably take an assembly language programmer about 100 lines.earlz wrote:hmm... well I'm not too experienced I suppose lol
It also depends on where you live. For example, in Australia 10,000 lines is fifty times more lines than 200.000 lines, but in some other countries 200.000 lines is twenty times more lines than 10,000 lines...
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: What source code is better for studying?
And in even other countries, 200.000 lines is twenty thousand more than 10,000 lines!
But back on the original topic, I'd have to agree with Brendan's earlier observation with reviewing multiple and very small projects - but always remember to also review the code and structure of projects that are developed through mass (but organized!) collaboration; programming techniques, development and discipline while working with others, which always (theoretically) display how to organize and properly abstract parts of a code project. And continuing that vein to the extreme, throw in the source of a library like GLIBC to see ways of how abstraction can go wrong
Hope this helps!
But back on the original topic, I'd have to agree with Brendan's earlier observation with reviewing multiple and very small projects - but always remember to also review the code and structure of projects that are developed through mass (but organized!) collaboration; programming techniques, development and discipline while working with others, which always (theoretically) display how to organize and properly abstract parts of a code project. And continuing that vein to the extreme, throw in the source of a library like GLIBC to see ways of how abstraction can go wrong
Hope this helps!
"Sufficiently advanced stupidity is indistinguishable from malice."
-
- Member
- Posts: 65
- Joined: Sat Jul 04, 2009 9:39 pm
Re: What source code is better for studying?
I second that. OGRE is an interesting project, and it's pretty big but not to the point that it's too hard to follow.MessiahAndrw wrote:For a terrific (IMO) example of Object Oriented programming, you can't go past OGRE.
It has a clean design that you might learn from, plus you'd get to learn about a graphics engine.