What code should I read?
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
IMHO, the advice is misleading. I think the author meant you should try to learn from other people's code in the context of the work you're doing. For example, if you've been tasked with fixing a SQL injection bug in a method (easy enough to do), look for other places in the codebase where this has been done and see if the developer implemented other safeguards (e.g. validating or auto-fixing parameter values). /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
There's a lot of the .NET world that is now open source (Roslyn code compilers, Entity Framework)...I'd say reading through how they organise their code would be somewhat informative.
-
IMHO, the advice is misleading. I think the author meant you should try to learn from other people's code in the context of the work you're doing. For example, if you've been tasked with fixing a SQL injection bug in a method (easy enough to do), look for other places in the codebase where this has been done and see if the developer implemented other safeguards (e.g. validating or auto-fixing parameter values). /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
I'd have to agree somewhat with Ravi - but I don't think reading code improves your skills significantly. The problem is that code is an end product - and often the almost irrelevant bit that has been churned out by the lowest level coder. The important stuff often happens a long time before the code is written, and the final product tells you nothing about the decisions, the false starts, the wrong directions which lead up to the final product. And it's those that make good code, not the mechanics of coding in a specific language. Yes, there are "generic style points" you can pick up and apply, but the code itself in isolation doesn't tell you much at all about how to produce quality code on a different project.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
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.
-
Eddy Vluggen wrote:
Copy/paste
Or refactor. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
-
There's a lot of the .NET world that is now open source (Roslyn code compilers, Entity Framework)...I'd say reading through how they organise their code would be somewhat informative.
I dunno... I've seen code from MS that leaves me scratching my head and wondering :omg: :omg: :omg: :confused::confused::confused: WTF was this guy thinkin?
If it's not broken, fix it until it is
-
I'd have to agree somewhat with Ravi - but I don't think reading code improves your skills significantly. The problem is that code is an end product - and often the almost irrelevant bit that has been churned out by the lowest level coder. The important stuff often happens a long time before the code is written, and the final product tells you nothing about the decisions, the false starts, the wrong directions which lead up to the final product. And it's those that make good code, not the mechanics of coding in a specific language. Yes, there are "generic style points" you can pick up and apply, but the code itself in isolation doesn't tell you much at all about how to produce quality code on a different project.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Come on, OG. I expected this from some of the others, but not from _you_! Would you advise an auto-designer not to study a Lamborghini? Would a growing architect gain nothing from a study of the Burj Al Arab, or the One World Trade Center? Can an aspiring composer learn nothing from analyzing the techniques Beethoven, Bach, and Bublé? The same argument about "the final product" could be made about each of those fields, but it wouldn't hold up. Of course I would love to study the personal notes of Tolkien where he divulges all his inner grapplings with plot twist connundrums, but in lieu of that I am still a much better author having merely _read_ LOTR three times. All I am saying, is that when it comes to code, it is much more difficult (for me, anyways) to find the open source code that is worthy of being studied. So I am simply asking for recommendations. Have you ever read a program -- perhaps in a completely different field than your own -- which made you say, "Wow, that was put together well. It's intuitive, clean, elegant, and robust." I think somebody needs to start compiling a list of such masterpieces for the rest of us to study and admire.
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
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. :thumbsup:
Press F1 for help or google it. Greetings from Germany
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
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;
-
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.
-
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;
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
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
Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
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.”
-
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.”
-
There's a lot of the .NET world that is now open source (Roslyn code compilers, Entity Framework)...I'd say reading through how they organise their code would be somewhat informative.
Great suggestion. In fact, at the time your post came in, I just happened to be reading this blog post, which pointed me in the same direction. I also just happened to come across this tool, which I should think would come in very handy when spelunking some of the more cavernous codebases out there (like Roslyn). Thanks!
-
[I hope this doesn't cross the line of what I _shouldn't_ post about here...] I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: _What_ code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders? What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
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!! >>