|
I've never looked at it in total to be sure, but Stepanov's original Standard Template Library is probably brilliant. Unfortunately, the version that comes with Visual Studio has been messed up with non-core stuff and compiler dependencies, so it's quite hard to understand.
|
|
|
|
|
While this might be reasonable there is a problem for beginners:
They usually can not know if the code has the quality to be suitable for learning.
On the other hand there is code to be known as "good" but might be too complex for beginners (or even intermediates).
My suggestion for beginners:
Buy a good book (should be no problem to find recommended ones). The code examples from those are usually good.
|
|
|
|
|
Well, you can't read the code you can't find ... which brings up the thought that you're best off reading code that interests you out of the gate.
(Short lesson on the dynamics of rectified electronic circuits over)
|
|
|
|
|
I feel your should learn from both Michelangelo (about what to do) and the street graffiti artist (about what not to do).
Look at some of the posts here[^], along with their responses.
This book[^], written in 1999, is a great read. Timeless, I feel.
|
|
|
|
|
Most of all you should read real working code, like which code you will write. The actual use of your language, API and libraries is important. Often you find on github nice code.
But more important than reading is writing: only by practicing you see your weaknesses.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
The most productive code-reading I've ever done has been when I was implementing a well-known algorithm, and I looked at other implementations of the algorithm for suggestions and gotchas. If you know the algorithm fairly well, that helps you follow the code. The code in turn can help you understand corner cases and real-world optimizations that come up when implementing the algorithm.
Find an algorithm that you need to use, and then go looking for code that implements it. You'll find both good and bad in such a search, but reading the bad can be as useful as the good ("here's what not to do"). Learning to discriminate between the two is useful as well.
Software Zen: delete this;
|
|
|
|
|
Indeed. A fellow CP-er just posted this link in these very halls a couple days ago. Good reading for sure. But I would still like to get a bigger picture -- code samples that would help me to understand architectural solutions on a grander scale. Code that I can go sit in for a while -- like the cathedral at Notre Dame -- and just be able to look around in awe.
|
|
|
|
|
I would think almost any of the major open source projects would fit the bill.
Sadly, just like in the cathedral at Notre Dame, you are probably going to find a few pews with chewing gum stuck underneath.
Software Zen: delete this;
|
|
|
|
|
Pick a project on GitHub that interests you and start reading! Now, granted, you will most likely not be studying from a master, but you never know what you'll learn.
Marc
|
|
|
|
|
Well, why not read what the best brains in your area of focus are writing ?
People like Jon Skeet in his books, in his books web-site on Manning Books, in his columns /blogs, and from the sources linked to here: [^].
I like to read and study code from people on CP, as found in so many great articles. And I "follow" the answers and comments of folks like Pete O'Hanlon, Richard Deeming, Richard MacCutchan, Sascha LeFevre, Marc Clifton, and others, closely: always learning something new, being challenged from them.
I think studying Marc's code is extremely interesting because, imho, there is a quality of "originality" that comes through; he's a man who often takes "the road less travelled."
Marc Gravell on StackOverflow is another favorite "guru" of mine along with others there, like Hans Passant, and Nawfal. Eric Lippert is, imho, like Skeet, a "guru of gurus," and his blogs are great reading.
Open-source projects: Marc Gravell's Proto-Buf; Skeet's YodaTime; so many !
I think reading selected code in well-written books is as valuable as studying other people's code; people like Michaelis, Watson, Freeman, Troelsen, Albihari, Liberty, MacDonald, Sells, Noyes, Abrams, Lippert, as well as the one-and-only John Skeet.
I think the .NET Language book by Hejlsberg, Torgensen, et. al., is quite unique because of its stellar cast of Annotators, including many of the book authors I just mentioned: "The C# programming language" 4th ed. ISBN 978-0-321-74176-9; there are wonderful comments ... in call-outs ... by those annotators throughout the book.
Speaking as an "older" (unfortunately, not wiser) person, I think the availability of resources for continuous self-education today are just remarkable.
cheers, Bill
«In art as in science there is no delight without the detail ... Let me repeat that unless these are thoroughly understood and remembered, all “general ideas” (so easily acquired, so profitably resold) must necessarily remain but worn passports allowing their bearers short cuts from one area of ignorance to another.» Vladimir Nabokov, commentary on translation of “Eugene Onegin.”
|
|
|
|
|
Wow, what a superbly helpful reply! Thank you for taking the time to write it!
Your post is one more contribution to the "remarkable availability of resources for continuous self-education."
|
|
|
|
|
I started my development career in unit testing.
One of the things we had to do is code review on every unit (function).
I also had to test it of course which forced me to look at the code / design requirements, and to write tests for it.
But... starting with testing teaches you a whole lot of bad habits. The quality of my tests were never looked at, so I didn't really care about how/what I coded at the time.
But when I started coding, I could use the things I learned while testing others code and the transition went smoothly.
"Program testing can be used to show the presence of bugs, but never to show their absence."
<< please vote!! >></div>
|
|
|
|
|
Study the design (code may not be necessary) of the C++ STL API. (good API design - hard to create inefficient code)
Followup:
Compare it with the Java collections API design. (especially LinkedList methods that use or return indexes/offsets!) (okay API design - too easy to create inefficient code)
|
|
|
|
|
I advice you to write more code, not read. Write everything you wanna learn. In the reality programming is separated as follows:
First half is the "art" people. They do write code. They usually do it for personal pleasure, earning money is just a pleasant side effect. They lead the innovation. As you learn more APIs, platform and languages, as you usually heard, they have a single inventor, not a company. It is not useful skill to find a work with, neither appreciated in most companies.
Second half is the "science" people. They do not need to read and write code, because they know the theory. The theory is really complex explanation of something really simple, which once you learned the complex stuffs seems you may thought of it without learning, but you didn't. You can explain the innovations of the "art" people and can handle anything new you are thrown into. To the company (especially management) you are like fast-learner, so you are valuable. This type of skill is really useful to find a job.
Third half is the "business" people. You read a lot of other people code, trying to understand their ideas. You do not need your own ideas, you follow the ideas of other people, which are usually so many that they will overwhelm you. As you get older (and more experienced) you will begin to prefer legacy code you know, than the new APIs you'll have to learn. To the management you are the one that do the all the work. This skill is not useful to find a job, but really useful to keep it.
|
|
|
|
|
As always, It Depends.
I recommend this a lot to new coders. People learning a new language.
I also recommend learning/reading code that solves problems you understand, or you truly want to understand. LZW Compression was eye opening.
Also, are you reading for a Novel experience or to emulate the Greats? Learning a new language or fine tuning your skills? It all matters.
Are you going to skim and then focus or focus on every line of code, executing it in your head?
Reading many of your replies, it sounds like you are pretty far along in programming. You are more interested in learning from the masters. To me, that means delving down into the more complicated code like Roslyn.
I enjoy reading well written libraries the most. Even the elegance of x = passed || default; to initialize something conditionally is cool. A line of code is like a single thought. Developing such thoughts to harness a little more value than 3 lines of code is cool.
Of course, always read the old C standard library code!
|
|
|
|
|
|
|
kdmote wrote: If I were a painting instructor, I would advise my students to study the masters: ... Bill Watterson
I agree!
|
|
|
|
|
Speaking of the 5th - I have always wondered: Does the 5th Amendment apply equally to non US citizens? Can I as a Scandinavian Viking [with a blunt sword] plead the 5th, if ever faced with a US court? Thanks.
Life is too shor
|
|
|
|
|
When I went to the States, they searched me at the Airport and on finding I was unarmed they gave me a gun.
|
|
|
|
|
Although as a foreign national, you are technically not protected by the Constitution, which only applies to citizens, all countries where the Rule of Law prevails afford foreign nationals the same protections in law offered to their own citizens. In short, yes, you cannot be forced to incriminate yourself. You can "plead the 5th."
"Pleading the 5th" is not a strategy that works very well in criminal prosecution. Generally if the police arrest you, there is evidence other than your own words that points to you. The investigation and prosecution will probably go on whether you confess or not.
Famous media depictions of witnesses pleading the 5th come from testimony before Congress, which are not themselves criminal prosecutions. In this circumstance, "pleading the 5th" is a gambit, an excuse given to refuse to answer a question, whether or not the testimony might be incriminating in a subsequent criminal prosecution.
|
|
|
|
|
Only if you are a MLB baseball player.
|
|
|
|
|
Yes
There are two types of people in this world: those that pronounce GIF with a soft G, and those who do not deserve to speak words, ever.
|
|
|
|
|
I am not sure but I have heard of a place called Guantanamo Bay...
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Yes.
In addition to the equal protection granted in the 14th Amendment, the Supreme Court has held that non-citizens are entitled to due process under the Fifth Amendment. They have the right to hold non-government jobs and send their children to public school. In contrast, the SC has denied non-citizens the right to have state-funded vocations such as teachers or police officers. The SC has also held that foreign nationals could be detained or deported based on nationality, such as in the case of the USA Patriot Act of 2001.
From Does the Constitution Protect Foreigners?[^]
/ravi
|
|
|
|
|