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. Finding Well-Written Software

Finding Well-Written Software

Scheduled Pinned Locked Moved The Lounge
csharpc++javaalgorithmsquestion
28 Posts 18 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.
  • J Jeremy Falcon

    The problem with that is a lot of it is subjectivity. For instance...

    // some think this is cleaner
    var x = (y == 5) ? 0 : 1;

    // and, some think this is cleaner
    var x;
    if(y == 5) {
    x = 0;
    } else {
    x = 1;
    }

    // or this
    var x;
    if(y == 5)
    {
    x = 0;
    }
    else
    {
    x = 1;
    }

    // or this too
    var x;
    if(y == 5)
    x = 0;
    else
    x = 1;

    And who's really right or wrong?

    Jeremy Falcon

    M Offline
    M Offline
    Mark_Wallace
    wrote on last edited by
    #15

    Jeremy Falcon wrote:

    And who's really right or wrong?

    COBOL's right, of course:

    IF y = 5 THEN
    x = 0
    ELSE
    x = 1
    END-IF.

    (Whatever you do, don't forget the fullstop)

    I wanna be a eunuchs developer! Pass me a bread knife!

    B 1 Reply Last reply
    0
    • M Mark_Wallace

      Whoa! Are you saying that the ribbon and baby blocks are "ideal world"? Only smoke the wool from the black or white sheep, Griff. Leave the green ones be.

      I wanna be a eunuchs developer! Pass me a bread knife!

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #16

      Nope, they're solidly Ivory Tower! :Laugh:

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • M Mark_Wallace

        Jeremy Falcon wrote:

        And who's really right or wrong?

        COBOL's right, of course:

        IF y = 5 THEN
        x = 0
        ELSE
        x = 1
        END-IF.

        (Whatever you do, don't forget the fullstop)

        I wanna be a eunuchs developer! Pass me a bread knife!

        B Offline
        B Offline
        Brisingr Aerowing
        wrote on last edited by
        #17

        Mark_Wallace wrote:

        COBOL

        How DARE you mention that... that... THING here in the Lounge! To the Soapbox with you!

        What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

        pkfoxP 1 Reply Last reply
        0
        • T TheOnlyRealTodd

          So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.

          H Offline
          H Offline
          H Brydon
          wrote on last edited by
          #18

          To me, studying what good code looks like and the best practices thereof has more value than looking at somebody else's code. I consider the reference article here[^] to be of more value than a bunch of code. If you want to lose your mind, read the source for the stl libraries.

          I'm retired. There's a nap for that... - Harvey

          1 Reply Last reply
          0
          • B Brisingr Aerowing

            Mark_Wallace wrote:

            COBOL

            How DARE you mention that... that... THING here in the Lounge! To the Soapbox with you!

            What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

            pkfoxP Offline
            pkfoxP Offline
            pkfox
            wrote on last edited by
            #19

            Nothing wrong with COBOL :-)

            We can’t stop here, this is bat country - Hunter S Thompson RIP

            1 Reply Last reply
            0
            • T TheOnlyRealTodd

              So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.

              G Offline
              G Offline
              GetReQ
              wrote on last edited by
              #20

              As a recommendation I'd always suggest having a look at the GitHub repo for Doom & Doom3 (from John Carmack at id Software). Doom written in C and Doom3 in predominantly C++. GitHub - id-Software/DOOM: DOOM Open Source Release[^] GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition[^] Although a lot of the work is in game development and graphics (and in C), I found it useful to look at how it highlights good project and code layout. Like people have said already in this thread, I wouldn't look at the code to "learn how to write code" but rather to learn what good "coding practices" result in. Keep in mind some of this code has been cleaned up before publishing on GitHub.

              K

              T M 2 Replies Last reply
              0
              • J Jeremy Falcon

                The problem with that is a lot of it is subjectivity. For instance...

                // some think this is cleaner
                var x = (y == 5) ? 0 : 1;

                // and, some think this is cleaner
                var x;
                if(y == 5) {
                x = 0;
                } else {
                x = 1;
                }

                // or this
                var x;
                if(y == 5)
                {
                x = 0;
                }
                else
                {
                x = 1;
                }

                // or this too
                var x;
                if(y == 5)
                x = 0;
                else
                x = 1;

                And who's really right or wrong?

                Jeremy Falcon

                S Offline
                S Offline
                ScottM1
                wrote on last edited by
                #21

                The third option is correct.

                Jeremy Falcon wrote:

                And who's really right or wrong?

                I am.

                1 Reply Last reply
                0
                • G GetReQ

                  As a recommendation I'd always suggest having a look at the GitHub repo for Doom & Doom3 (from John Carmack at id Software). Doom written in C and Doom3 in predominantly C++. GitHub - id-Software/DOOM: DOOM Open Source Release[^] GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition[^] Although a lot of the work is in game development and graphics (and in C), I found it useful to look at how it highlights good project and code layout. Like people have said already in this thread, I wouldn't look at the code to "learn how to write code" but rather to learn what good "coding practices" result in. Keep in mind some of this code has been cleaned up before publishing on GitHub.

                  K

                  T Offline
                  T Offline
                  TheOnlyRealTodd
                  wrote on last edited by
                  #22

                  Thank you! Yeah, it seems writing good code stems from both design and good coding practices... Currently, I am reading the books Code Complete and Clean Code by Uncle Bob. Code Complete seems to focus more on the design aspect stuff, and Clean Code seems to focus more on the actual code-writing practices. However, Simply looking at projects gives me at least some insight into the coders' styles out there and what type of code I will run into out there.

                  1 Reply Last reply
                  0
                  • G GetReQ

                    As a recommendation I'd always suggest having a look at the GitHub repo for Doom & Doom3 (from John Carmack at id Software). Doom written in C and Doom3 in predominantly C++. GitHub - id-Software/DOOM: DOOM Open Source Release[^] GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition[^] Although a lot of the work is in game development and graphics (and in C), I found it useful to look at how it highlights good project and code layout. Like people have said already in this thread, I wouldn't look at the code to "learn how to write code" but rather to learn what good "coding practices" result in. Keep in mind some of this code has been cleaned up before publishing on GitHub.

                    K

                    M Offline
                    M Offline
                    maze3
                    wrote on last edited by
                    #23

                    thought somone would post this guys article on Doom Exceptional Beauty of Doom 3's Source Code [^] I had thought this guy wrote it about original Doom, and not Doom 3, but still some insightful points.

                    1 Reply Last reply
                    0
                    • T TheOnlyRealTodd

                      So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.

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

                      First, reading lots of code is the RIGHT approach. Kudos. To put it into reading/writing books, I would say that someone who actually writes a (decent) book has read THOUSANDS of books first. It just makes sense. Second, you can learn from ANY code. Even if you learn "Ouch. That's terrible". B-Movies exist. They remind us what works in good movies, and what doesn't work. Third, consider reading the (source code for) well understood concepts. Compilers (GCC?). Compiler theory is pretty stable. the concepts of cross compilers, linkers, etc. are all well understood. Optimizers, for example, re-teach indirection (converting code to pseudo assembler, optimizing that, then generating the assembler already optimized). Allowing the optimizer to be shared! Finally, a discussion about engineering... Most people think that engineering is about perfection. It is actually about making things Good Enough. Optimizing the 3 corners of the triangle of (Fast, Right and Cheap). You can only optimize 2 of the 3, and you agree to sacrifice the third. You can optimize only 1, and sacrifice the other 2. I learned about this from an engineer neighbor who was designing a factory floor with equipment mounting technology. His junior engineer was calculating the EXACT bolt sizes required based on the machine and the other variables. He made him go back and find the Most Common Denominator to reduce installation issues and mistakes. In words developers can understand. I have a compiler to sell you. It's NEW warnings are guaranteed to reduce the number of bugs by 10% in your code. It costs $1 Million per seat. Interested? I hope not! So, keep reading code. Then find useful code, like Notpad++, and work on compiling it and testing it. Then find a list of bugs for that Product and start fixing them and testing your solutions. You should quickly learn a couple of things. Like having a set of automated tests makes you feel safer to make changes and know if you actually broke something. I would finish it off with. BREAK the software. Find what tests fail, and how. It's insightful!

                      1 Reply Last reply
                      0
                      • T TheOnlyRealTodd

                        So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.

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

                        You are asking a FANTASTIC question, and you should be HIGHLY commended for your EXEMPLARY judgement and acumen for seeking such recommendations. (Of course, I can say that because I asked the same question myself about six months ago! :-D ) Among the many helpful replies that I got in that thread, the one from BillWoodruff[^] was the most extensive and helpful.

                        1 Reply Last reply
                        0
                        • T TheOnlyRealTodd

                          So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.

                          G Offline
                          G Offline
                          gggustafson
                          wrote on last edited by
                          #26

                          Starting in 1975, when I had an epiphany, I have been writing code that I find I could easily maintain. The code was written for clients, both in-house and external. It ranged from real-time to interactive financial systems; from assembly language to high level languages (yes, even COBOL and FORTRAN). The key to my success was, I believe, the strict use of coding standards. These coding standards were applied to all my code, not just deliverables to clients but also to code developed during research and experimentation. When a chief programmer (team leader, these days), I required the entire team to use an unambiguous set of coding standards. I have published some of these standards on CP under the guise of "guidelines." But more importantly, I offer as examples the code in any of the articles I have published on CP. As I said, I use the standards whenever I develop code. It is now so automatic that I seldom need to think about it (so much for the argument that standards slow you down). There is an unfortunate perception that applying standards makes software cost more. Agreed, as an organization starts using standards, code reviews are needed to assist programmers in achieving standards compliance. But once it's happened, you'll be amazed at the result. Not only is the software maintainable (reducing the long-term cost) but it is reusable (as a colleague once said "good software that you do not need to write is very cheap").

                          Gus Gustafson

                          1 Reply Last reply
                          0
                          • J Jeremy Falcon

                            The problem with that is a lot of it is subjectivity. For instance...

                            // some think this is cleaner
                            var x = (y == 5) ? 0 : 1;

                            // and, some think this is cleaner
                            var x;
                            if(y == 5) {
                            x = 0;
                            } else {
                            x = 1;
                            }

                            // or this
                            var x;
                            if(y == 5)
                            {
                            x = 0;
                            }
                            else
                            {
                            x = 1;
                            }

                            // or this too
                            var x;
                            if(y == 5)
                            x = 0;
                            else
                            x = 1;

                            And who's really right or wrong?

                            Jeremy Falcon

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

                            your first example is not the same as the others:- ?: is NOT if-then-else...

                            // is cleaner; is wrong!
                            var x = (y == 0) ? 0 : z / y;

                            // is ugly; is correct!
                            var x;
                            if (y == 0) x = 0; else x = z / y;

                            If it were easy then anybody could do it. Wait, .... what!

                            J 1 Reply Last reply
                            0
                            • L Lost User

                              your first example is not the same as the others:- ?: is NOT if-then-else...

                              // is cleaner; is wrong!
                              var x = (y == 0) ? 0 : z / y;

                              // is ugly; is correct!
                              var x;
                              if (y == 0) x = 0; else x = z / y;

                              If it were easy then anybody could do it. Wait, .... what!

                              J Offline
                              J Offline
                              Jeremy Falcon
                              wrote on last edited by
                              #28

                              I'm not sure if this is sarcasm or not. :~

                              Jeremy Falcon

                              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