Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What code should I read?

What code should I read?

Scheduled Pinned Locked Moved The Lounge
comquestioncode-review
32 Posts 21 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OriginalGriffO OriginalGriff

    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...

    K Offline
    K Offline
    kdmote
    wrote on last edited by
    #10

    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.

    S 1 Reply Last reply
    0
    • K kdmote

      [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?

      A Offline
      A Offline
      Amarnath S
      wrote on last edited by
      #11

      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.

      1 Reply Last reply
      0
      • K kdmote

        [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?

        K Offline
        K Offline
        KarstenK
        wrote on last edited by
        #12

        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

        1 Reply Last reply
        0
        • K kdmote

          [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?

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #13

          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;

          K 1 Reply Last reply
          0
          • G Gary Wheeler

            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;

            K Offline
            K Offline
            kdmote
            wrote on last edited by
            #14

            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.

            G 1 Reply Last reply
            0
            • K kdmote

              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.

              G Offline
              G Offline
              Gary Wheeler
              wrote on last edited by
              #15

              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;

              1 Reply Last reply
              0
              • K kdmote

                [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?

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #16

                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!

                1 Reply Last reply
                0
                • K kdmote

                  [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?

                  B Offline
                  B Offline
                  BillWoodruff
                  wrote on last edited by
                  #17

                  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.”

                  K 1 Reply Last reply
                  0
                  • B BillWoodruff

                    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.”

                    K Offline
                    K Offline
                    kdmote
                    wrote on last edited by
                    #18

                    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."

                    1 Reply Last reply
                    0
                    • D Duncan Edwards Jones

                      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.

                      K Offline
                      K Offline
                      kdmote
                      wrote on last edited by
                      #19

                      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!

                      1 Reply Last reply
                      0
                      • K kdmote

                        [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?

                        R Offline
                        R Offline
                        R Erasmus
                        wrote on last edited by
                        #20

                        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!! >>

                        1 Reply Last reply
                        0
                        • K kdmote

                          [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?

                          E Offline
                          E Offline
                          englebart
                          wrote on last edited by
                          #21

                          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)

                          1 Reply Last reply
                          0
                          • K kdmote

                            [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?

                            P Offline
                            P Offline
                            Plamen Dragiyski
                            wrote on last edited by
                            #22

                            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.

                            1 Reply Last reply
                            0
                            • K kdmote

                              [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?

                              K Offline
                              K Offline
                              Kirk 10389821
                              wrote on last edited by
                              #23

                              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!

                              1 Reply Last reply
                              0
                              • K Kevin Marois

                                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

                                P Offline
                                P Offline
                                patbob
                                wrote on last edited by
                                #24

                                Kevin Marois wrote:

                                I've seen code from MS that leaves me scratching my head and wondering WTF was this guy thinkin?

                                That just means that he should be reading your code :)

                                We can program with only 1's, but if all you've got are zeros, you've got nothing.

                                1 Reply Last reply
                                0
                                • D Duncan Edwards Jones

                                  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.

                                  S Offline
                                  S Offline
                                  SeattleC
                                  wrote on last edited by
                                  #25

                                  If you're the person who wants to drive a humvee or a unimog, then microsoft code is for you. It's ugly. It's functional. It's uninspired. It's very durable. I have never seen microsoft code that was in any way elegant or subtle. It's ok code to learn on, but will never inspire you with beauty.

                                  1 Reply Last reply
                                  0
                                  • K kdmote

                                    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.

                                    S Offline
                                    S Offline
                                    SeattleC
                                    wrote on last edited by
                                    #26

                                    kdmote wrote:

                                    Would you advise an auto-designer not to study a Lamborghini?

                                    It's easy to spot a lamborghini by its smooth lines and the sound its motor makes. With code, you have to get it into your head before discovering if it's a lamborghini or a rusty Yugo with 100,000 miles on it. For every epic software poem, there are 10,000 drab tomes of uninspired code.

                                    K 1 Reply Last reply
                                    0
                                    • K kdmote

                                      [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?

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #27

                                      Anything with 101 samples... Official Visual Studio 2010 Samples for C# 4.0 in C#, VB.NET, C++[^] 101 LINQ Samples in C#[^]

                                      K 1 Reply Last reply
                                      0
                                      • S SeattleC

                                        kdmote wrote:

                                        Would you advise an auto-designer not to study a Lamborghini?

                                        It's easy to spot a lamborghini by its smooth lines and the sound its motor makes. With code, you have to get it into your head before discovering if it's a lamborghini or a rusty Yugo with 100,000 miles on it. For every epic software poem, there are 10,000 drab tomes of uninspired code.

                                        K Offline
                                        K Offline
                                        kdmote
                                        wrote on last edited by
                                        #28

                                        EXACTLY. Which is why I'm asking for recommendations. I'd like somebody to start compiling a list of the epics, so we can all benefit from studying them.

                                        S 1 Reply Last reply
                                        0
                                        • L Lost User

                                          Anything with 101 samples... Official Visual Studio 2010 Samples for C# 4.0 in C#, VB.NET, C++[^] 101 LINQ Samples in C#[^]

                                          K Offline
                                          K Offline
                                          kdmote
                                          wrote on last edited by
                                          #29

                                          Love it! Thanks!

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups