Ask Slashdot: Best Programs To Learn From?
First time accepted submitter camServo writes "I took C++ classes in college and I have played around with some scripting languages. We learned the basics of how to make C++ work with small programs, but when I see large open source projects, I never know where to even start to try and figure out how their code works. I'm wondering if any of you have suggestions for some nice open source projects to look at to get an idea for how programming works in the real world, so I can start giving back to the FOSS community." Where would you start?
Off you go
The more lines of code the more difficult to get started as a general rule. Just find a small library that provides support for something you have an interest in. Tinker with it.
Two of my imaginary friends reproduced once
Nothing more to it, the gradual expansion of your own project will teach you the techniques you need... or you'll drown.
I have often wondered the same thing. People tell me, "read the code and submit patches!" It may sound like hand-holding to experienced developers, but many new coders could really use an introduction to becoming a part of a community around a project.
And then do the opposite.
Works every time.
Linux
I suggest diving into Node. It is written in a very competent way, it's fast, small, efficient, nicely documented, does the IO correctly so no messy blocking function calls and threads synchronization madness, and is pretty young so the code base is not too big for one person to understand. Thanks to npm it is also very easy to write modules that are small, clean and have minimum boilerplate code so it's not like writing Java. There is a lot of code to be written so you may find writing and publishing your own useful modules pretty soon. Good luck!
Karma: Positive (probably because of superiour intellect)
Wesnoth has some of the most beauutiful C++ out there (yes, there is such a thing as beautiful C++). If C++ is what you want to work with, I recommend you start looking at their stuff. Play the game first, of course, so you can start to get a feel for what sorts of things it does. Then you should be able to start guessing where things in the code may be. Step through the code with a debugger too, of course. I find that "ok, I'm gonna try to make the code do this", i.e. starting with a specific goal, setting breakpoints, and stepping through the code is the best way to get comfortable with an unfamiliar codebase, no matter its size.
For C++ I would suggest Qt.
For C I would suggest Minix3.
Sent as ripples into the electromagnetic field. No single photon has been harmed in the process.
Some of the ALSA utilities are of a nice size to work on. Also, some of the LADSPA filters are a little out of date with respect to how ALSA expects them to behave, and could use some work. AND, they're nice tidy bite-sized.
If you want examples of 'real world' programming, take a bowl of spaghetti, add some additional ingredients that you wouldn't normally expect to see in spaghetti, and then fling the whole thing against a wall.
That's what the vast majority of modern day code looks like, especially if the organization that wrote the code tried to outsource the development effort 'to save money' at some point during the dev cycle.
You'll be famous. Featured on Slashdot, osnews, etc. every 6-12 months or so.
Why do you want to do this? Are you just curious or trying to get something on your resume? This is an important question because a diversity of advice can be given without knowing the answer to this.
I'm not an expert and probably not qualified enough to answer this question, but in my experience, you can't just start looking at a large project on your own and expect to get anywhere. As an example, any undergrad level OS course will only dig you skin-deep into the Linux kernel. The way I imagine things to work is, someone with more experience in the project you want to work on will help you get started contributing and learning the code base. Alternatively if you use a product extensively and know exactly what you want to contribute and why, you go in with surgical precision and try not to screw it up.
Bill Gates created it. Or was in a nearby room or something.
More info here:
http://en.wikipedia.org/wiki/DONKEY.BAS
>large open source projects, I never know where to even start to try and figure out how their code works.
Nobody knows where to start reading in a large project. Just ask for an architecture diagram or ask overall questions until someone can be bothered to draw one.
If you want to start programming on "real" projects only now, I'd suggest growing your own new module which you always wanted (maybe just by connecting two already-existing modules from some projects). At least I find it much much easier to learn by growing something new than by changing the existing architecture - that's out of the question until you have a grasp of how things are done in the big _in that one project_. And most of the time you don't need to know the big picture in order to add something new.
Note that C++ is notorious for having more than one way to do it (hah, understatement) so be aware that two different C++ projects can be very VERY different and can look as if they are in another language and/or paradigm altogether.
(Java is much less open-ended and so almost all Java projects look alike, and most Java programs are much easier to read than C++ programs).
As for can-learn-from-C++-programs, look at the Qt framework.
Linky. It's easy to build, well structured, covers a wide range of discretely organised functionality, has simple demo apps, and you can immediately see the result of tinkering with it.
If you were blocking sigs, you wouldn't have to read this.
A good place to start might be simple programs for editing text from the GUI. Starting with something like Kjots, gedit, or Kwrite is a good way to see how to build a simple interface and read/write files. Pretty simple and a step up from Hello World!.
Flexible bare-metal recovery for Linux/UNIX
http://libcxx.llvm.org The coding style is very straightforward and the code is small
Besides looking at the code of others be sure to look at the code you wrote a year ago and haven't looked at since. You should learn something about good comments and documentation. You probably will have ideas on how to better implement things. There is some truth to the notion that programmers don't really like the code they wrote for a project until they have thrown it out and rewritten it from scratch for the third time.
Beg and scrape and kowtow until someone on the steering committee deigns to allow you commit access.
Within the next twenty minutes you will probably:
-Commit some minor change, like fix a typo
-Cause a flame war over some bug you leave a comment on
-Get your commit stomped by someone submitting a load of useless garbage for other people to clean up
Comment removed based on user account deletion
The best program to learn from is the one that you have some idea for improving, something you use and can make better. The first patch I made to open source software was for bash. At the time I was use HP-UX at work and Linux and HP-UX at home. The KSH under HP-UX would do "tab expansion" with Esc-Esc, and it was killing me going between Esc-Esc and Tab (neither worked on the other). I first tried making a macro for it, but found that I had to change the C code to make it work.
So, don't look for the prettiest code to just read -- get in the game and poke at something you use. :-)
A tip I always give:
1. Start writing something you want. (It'll keep you interested)
2. Google the SMALLER hard parts (String Parsing, data models, misc functions, etc)
3. Use that code. (No one is going to blame you for copypasta on your own project.)
Eventually you'll understand how the copied code works. After a few projects you end up writing your own version because you're better than "that guy you copied from".
I am looking for volunteers to help me out with my open source project. Search for it on sourceforge using my nickname. It is java and even has android port if you are interested in programming for that platform. The project field is kind of "unsexy" so I am having trouble finding volunteers to work on it, or maybe my code is so messy that it is scaring people off :)
I highly recommend working on simply porting an existing tool to a new environment. You will be providing a useful service and learn piecemeal about an implementation style and technique. The more you port the more implementation dos and don't you will learn.
I suggest the book: Build Your Own Flight Simulator in C++
I read a version of it over ten years ago, and it helped me keep a perspective on projects.
All the code is spoon fed to you.
Check it out at
http://www.amazon.com/Build-Your-Own-Flight-Sim/dp/1571690220
Well, if it were C and not C++, I'd suggest this project. There are so many concepts involved in database development, that it can give a run for its money to OS kernels, graphics libraries and probably most specialized math/astronomy/healthcare related software.
But it's C.
You can't handle the truth.
The program source code type which I've learned the most from has been those which are written in the ``Literate Programming'' style developed by Dr. Donald Knuth to write TeX ( http://www.literateprogramming.com/ ).
The only program I'm aware of written as a Literate Program in C++ and publicly available is the Ynot logic simulator:
http://www.brpreiss.com/books/opus3/
William
Sphinx of black quartz, judge my vow.
... at least back in the days i was amazed how deep you could bury the int main() {}.
i think that the best one would (regardless of the source code qualities) an open source application that does something you are really interested in, or just find a simple usability problem or a simple bug.
then post your bugreport up on their tracker/mailinglist and offer to help with a patch with a little bit of help.
even if you don't manage to implement it, you might come up with a test case or at least discussion which will help you and the project. during the implementation attempt and/or testcase bulding you will most likely grep through a lot of code, commit logs and comments and might be able to implement your next idea.
if you are not familiar with the project's tools, you will be "wasting" a lot of time learning those while building a testcase/implementation attempt. that time you'll save during your next idea.
remember to start with small ideas. of course selecting a project that is both alive and non-hostile might be a good starting point as well.
One more thing: don't actually look at the npm source because it is extremely complicated, just use it as a utility which is easy. For good examples of Node modules to learn from take a look at Connect, Express, Socket.IO, Cradle and many other modules that you may find interesting. Have fun!
Karma: Positive (probably because of superiour intellect)
I think it would help if you told us what kind of projects you would like to contribute or to learn more about. Are you into OS kernels, IDEs, Ray Tracing, sound editing, etc. Then people might be able to suggest a manageable open source project to your liking (one which you will be more likely to brave through the learning curve), and resources for that specific project.
Mixxx is an open source DJ mixing program that's pretty easy to hack on (and it's in C++). If you like music and/or have any interest in DJing, Mixxx is definitely something you could look into. Like the parent poster said though, you have to scratch your own itch. If you don't find a C++ project cool or interesting, why bother hacking on it?
Also, don't be shy to ask questions on IRC. Find the IRC channel for whatever project you think is cool/useful and just ask someone which .cpp file you should look on to hack on feature X. You just need the end of the string...
After playing the game for some while I began to read the code and found it fun. It's not like the experience when you're reading the Lions' Commentary. Besides it's of moderate size -- a complete game showing how components add up to the whole, but you can also learn from small, fairly self-contained snippets controlling some aspect of the game mechanism or UI.
There are a lot of little things that have never been cleaned up or standardized. Picking up something could take you a couple of ways; Do you want the understand the of the dynamics of what goes on between people, standardization process ... There is more than just code, there needs to be a direction to what needs to be accomplished.
Take a small thing that might be still being worked on, not to say this is what you should but more as a example,:
http://standards.freedesktop.org/clipboards-spec/clipboards-latest.txt
http://pvanhoof.be/files/Problems%20of%20the%20X11%20clipboard.pdf
There are a lot of little "dangling ends" still out there that needs a bit of help; standards that need to be worked on and other things besides just code work.
CPython's source is easy to find and easy to read. The core dev community has gone to pains to keep it simple. It's also pretty well documented and has a great community in general. You can download the source at python.org or look at it online (http://hg.python.org/cpython/). You make a mercurial clone on your local box for hacking and use bitbucket to host it publicly.
I've found the CPython source to be a fount of knowledge. A great place to start is the devguide.
vmime : very well written open source C++ library
main()
I was in the same boat and ended up just looking around on sourceforge.net for a project that was interesting. Sort by your language, C++, and pick something in pre-alpha (code is usually smaller). From there, find the "int main" and start following the code, line by line; if you get lost, google it or e-mail the maintainers. Download a copy of the source and start tinkering, break it, and repeat.
1. Find a program that interests you.
2. Find something you want to change about it.
3. Hack away.
4. Find a different program that interests you.
5. Goto 2.
Trying to understand all of the code in a large project may be an impossible task, and it's frequently not necessary if you just want to make a simple change.
how programming works in the real world
There is no such thing. Each project will have its own structure and idiosyncrasies, and even after looking at 10 of them you will only understand those 10, not "the real world" in general.
It is often a bad idea to teach yourself how to program by looking at someone else's code.
Why?
1. You are not getting best practices. There are coding guidelines that should be followed but there are always exceptions, and not everyone knows all the rules and will break them needlessly. I am a profession coder with decades of experience... But I am still learning new and better ways to do things and I look back at my old code and I go what the heck was I thinking. And the answer was Oh yea, I needed to get it done and I didn't know about some feature at the time so I had to make this hack to get it to work. Looking at someones code you will get the good stuff mixed with the half drunk, or just a bad day.
2.It is overwhelming. It is more then just being tossed into the deep end, It is being tossed in the deep end with weights attached to your legs. Especially if you new to development and don't know where to start you can see. If you start in the middle you will spend huge amount of time looking at code that does something very minor but with no idea why.
3. You do not have a goal. You can't just look at a program and say I know how it works... You really need a goal to fix something, otherwise you are looking at stuff blindly.
4. Those sneaky 3rd party libraries. Unless you are doing some real low level coding there will probably be references to those 3rd party libraries that will not really let you know how things work.
5. Too much to handle. A computer is a great tool for processing a lot of commands that is often too complex for a human to understand. A programmer rarely ever thinks of how the entire program is programmed only his own little world, or his world at the time. And will often go back to see some code that they written and wonder who written that and when.
If you really want to learn, I would suggest that you start out with giving you a goal project to make.
And search for small examples about the current feature you want to implement. Integrate the examples and alter them see what is happening. Once you get good at making your own stuff, learning the tradeoffs and pitfalls then you can start looking at someone else code to expand off of it. Making new code is easy, modifying others is actually more difficult. That is why I am not a Huge supporter of Open Source Ideals, and more of supporter of Open Specification.
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
http://www.aosabook.org/en/index.html (And no, I'm not affiliated - just a fan)
Since the 90s I have been a proponent of reuse, not only internally to an organization, but as interface libraries with a low bar to entry. I found this book to be seminal in identifying issues that show up in large programming efforts and general dependency decoupling for interfacing:
Large Scale C++ Software Design by Lakos
come on fhqwhgads
Take a look at Code Reading: The Open Source Perspective by Diomidis Spinellis. I've had a copy on my shelf for years. He covers C++ along with other common languages, and has examples from both very large and small programs.
Look for a small program you use and go check it out. Big projects, like firefox, are going to be hard to get into. And no one is going to hold your hand.
There are thousands of projects with lone developers who would love some outside contributions, even if they have to do a little hand holding.
There are also many projects that were that way but are abandoned (I had one myself) once the developer no longer had time to do it. Picking up one of these can be nice. And you get absurd amounts of appreciation for fixing issues with modern systems.
Avoid libraries. They're hard. The code changes are quite easy, which is why developing new libraries is a blast. Long term maintenance is where the challenge lies. Subtle changes break subtly wrong code and sometimes perfectly correct code: Often, wrong or right, the library user had no way to know because documentation always sucks, no matter how much of it there is (this is one of the arguments for open source libraries). Once you have been programming for a while you might look into helping on library projects.
Don't go looking for "best programs to learn from." You won't "get" it. Each program has its own focus, and unless you are very interested in the subject matter, you'll just gloss over the important parts. I've worked with tons of other libraries and I always find myself asking "Why the hell can't I just do X" or "Why they hell did they do it this way?" Invariably it was because the library was written with a mindset with a better understanding of the topic and contract than my own. When I say "contract" I mean what the library aims to provide.
If you do want to increase your changes of using C++/OOP right, I highly recommend writing C++ using Qt. That is the best best-of-breed library, with an incredible breadth and depth. It is a well thought out, complete API.
Python also has an art to it which is called "Pythonic". Some things are more or less "pythonic" which means driven by the philosophy of the language that reverberates from the operators and APIs.
So I would say rather than just reading someone else's program, write you own using Qt or Python, and let those shape you.
Also, use Model-View-Controller as much as possible. (It is not possible everywhere though)
The only other thing I can advise on a completely general principal is always separate your data out from implementation. From array dimensions (who dimensions arrays anymore rather than use a STL like class? Static dimensioning makes it easy to exploit your code.) to constants and up to variables, keep that separated, because constants do change. Not often, but they eventually do.
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
On sites like spoj.pl there are plenty of easy questions. It's a good way to learn the basics, like sorting, input and output, because the judge will test your program for all the possible newbie mistakes.
Unfortunately, there are very few judges that will force you to use certain libraries (STL, boost, etc) APIs or language features (e.g. inheritance).
Pick any project that's not *too* huge, and preferably not GUI, because that adds many more layers to try to understand. What I do, when I've started new jobs, was to look at the main{}, and see what it does, to try to get an overview. Then I'll look at whatever calls I need to understand for what I've been asked to work on. I'll continue working at the highest level, until I get to what needs fixing or enhancement: that way, I try to avoid breaking something else by seeing where the changes will correctly fit.
If you find spaghetti code - one function hundreds of lines long, if it's not moving 5,543,540 fields, go elsewhere. Or rewrite it modularly. Correct modular code does *one* thing well, not 5 things confusingly. That way lies maintenance hell (as I like to say in interviews, job security is *not* "never let them know what you're doing", it's if I get a phone call at 16:45 on a Friday, or 02:15 some day, I do *not* want to spend hours figuring out how clever I, or someone else, had been a year or two before; I want to solve the problem and get back to leaving or sleeping).
mark
I think you already do.
This is the difference between C and C++: in C, whatever the code of a function says it does, it does; in C++, whatever the code of a function says it does is subject to be changed by templates, operator redefinitions, etc. Because of this it is impossible to make small changes without reading and understanding the entire codebase first.
Basically, if you want to get involved in a large C++ project, you either have a tour guide or very good documentation or make the huge investment of learning the entire superstructure of the program before making any changes to any part of it. It's kinda interesting how C++ encourages this kind of greater dependency between different parts of a program than C.
Forget magic. Any technology distinguishable from divine power is insufficiently advanced.
An AC above suggested ALSA modules, but many other projects accept plugins (my first thought was the GIMP, but that uses python). Pick something that you're interested in and write something that solves a problem with that. If it's a discrete module or a plugin you'll have more chance of deploying it.
one of the biggest C++ project in the world? former 700K LOC property codes, now opensourced at about 300K LOC, a full functional enterprise cache/proxy production. include all kinds of cool things related to high performance server technical: C++(no STL lib) Continuation StateMachine FileSystem ClusterCommunity ...
...take a look at the source code for Luminance-HDR. While it's buggy, I've been pleasantly surprised at how well-organized it is, and it should prove to be very hackable.
tasks(723) drafts(105) languages(484) examples(29106)
I suggest download the Minix source and using the git portal for the OpenBSD source: git://git.freebsd.your.org/openbsd You can learn a lot from looking at simple tools like ls, and then looking at system libraries as well. And yes, I know it's not C++.
"If you plant ice, you're gonna harvest wind."
I'm not a big PHP fan, but I had to dive into mediawiki and found it to be very well organized. It made me realize that PHP didn't have to be bad :)
You could try either working with KDE applications/framework, or QT library itself. Both are based on C++ and there is a good amount of samples out there
I seem to be in the minority in this regard, but in my opinion looking at source code to try to become a better programmer is a waste of time. Looking at the source code of a large project is just a bigger waste of time. Writing code is 10% what you're doing and 90% why you're doing it. Looking at code will tell you what it's doing, but it won't tell you why it's done that way. Add on top of that the fact that every developer has his/her own style and conventions and you're just adding more wasted effort trying to get to the "why" of the code. There's simply better ways to learn how to code.
Save yourself the hassle and go here instead. This book contains a wealth of information about building and working on large codebases (all open source), written by the developers themselves. This will cut through the boring bookkeeping that is 90% of writing software and get to the heart of why they are written that way.
Obviously doing stuff on your own is a good way to learn, but 1) it is certainly not the only way to start 2) HE ALREADY SAID HE WANTED TO DO THE OTHER THING.
Learning by maintaining someone else's existing code is not stupid. It isn't. Really. It's not even stupid, even if the code you're maintaining is bad. You can learn good things from bad code. And you can learn good things from other people.
For the most part, It doesn't matter what program you look at. Any large FOSS project is going to represent thousands, tens of thousands of hours of work. You can't expect to pick it up at a glance. The thing to do is to start at an interface, a device interface, a GUI button, something where you can easily understand what the goal of the code is. You might look at the firefox code and go look for the top level code for file->open. It'll take you a while to find, and it will be in at least a couple different places. But from there, you just work down through the call stack to find out how it gets its work done. After you understand that, you'll have your foot in the door. Then rinse and repeat.
PostgreSQL is, in my opinion, the best example of a large, open, successful project. It's codebase truly reads like poetry, it's incredibly well-engineered, and its community is smart, welcoming, and open. It's written entirely in C (the core of it, anyway) but it's what I have recommended to friends and colleagues for years as the starting point from which to begin to understand large program architecture. It's been a shining example since 7.3, and it's gotten measurably better since. I'm not involved in the community but have observed it from afar for a long time (shame on me in that regard).
I suggest QMail. The code isn't that big, it's well written, and it's modular (lots of executables calling other executables). I wrote some authentication plugins for it about 10 years back and as I recall it wasn't too hard to figure out what was going on.
Something to help you get started could be to try to clean up the code, add comments, and try to create documentation. There is a nice utility for generating developer documents here: http://shfb.codeplex.com/
Whatever you choose, a good code-browsing tool is essential for effective spelunking. cscope is the runs-anywhere standard, but I've recently become a fan of Opengrok.
I'm going to get a little bit snarky here, but there's a point to it.
Why go to all this effort to learn a language like C++ these days, if you're not already employed someplace where you're clearly able to earn more income fixing/building something specific for your employer that requires that skill-set?
As one of my good friends just realized, he's been struggling to master Objective-C so he could learn to code a few apps for the iPhone and iPad -- but he's "going about it all wrong", ultimately. After all, his reason for wanting to create those apps is a financial one, so he's far ahead to simply outsource the coding to another country where labor is relatively cheap, and simply "project manage" its progress as it's developed for him.
"Why tend the farm when you can own the plantation?" was his wording, I believe.... In a way, it's a shame our country has come to this (United States in our case), but it's a reality of the global economy. As long as someone can create a user account on a website like odesk.com and place want-ads for iOS developers, graphic artists, etc. and actually FIND people willing to do this work for as little as $7-9/hr. -- it's not remotely cost-effective to try to code an app yourself instead. Will the resulting code be a bunch of "spaghetti" that's difficult to maintain or decipher? Oh, quite likely! But the end-user won't CARE as long as he/she can download the thing for as little as 99 cents a copy and it basically does what it says.
It's VERY possible to spend as little as $800 or so and receive a complete, working game or other iOS app in return. Then, it's equally possible to turn around and earn at least $100-300 per month, month after month, for NO additional work beyond doing a little promotion of the app's existence and answering emails about it. More importantly, if one rolls the profits back into paying for development of the next app, the process can be done in a "wash, rinse repeat" process, ensuring a multiplication of monthly income. Don't forget, with tools like push notifications, one can announce the new apps to owners of the existing, previously sold apps, which helps drive more sales....
Obviously, the original poster wasn't referring to developing for smartphones .... but rather, using a long-standing, popular language for writing apps or even operating systems themselves. But my point remains.... We're reaching a stage where it's just not financially smart to hire developers at the kind of salaries or hourly wages they'd expect to receive for the type of work they're doing (and amount of learning required to be ABLE to do it). Outsourcing is becoming the new norm, even if it results in poorer quality code (and I think it often does).
The document management software we purchased, where I work, for many thousands of dollars back around 2004-05 used to be developed in-house, here in the U.S. Guess what? The entire last major revision was coded as outsourced labor in India. They retain a "help desk" in the U.S. to answer their phones and give the appearance you're still dealing with a U.S. based company -- but all the trouble tickets eventually get turned into work orders for Indian developers to do either as a "hotfix" or more often, as a required change for the next service pack or version of the software they have scheduled to release.
I wouldn't bang my head on the desk looking at someone else's code and trying to learn from it. So many people write the most obfuscated shit -- spaghetti code and using extreme levels of shorthand when it doesn't actually improve any performance and makes the code hard to read. Don't cuddle your braces. /ducks.
Get your self a real IDE. Visual Studio 2010 Ultimate is available as a free download from Microsoft. You can get a free key for it with a Google search. I got mine from a Youtube video. You're free to install updates for life, and there is no DRM in it. Microsoft does this because they take fucking care of their developers (even us hobbyists that can't live without the features of VS Ultimate).
If you like games, then get the XNA Game Studio and use C#/.NET. The performance is great, and using unmanaged C or C++ for a game (with XNA available) is premature optimization in my opinion. You can call C code from your C# code and use unmanaged code whenever you want AFTER it's warranted by benchmarking and profiling. There are plenty of performance tracking classes in .NET and the profiler in VSS 2010 Ultimate is amazing. No cross-platforminess, though. I guess if you want to develop for Linux, then you'll have to settle for slightly inferior tools and APIs.
Have fun.
The Linux kernel is a piece of good crafted code in comparison with most desktop projects. This is mainly due to working community processes which Gnome or Freedesktop.org lack. Before someone marks this as flamebait. There is and was a lot of bad communication between parts of the Gnome community e.g. between Ubuntu and Gnome, between users of Gnome and the GnomeShell team etc. And arguments like: "It is open source take it or leave it" where send out, which is nonsense as software is not only designed by the programmers and designers, but also shaped by user needs. So the feedback of users is important. That's why Ubuntu became so popular in the beginning. Lately that changed a bit and therefore their loosing user base.
However, there are projects with a good community model such as the Linux kernel (even if Linus is sometimes a little harsh). The Apache projects seems to have a good process too and Apache HTTP is a smaller project so it might be a good starting point.
The best thing right not to help the desktop FOSS community would be real community building. There are some efforts with common conferences from Gnome and KDE, but there are still big issues for users to be heard by the developers. So help building community processes is even more important than coding.
Whatever you start off with, give it a run through doxygen first. Esp. with C++, this will save you a lot of time looking up definitions of objects and other stuff buried in various (and overridden) header files.
Read the well thought out and put together documentation bwhahaha
the most important thing is to have techniques that allow you to find your way. the language doesn't actually matter, but it does definitely definitely help if the code is documented in some fashion. i tried, for example, to work on fontforge with my usual techniques, and the code was so incredibly dense and uncommented that it was absolutely impossible to understand. but, exceptions aside, here's a starting point for getting into large projects:
* use vi. do not use graphical editors. do not use emacs :e # to go _back_ to the file you were originally editing (after using ctrl-])
* get a damn big monitor (or 2 monitors). open xterms at 80x60, as many wide as you can get.
* use a multi-window desktop manager (i use fvwm2 and i run a 6x4 grid: that's 24 desktops.
* be prepared to open (and background) up to 200 simultaneous files, across multiple windows.
* make sure that you open the files from the *root* of the project.
* open the files "by name", explicitly, so that you can do "jobs | grep {filename}"
* run "ctags -R" - it is your friend. then use ctrl-] on a function you don't know, and read about it.
* remember to use
* be prepared to print out the ENTIRE codebase, and flip through it, off-line, very very quickly.
* be prepared to do page-down, page-down, very very quickly, through as many files as you can stand
the main thing to do is to get a vague map of the code into your subconscious, as quickly as possible. then you will go "i've seen that before..." and you stand a chance of being able to hunt for it and find it.
you *don't* have to memorise the entire codebase - you *don't* have to even understand all of it. but you *do* need to at least have the techniques which will allow you to jump to wherever it is that you want to go.
ultimately, though, you need a goal. what, exactly, is it that you want to achieve? if you have no goal, you are pissing in the wind.
i added NT Domains Security to freedce - that's a good, simple goal. FreeDCE is 250,000 lines of code, and very well laid-out. it was therefore quite straightforward to add 6,000 lines of code to do NTLMSSP. took a couple of weeks.
i added python bindings to webkit - that's a good simple goal (ok, it was horrendous, requiring over 12 different skillsets, including c, c++, python, perl, autoconf, gtk, python c modules, IDL files parsing - the list just went on and on). webkit is a massive project, and also very well laid-out and structured. the first version of the python bindings took about 8 weeks, and the 2nd (faster, better) version took only 2. the reason why the 2nd version took only 2 weeks is because i hunted down the mozilla xulrunner IDL file parser, hunted down python-gobject's code generator, adapted the xulrunner IDL file parser to understand the webkit IDL file-format (2 days), then spent the rest of the time hacking codegen.py to spew out the data types from webkit, and to create a standard python c module.
so you say "you don't know how to get familiar with a free software project", well, i am not - i wasn't familiar with webkit, but that didn't stop me. i wasn't familiar with xulrunner, but that didn't stop me. i wasn't familiar with python-gobject's codegen, but that didn't stop me. i just got on with it, and just trusted that the surrounding code would do its job, and trusted that the bit of code that i picked up could be adapted.
so in many ways, tackling a large codebase is more about overcoming your own fear and feelings of inadequacy. sometimes not even i can do that, and sometimes i can.
This was the path I followed to enlightenment after I took my undergrad software engineering course in C in the early 90s. I set out with a similar goal to find what real world systems looked like with proper decomposition, class structure, commenting, etc. At the time FreeBSD was getting a lot of interest, so I decided to dive into that code base a look. That made my head spin and seemed to violate all sorts of tenants we were being taught. Shortly thereafter, I accepted an internship at Microsoft and thought "Aha! Now these guys are doing great and must have a truly excellent software engineering culture. I can really see some good code now." I cracked open the code base for Excel and PowerPoint and got lost in that for a while. A lot of the Excel code was still based around Simonyi's design in C, and actually had a reasonable core structure given the limitations of C. But it was also a real world system and had an amazing amount of cruft built up around it that was difficult, at best, to understand. Mac PowerPoint at the time was a hodge podge of Pascal, 68000 assembly, C++. Some of the code was clearly written with some serious thought and design, but a large chunk of it wasn't. My favorite code review during the internship was a bit of assembly that processed a code resource loaded on the Mac to patch in a fix to the OS routines for FileDialogs in order to prevent a crash in our application.
You need to start with relatively straightforward problems, and I think the best way to do that is to start with a generally-adopted library that offers simple incremental improvements on the standard libraries of the language you are working with. If it is widely adopted it is likely to have been improved by a whole lot of eyes, and if it is basic you are likely to understand what the code is doing.
For example, I've recommended many people read the Apache APR code to get started coding C. Not only is it elegantly written in a way that is understandable and teaches good programming practices, but it is accessible because the problems it is trying to solve are relatively well understood by most programmers.
Which library you choose will depend on which language you want to work in.
Check out WiBit.net. It's not really an open source project; but it is a site that, for free, teaches programming including C++ (also C, Objective-C, soon Java and C#). We have a forum where users can help each other learn. It's not a big thing, but that's one way to give back to the community. Not just on WiBit, but helping others learn what you have learned is a great way to give back overall :-)
Also by getting into a learning site you can meet others who are like you: they know a bit, but want to be involved with something bigger. You can get your own effort moving and maybe create your own open source project. We have a guy in our forums working on an open source game with other users of the site. Check that out here.
I've always thought they had the best model for everything.
NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
Download geant4 (it's a c++ open source simulation libraries developed by the high energy physics community) from http://geant4.cern.ch/, install it, and try and go through their novice examples. These are short and sweet, and you don't need to be a high energy physicist to understand them.
Becoming proficient in a programming language is an important skill, but it's not the only one that has to be picked up to get the job done. Keep in mind that code is a solution to a problem, often written to leverage a generic framework that is suitable for the task. It's just as important to understand the nature of the problem and the framework.
To keep this concrete, I'm learning Python (yeah, which stone have I been hiding under) after years of C/C++ programming. Lately I've applied myself to Unicode issues, solving bugs in Ubuntu stemming from multi-byte character processing. Apart from honing my Python skills, this task has exposed me to related technologies: internationalisation/localization; gettext; and Unicode. As the code I'm working with in applies Python's multi-language support, I've also had to dwell on this part of the Python library. Learning and grasping all of these -- not just Python per se -- helps me be effective in contributing to Ubuntu and making it successful in, say Asia, where multi-byte language is the norm (i.e. CJK).
The fact that you have the mindset to continually learn is heartening. Keep it up!
At my university to complete a degree in CS you had to take a class called compilers which was a big project. This will teach you how to organize your code:
I could post the link, but I don't think the prof would like that -- let's just say it's a big 10 school, and they use Appel's book
There is no way to learn without failing. Start something small and let it grow as needed while trying to maintain quality.
Understanding a code base that is large and new to you is a challenge.
Especially if it is crappy architecture.
What I do is use Doxygen to map out the code base.
Once mapped, you can use your browser to get the basic layout and workings of the project in matter of minutes.
Google Doxygen, and install it (install graphviz/dot first).
Then play with it.
You will be glad you did.
Especially the dependency graphs are a life saver:
use them to identify and weed out header file dependencies, and you can orders of magnitude faster build times as well.
Bram
Bram Stolk http://stolk.org/tlctc/
http://www.aosabook.org/en/index.html
Inkscape is a very interesting C++ project. You can hack on UI bits which are easier to get a handle of than the SVG rendering internals.
There's something for everyone to work on in Inkscape, and the project needs contributors to improve its quality!
Most of the more elderly progs/dev here will tell you if you prod them hard enough that "being dumb" is the road to enlightenment - if you think you know everything already, then you're not learning!
Big codebases, many hands = you need to learn human psychology just as much as coding, and the "art of diplomacy" (also knowledge of when to get out and say - "die in a fire losers" - just in your head). Ego's and little Hitler's who think they are code gods can burn many a decent project.
Andy
Aspirations of tackling a large coding project are usually less than imagined. Most successful projects start as the kernel of one programmer who strikes the landscape and envisions how things will work. Then they flesh it out to a degree and move on or otherwise becomes involved in managing the code base. At some point they leave or move on. So the majority of new or junior programmers end up interpreting that code base, usually with little or no documentation. In the best of all worlds they attempt to internalize or get inside the mind of the missing programmer.. and "figure things out" for themselves and extend it.. often making assumptions and mistakes the original programmer might laugh at or never intended.. but that is how the code lives on. Programming Libraries, APIs and application sdk's are all formalized examples of this.. sometimes with better documentation, or supplemental documentation and work even better as learning tools. In the distant past Language standards served the same purpose before formal libraries were common, and to a degree still do until new libraries for new languages are built up.
There are two fundamental reasons for wanting to work on "big" coding projects anyway, one is that your curious or have the need to extend or work with an existing product, application or code base.. that probably isn't well documented, or doesn't have "learners notes" or "examples" of how to get things done.
The other is the perception that it is career enhancing or will give one an edge over less experienced programmers.
For the first, the best way is to tackle intimidation with small projects and just going for it.. experience good or bad breeds confidence and eventually success.
For the second, a whole lot has to do with personality and experience and confidence, part of which can come from working with big projects and code.. but the personality is better worked on in a coffee shop and basically communicating with people in a sociable way.. even on the internet through email.
Open source projects are a great way to collaborate and work on all of the above in a safe non-litigious environment, and its high profile.. and you can find people willing to help.
Schools and colleges are a more traditional way, but cost a lot and there are some barriers to entry put in place by convention and societal expectations.
The interface between the real world and the digital hasn't changed since Woz and Steve Jobs invented the Apple computer or Bill Gates commercialized the free software disk in the back of a book. How can this tool, software, help me do things that I couldn't do before?
In the early days it was a lack of hardware that forced us to reach with our minds and know the capacity of the code better than the designers of the language.. more with less. That world is gone.
Today another economic, the embarrassment of hardware riches, tons of ram and lots of hard disk space.. but a limited human lifespan.. causes us to re-evaluate the old rule of "re-invent it yourself -- you'll learn something".. we just have the perception that to make something worthwhile.. it has to be totally and completely unique. Rather I think we should "get over it" and use Libraries or examples as if they were hardware building blocks and move on.. if you need a smaller code base then "that is the project" build from something that's already working.. and don't try to place magic crystal bricks in perfect celestial harmony.. before you get started.
There is an example of this happening before.. when we used to pontificate over RTL versus TTL which circuits should I use to build a Flip-Flop to build my microcomputer.. now we're moving into the age of when the Mobile computer replaces the Microcomputer and the Data cloud replaces the Database. What is a Mobile computer? It's not a PET Commodore anymore.. I don't even think I know.. its still being made.. but the effect on Apple and Microsoft are being felt.. safety seems to be in the cloud.. but maybe not.. what about distributed emergent data stores? Like bittorrent, dropbox, and programs that aren't programs but organize our lives like calendars? eh..
Take something you like and/or use. Or something like what you do if possible. Load it in a debugger, trace in to main or the language equivalent, and see where the calls go. You'll see quickly how the files are organized (if they are organized).
The more familiar you are with the app, the more sense the code will make.
Choose several - I've found every project has its own style, organization, or other peculiarities.
As someone said above, the real world is not all open source. Most of what I've seen in open source has nothing to do with what is done at large companies. The closest you might come is Red Hat, their distro-specific additions to Linux. But that's still open-source style.
When you feel comfortable, go to something that will blow your mind. The creative use of the preprocessor in MAME/MESS, and the ploymorphic implementation in C, makes this a wonder to behold. And not a great example unless your intent is to make an emulator.
http://mamedev.org/
The point is to learn more than one way of doing things, and find what you are comfortable with. Not how other people do it. Because there is no one way. If you want the one way, read a book instead.
There is a book on that subject called:
Code Reading: The Open Source Perspective: Open Source Perspective by Diomidis Spinellis
ISBN-10: 0201799405 | ISBN-13: 978-0201799408 | Publication Date: June 6, 2003
New things are always on the horizon
For C code, I recommend reading the source to Tcl/Tk. It's beautiful code, well-structured and portable.
For C, learn from the best, and that would be John Carmack. :)
http://doom.wikia.com/wiki/Doom_source_code_files
The best formatted (C)API that I ever encountered was the X11 client-library. Yeah - so sue me. No really - one function per file,same name for the file as the function, clear indentation scheme, always a comment (on top), well documented structures, etc.
Religion is what happens when nature strikes and groupthink goes wrong.
I'd say take things that are popular, well-used. libpng or zlib for example, or any other library that is most likely in something you use. Even if real-world code doesn't work that way, it's something that a lot of people are exposed to, if only via the API.
Usually there is sample code which shows how to use the library. Many eyeballs on that sample, and you have a good shared consciousness. It's not always how things work as I said, but it is what's being used.
You can try go to the world of 3D developing for Blender or FreeCAD. Blender 3D (www.blender.org) is a full featured suite for 3D artists, cross platform and with a huge and well stablished codebase. This is good since you can learn a lot from them and also you can start with something easy (like python scripts or C or C++ functions for it) or go for some challenging topics (they are redesigning their modeling core, or help with the new renderer they're coding). FreeCAD (http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Main_Page) is a 3D CAD tool being developed by 3 people for enginners out there. This is C++ and python skills involved, cross platform and these guys really need help badly.
I was passionate about communication and chatting so I helped out the Anope project (IRC services), UnrealIRCd and Inspircd by contributing modules, some bug fixes, and some time testing. I think if you're going to get involved in something make sure it's something you're passionate about first and foremost. The other parts will come later.
If your codebase does stuff like modifying operators you'll find out that way. If, on the other hand, it's is heavily template-based, my best advice is to either learn a lot about those particular templates (e.g. the Qt library) or stay away for now.
Code monkeys try to read their way straight through the codebase. In order to succeed that way takes a lot of time and raw talent (among other things superb concentration, a memory like a bear trap, and a good feeling for C++ syntax). You can waste a lot of time before discovering you don't really have the talent to do things the hard way.
Software engineers on the other hand use tools like Doxygen and first try to understand the overall structure of the code and then selectively zoom in on something they want to change or improve.
My suggestion is to train yourself first to use tools (perhaps on a codebase you already know) and then find yourself a smallish but new project you can apply those tools to.
If "the real world" means the corporate world, do this. Take an application you don't care about and don't know how to use, and assign yourself a bug to fix, and give yourself a deadline pulled from a RNG.
Code is developed this way:
Start developement
Shrink the team
Fire all but 1 guy who does all the maintenance
Bring in contractors
Add a few people
Shrink the team
Fire the 1 guy who knows everything
Scramble to find someone who knows the application
Bring in contractors
Select any step above at random
I'm not trying to be funny. End result is quirks, inconsistencies, inexplicable code blocks, bugs, performance issues, and all kinds of other bad things.
It depends on what your true goal is. Do you want to become wizardly, or merely competent?
Study the libraries used to implement the code in question to become competent in that application. Most of the confusion of thought regarding code has to do with specific libraries used. By encapsulating complexity in libraries, it streamlines the main code - but then requires you to dig into the libraries to understand what's going on. This 'state' is difficult to maintain in their head for most people.
If you want to become generally 'wizardly' at all code you come accross - start off learning Assembly code for the gear you're most likely to encounter (probably INTEL processors). After that, everything else is easy. Following craw-walk-run - move on to learning about compilers and interpreters that you use (C/C++ and CPython or bash are good choices to look at). Finally, after you get a good understanding of the lower level hoops that your programs make the CPU jump through, then start looking at the higher level code you're interested in.
I like to conceptualise the different meta levels of the program stack -- from the microcode that defines the CPU functionality -- all the way up to the high level languages as boxes within boxes -- each level standing on the shoulders of, and building on the strengths of the simpler lower level constructs. Another visualisation you could use are those russian nested dolls -- one within another and so on.... If you can understand what is going on at the different levels when any one high level command is executed, you can have a better handle on what your code -- or any code for that matter, is doing. Computers are actually very simple when you get down close to the hardware --- it's all the cruft we've layered on top that leads to complexity - much of which is really unnecessary, and the result of people trying to code fast, rather than efficiently. I'm not suggesting everyone code in Assembler -- but there has to be a balance, a 'middle way' that avoids layers of high level garbage that you have to sift through because someone decided they wanted to use their favorite (big/ugly) library/framework, rather than implementing it in a more streamlined fashion. This state is largely the result of people seeing every problem as a nail, and every tool as a (their favourite) hammer - without any deeper understanding.
I think 'computer science' courses today give short shrift to that key understanding. This, as you may be able to tell, is a pet peeve of mine.
Lodragan Draoidh
The more you explain it, the more I don't understand it. - Mark Twain
Hello world.
'nuff said.
I found starting with older BSD systems, in particular 4.4 BSD and FreeBSD 4.x was a great way to understand systems code. For a simple example of understanding how a kernel starts to manage memory, look at zalloc() and friends (vm_zone.c) in FreeBSD 4.x. [http://fxr.watson.org/fxr/source/vm/vm_zone.c?v=FREEBSD4].
For string parsing, the strbuf code in git and some of the code the jansson JSON parsing libraries are excellent. Jansson in particular is clear easy-to-understand state-machine parser too.
If you can start a project in a decent debugger, and once you start tracing the flow of the program, you would find a part of the code where you can begin your contribution, because thats where you will begin to see the turning wheels inside.
-- It is the mark of an educated mind to be able to entertain a thought without accepting it. -- Aristotle
start with main(int argc, const char* argv[]) and work your way backwards.... look at what is called and dive in deeper...
Warning: I'm taking a wild stab in the dark.
It's written in C... But, it seems relatively small and does one job very well. It's also scientific and I think it's got a good sized userbase.
Anyway, you could always port it to C++. (i.e. basically write from scratch an object-orientated version of gnuplot, perhaps using some of the libraries gnuplot has for the real gritty stuff.)
Or, you could program some kind of C++ based GUI for gnuplot. Think like matlab or excel, only kept simple, stupid.
PS: I don't reply to ACs.
I think you should have fun and play! Write tiny little programs to understand specific C++ features in isolation, focus on learning why they are there,
why they work the way they do, and what they're for. Read all the high-quality texts you can-- Stroustrup's books, anything in the Addison-Wesley
C++ series; follow C++ blogs like C++Next; read the Boost and comp.lang.c++.moderated groups; use lots of libraries, then find out how they work.
Then, look at progressively larger projects. Read the C++FAQ Lite. Read D&E. Get a copy of the standard.
I think you would enjoy Stroustrup's new book, "Programming: Principles and Practice in C++". It is pretty challenging, written with tremendous honesty, and
you will learn a lot about building software by reading it. I have been programming for over 25 years and I was very impressed with it.
The former for a good example, the latter for bad.
Linus' new divelog program is a good small project to read through. It does something useful in a concise way with C and has good coding standards that make it very readable.
Forget C++, it's becoming outdated and too complicated. More platforms are using Java and HTML5 now, it's the future of apps for PC's and Tablets.
-- By all means let's be open-minded, but not so open-minded that our brains drop out.
Look at the libstdc++ for GCC and some of the boost project code.
That code has production quality, is written in a style that actually utilizes c++. Beware that c++ recently got quite a few new features that have not gotten too much usage in libstdc++ and boot you may want to read up on that separately.
There is an *excellent* FAQ on most of the fine-grained aspects of c++ at http://www.parashift.com/c++-faq-lite/
In general, stay away from tutorials on the web, they are mostly written by people who have little or no experience and thinks they should teach the world about for loops or whatever because they just made one that doesn't crash themselves.
As a side note: that goes doubly for javascript, a much better search term to find quality code is ecmascript, unfortunatly there is no such good discriminating search-word for c++.
SLOGEN [ http://ungdomshus.nu : Sebastian cover music]
KDE is a big project, and has lots of apps where you can learn from. You can find small apps, big apps, libraries, WM, nearly everything in that project. It's well documented, easy to code thanks to Qt. You can start from the bottom with small tutorials, and move up in the chain when your experience improves.
http://www.aosabook.org/en/index.html
It won't help you much with c++, other than in its commonality with C; but they are great programs to study. The code is clean; there is a minimum of comments, and there are lots of programs ranging from the trivial, like echo, cat; through interesting like ed, awk, to more ambitious bits like compilers, cpu emulators, debuggers, etc...
Gnu code is often very difficult to understand - huge variable names, #ifdef insanity, strange control flows. over-blown.
Spend a little time with clean C, and you'll want to forget all about the foggy, incoherent monster C++ has become.
Out of curiosity I looked at your link to Node. Then at the explanation about what the project is. It fits in half a line: "evented I/O for v8 javascript" and I have no idea what that means, even after 25 years of pro programming.
Actually it says:
evented I/O for v8 javascript - Read more
http://nodejs.org/
Surely clicking one of those links would be faster than asking for it on Slashdot and waiting for an answer? When you click the "Read more" link that is not even half an inch from what you've quoted you can find a big "Resources for Newcomers" section with links to the wiki and the home page.
JavaScript is of course the programming language. V8 is its high-performance implementation developed by Google for Chrome. I/O means input/output and evented means that it is asynchronous I/O based on event loops. I think that after 25 years of pro programming you should know that, and if you don't then you should at least know how to follow the hyperlinks to find it out.
Fairly typical of undocumented open-source projects, unfortunately.
Well if the only place where you look for documentation is the title of the project on GitHub then yes, it is fairly typical.
Karma: Positive (probably because of superiour intellect)
Just like in hobby code, in the "real world" there is a lot of variation. You'll find some well architected programs, and some spaghetti as mentioned before.
If you want to be good at understanding any code, well, there is no one formula.
Have you worked on any medium to large sized programs? You'll find you had good intentions with designing something, but as your understanding of the problem grew, it had an inverse effect on the readability of your code. Add a function here, make a new class over there, whoops, forgot that class needed some other funcionality too. Why did I implement a copy constructor on that class, its *never* copied...I thought completeness was a good thing! Dang, I made that private, but my derived class needs access to that value, should I make it protected, or add a getter/setter?
Unfortunately, you may think in the real world this doesn't happen, but it does. If all the programmers on the team have a *complete* understanding of the problem from the beginning, they can write code that is easily followed, has a low defect rate, and is easily optimized. Sounds like utopia, right, thats because it is. The real world leads to the aforementioned thoughts which lead to the aforementioned spaghetti, defects, and difficult optimization.
No matter how good you are, spaghetti is spaghetti. You can become good at following the design thoughts that lead to the spaghetti, just as you can become use to the seemingly random road layouts in the northeast and thus still be able to find some path to where you want to go without GPS, but its still sub-optimal.
My reccomendation for any new programmer is to try to think like an architect. Study design patterns, break what you know of the problem down into pieces that fit a design pattern and implement it this way. This will at least help the future newbie programmer who also studies design patterns. It also makes it incredibly easy to refactor when necessary. If greater understanding of the problem leads you to realize either it needs to be broken up into 2 seperate design patterns, or just a totally different one, the refactoring is simple. Never be afraid to refactor! Don't hack code to fit. If it needs to be moved to a different pattern do it early, as I'll do it later becomes there isn't funding to do it ever. It may seem like you are slowing yourself down in the short term, but the benefits will be seen by your own productivity rate later in the development cycle when everyone else is still bogged down with following their own spaghetti from 3 monts ago, and you are implementing 6 months of their productivity in the next 3 months. Trust me, it works, and its easy.
To summarize, to be better with spaghetti, you need to study spaghetti, lots and lots of it until you notice it is becoming easier....writing spaghetti and studying your own is a great way to learn.
Second, follow design patterns and refactor as necessary to avoid creating spaghetti in the first place or fix it as necessary.
Lastly, be aware of OO slowdowns, study optimization techniques so that following good OO principals doesn't create slow code.
There was some discussion of this on Reddit a while back.
I second Mike Pall's comments. The Lua codebase is relatively small, and your puny brain can probably understand all of it from top to bottom. Other systems, like GCC and GHC, would be much more challenging to understand completely.
Try looking at different filter code and or writing your own filter for something like the GIMP.
You will be able to produce something pretty quick and graphics are a fun place to start.
After you get proficient with the plug-ins start looking at the main part of the application.
I'll second the recommendation to start small with a library or utility. Preferably a utility so it's easier to see how the pieces are supposed to fit together. With a library you frequently just get a group of classes without a good way to understand the underlying design.
I have to say that I think this is probably one of the best "Ask Slashdot" questions I've ever seen in my years here. It's directed to the right audience (the answers will actually be useful, as opposed to say, answers to a question about copyright law), it will have interest for a lot of of others who also want to learn and contribute, and it isn't a simple question that has only one good answer, so it will generate some useful discussion in addition to the usual /, noise.
We are the 198 proof..
It is extremely well documented what every function in there is supposed to do, and most of the functions are actually written in C. Though I suggest you avoid printf. You'll learn things about C that you really can't learn any other way.
Some of the other standard unix utilities are also pretty good. I seem to recall that reading the source to awk and vi were very enlightening.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
I learned on Fortran in the early 70's so that must be the right way considering how great I am now..............
Qt is a finely-honed, nth generation, complex, state-of-the-art library; the OP is unlikely to be anything but a nuisance to that project. Minix is where Linus started, ultimately spawning Linux. Actually the Minix suggestion may be in earnest; maybe it's a good place to learn about OSes. I doubt it's too susceptible to patches though.
Eg. FreeBSD / NetBSD / OpenBSD, solaris , etc -
One where there is a single source tree, that is built at once, and serves as a basis for the system
(*not* e.g. a 'source based linux distro' where the build is a script that runs somewhere and there isn't something like /usr/src/usr.bin, etc lying around)
you have all the base utilities - which includes networking servers, utilities, network stack, kernel stuff, userland stuff, databases (ala DBM), etc -
all right there, easily buildable, and actually runnable vis-a-vis your own system
need a new tar flag? just add it .. want to see how something works - just tweak it
it's all very unified. this is something that does not translate to the linux world, nothing against linux here - it just doesn't
I could suggest a few good English programs from which to learn.
There are many projects from which to learn. The way I would do the learning is to start with a small to medium sized project by a) get the user documentation
b) study the documentation and c) experiment/use the software.
After you understand the functional aspects of the product, your project should be to download the source, including makefile or build information. Then as a second stop, I would look in the source to find the explanation in the user manual, or vice-versa.
Looking at a source library collection without knowing the user functionality will be a most difficult learning process. I would say that this latter approach will lead to frustration and abandonment of your learning wishes.
Leslie Satenstein Montreal Quebec Canada
Oh, you forgot that repurpose the project at least annually to do something completely different, and change specs monthly.
Go w/ Minix 3 - you'll learn what a microkernel is, learn to write device drivers for it, and at the end, could end up writing them for a whole bunch of h/w-s/w combinations. Just the mere #combinations should keep you busy for a while, not to mention giving you a company that could sell/license its drivers either to Linux/BSD/Hurd companies, or to the h/w manufacturers.
I read the questioner as asking which programming languages should he learn, in addition to C++. Did I misread him?
I'd find the source code to this Debian package and start by reading it:
http://ftp.us.debian.org/debian/pool/main/h/hello/hello_2.6-1_i386.deb
Must admit, I don't know how they got it all the way up version 2.6 ... what features did they add? And WHAT bugs did they fix?????
I am anarch of all I survey.
You can't learn from any project if you are not excited by it, no matter how small. Purely for learning this should be the approach:
1. Understand what you like. Look for similar project which is successful.
2. Download the oldest public version of the project and understand that.
3. Follow the subsequent versions and understand what changes were incorporated into them.
4. Join the newsgroup/irc relevant where this project's developers hangout and follow their posts.
There are two things you need to learn. One is syntax and approach to problem solving. This looks tough but will be easy once you get into it. Second is the group's dynamics and culture. Which might look easy from the outset but might prove to be tough once you get into it.
First look a small C++ library, e.g. google "lightweight c++ library". e.g. http://vipbase.net/xmlparser/ Then compile it and run the sample. Enable debug messages or/and some debug messages. Play around and modify a few things.
It might be hard to navigate new code without knowing the design or at least having a reverse-engineered
view of how things are supposed to be organized. This recent (e-)book might be a good companion to dipping into actual code.
http://developers.slashdot.org/story/11/05/23/2227232/The-Architecture-of-Open-Source-Applications
Another advice is to start with something you can easily build and add prints to,
without changing something and seeing the results it can be hard to get hold of existing code.
Find a project that has its main history all the way back to the beginning. Use a git or mercurial repo as then you will have the complete history on your computer. The check out the first commit and work your way through the history and watch how it gets built up.
As you move through the history pay attention to the commit messages and the changes that were made. You begin to really understand what the developer is doing. Eventually the project will get to be so big that you won't be able to keep track of everything.
I did this with the git source itself. It was pretty neat to see it come together. Then when I found a bug it was easy to find the part in the code where the bug actually was found.
The main point is performance. Ryan Dahl wanted to write fast, scalable servers easily. We all know for years that threads don't scale but event loops do (see the second chart of memory consumption of apache vs nginx). Of course in order to have a highly concurrent evented server you can't use blocking system calls (which were a big mistake in my opinion to begin with - they are the only reason why you needed threads exposed at the application level for concurrency in the past). OK, so we want a portable, high performance, event-based, async-I/O, scalable, highly concurrent server. The obvious way to write such servers in a portable, OS-independent way was to write them in C using libraries like libev or libevent for event loops and libeio for non-blocking I/O. The result is great. But the problem is that it is not easy. C doesn't have lambdas, anonymous functions, closures or higher-order functions in a real sense, which all would make writing event handlers much easier. So Ryan was looking for a higher level language and found V8, the JavaScript virtual machine written by Google for Chrome. JavaScript has anonymous functions and closures. And V8 is fast. And also when you write JavaScript in the browser then you never use blocking function calls anyway, so people are already familiar with asynchronous I/O, events, callbacks, closures, futures and promises. Hell, you can even use Y combinators in JavaScript if you know your craft. Now, if only JavaScript had lazy evaluation and proper tail call optimization - maybe some day. Watch some talks by Ryan Dahl if you're interested and after 25 years in the field you should be. Oh, and Node doesn't have anything to do with the browser besides the V8 origins. It's all server-side. See the Wikipedia article on Node for more info and code examples. I'm glad that people who have been professionally programing for so many years are still willing to broaden their horizons. As I have written in the past it is not a universal property of programmers unfortunately. Have fun with new tools.
Karma: Positive (probably because of superiour intellect)
Do what all enthusiastic new comers to FOSS do:
1. Find a project that interests you.
2. Gain an incomplete idea of how it works.
3. Re-write it from scratch and say how much better your solution will be when it is finished.
4. Profit
You may think me a tired, old, cynic. I'd have to disagree about the tired bit.
For os kernel: linux and join Linux kernel mailing list. For distro development: debian and its mailing list. For social network: diaspora.
I suggest Cppcheck: http://cppcheck.sourceforge.net/
- It is quite small
- It is a command line application (there is a small GUI also in case you would prefer working with that, but I would recommend the CLI first)
- It has very good unit test coverage (about 90% line coverage), so if you break something with your modifications, you will most likely notice it.
- The general idea is rather simple, source code is input, then it is preprocessed, then simplified, then passed to a number of different classes that try to find errors from the source. So following the execution path should not be very difficult.
- As it is a tool for static C and C++ code analysis, you will learn a lot about C and C++ language while working with it
- It is a tool, which you as a C++ developer most likely want to use yourself, so helping it improve will give help also you.
Your point would be valid, except I think the tactic is generally not to CARE about trying to enforce an NDA or copyright or anything else. You simply want the really cheap labor to code the thing for you. What they do with it after that is rather irrelevant. For starters, assuming your project requires graphics, you probably have 2 different people outsourced to work on it for one. One guy is designing the GUI screens or the game characters and look of the backgrounds for the game levels, or what-not, while the other guy is coding the core of it. Since only YOU have the whole "ball of wax", neither one of them is able to completely steal the app.
If they go off and redesign your idea into something similar but a little bit different, and start trying to sell it? That's ok. You've probably got your app out there first, which has inherent value. But additionally, you can add value if you keep up good communications skills with your customers and occasionally offer product updates (which you could again outsource to yet another new developer, ensuring the first guy trying to screw you by submitting your original app idea as his doesn't have access to the revised one).
I know you are not trying to be funny, but that shit is sooo funny cause it is true. Sorry, I have not coded "professionally" for a while. I am still on meds and shock therapy to get over that experience.
You forgot to add the part about taking on some language / framework that you have no experience with at all and no time to even read a book about it.