Those who know, know.

  • Codex@lemmy.world
    link
    fedilink
    arrow-up
    121
    arrow-down
    1
    ·
    4 months ago

    I should get to work on my opus, “Dirty Code”

    Inside I’ll reveal all my secrets like: not writing tests, not documenting anything, putting the whole app into a single python file, object-disoriented relational mapping, obscure SQL tricks, unobscure no-sql tricks, and more!

  • Mia@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    80
    arrow-down
    1
    ·
    4 months ago

    I’m of the opinion that Uncle Bob did some massive damage to software development as a whole with that book.
    With that said, this is genuinely funny.

    • Phegan@lemmy.world
      link
      fedilink
      arrow-up
      20
      arrow-down
      1
      ·
      4 months ago

      Agreed. I found that many developers, in the pursuit of clean code, lost slight of some of the fundamentals principles of good code. I found that people were eschewing readability and modularity and calling it clean code.

      Clean code became the target, not the underlying principles and the reason why we needed clean code in the first place. It became an entirely new thing that aided in producing some of the worst code I’ve read.

      Oftentimes, when devs talk about “clean code” it’s a red flag for me in hiring. Some of the worst devs I’ve worked with have been clean code evangelists.

  • NigelFrobisher@aussie.zone
    link
    fedilink
    arrow-up
    60
    arrow-down
    2
    ·
    4 months ago

    New edition is just an incoherent rant about the “woke mind virus” trying to destroy him for “just saying what everyone is thinking”.

    • Caveman@lemmy.world
      link
      fedilink
      arrow-up
      29
      arrow-down
      2
      ·
      edit-2
      4 months ago

      He wrote for example the books Clean Code and Clean Architecture which are IMO opinion really good books although I don’t agree with every point he makes.

      Some really good points he makes are for example:

      • Functions that only do one job
      • Testing makes refactoring easier
      • The standard SOLID OOP stuff.
      • Tech debt is bad
      • Abstraction and encapsulation is good and allows developers to interact with the code on a higher level in terms of actions instead of writing verbose stuff. Essentially saying less code leads to less bugs
      • Insulate yourself from change
      • Duplication is bad
      • Two use cases that are very similar is not duplication and common code shouldn’t be factored out.
      • Don’t mix high level code with low level.
      • Build solid Entity classes to model the data and their interactions.
      • Don’t write multithreaded code if you don’t have to.
      • If you have to do your best to write it so they don’t share memory.

      Those comes with examples. He’s a tad bit overly idealistic in my opinion. These books fail to mention a couple of things:

      • Refactoring is expensive and the cost is often not justified.
      • Premature abstraction is the absolute devil
      • You don’t need to insulate from things that are very unlikely to change (like going from SQL to Document DB)
      • Less changes also lead to less bugs.
      • Too much emphasis on functions being few lines of code instead of just being simple.

      All in all though, very solid books. I read Clean Code in university and Clean Architecture in my first job and it really helped me wrap my head around different ways to solve the same problem. Excellent ideas but it’s not the holy truth. The only reason I remember all of these points is that I encountered all of them on the job and saw the benefit.

      In my opinion new programmers should read it and take inspiration. Craftsman level developers should criticise and maybe pick up a few brain concepts to sort some concepts out in their brain. Experts will get little benefit though.

      • Waldowal@lemmy.world
        link
        fedilink
        arrow-up
        26
        ·
        4 months ago

        The consultancy I used to work for in the late 90s would have crucified any developer that didn’t write “a data abstraction layer that allows you to pop off the original db and substitute a different one later”.

        How many times in my 25 year career have I swapped out the database (and been thankful for such an abstraction layer)? 0 times.

        • evatronic@lemm.ee
          link
          fedilink
          English
          arrow-up
          6
          ·
          4 months ago

          I am literally in the middle of swapping DynamoDB for a RDBMS.

          The idea that you can abstract away such fundamentally different data stores is silly. While I hate doing it now, reworking the code to use relational models properly makes for a better product later.

          • Caveman@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            4 months ago

            I’m going to suggest not using an ORM. I used three so far and it really likes to tell you what you can and can’t do when query builders can do the same thing by creating the SQL string for you. SQL is also very nice and easy (just parameterise all inputs to avoid the SQL injection)

        • prof@infosec.pub
          link
          fedilink
          arrow-up
          2
          ·
          4 months ago

          While he advocates for it, that’s also a point that Martin brings up multiple times when he talks about his project “fitnesse”.

          Basically saying that they left it open how stuff can be saved, but the need has never arisen to actually pivot to a different system.

      • marlowe221@lemmy.world
        link
        fedilink
        English
        arrow-up
        10
        ·
        edit-2
        4 months ago

        I generally agree with the idea that code should be as simple as it can be to accomplish the goal of the code… I just haven’t been convinced that Clean Code is the way to get there, necessarily. The book does contain some good advice , to be sure, but I wouldn’t call it universal by any means.

        I also think TDD is a very optimistic strategy that just doesn’t match up with reality terribly often.

        Actually, I think that’s what confuses me the most about all of Uncle Bob’s books. I’ve read a couple of them and thought, “All this sounds great but real world development just doesn’t seem to work that way.” Like, all of his advice is for best case scenarios that I certainly haven’t encountered in my career.

        I say confusing, because surely he’s been in the profession long enough to have seen the disconnect between what he’s preaching and real life, right???

        • Caveman@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          4 months ago

          Yeah, I 100% agree. For small projects most of the principles don’t matter as much because the complexity is just not there. For big projects you actually need to take a big ass tech debt loan to actually get things done on time and on budget.

          The testing aspect I’m not as sold on either. I enjoy tests sometimes but they also come with increased development and maintenance cost. He emphasises unit tests but I’ve found that a few integration tests that use API calls to simulate a use case gets you most of the way there.

          That being said I’ve seen raw HTML email string with hardcoded values in a 2000 line method that relies heavily on if statements. That one method probably breaks around 10 of his rules and I absolutely hate it. Very hard to add features to if you can imagine and incredibly noisy and hard to debug. Shouldn’t be like that but it is. I wouldn’t apply all of Bob’s rules but I would refactor it into a service with clear boundaries so I don’t have to deal with the function having “local globals” if you know what I’m getting at.

  • quicken@aussie.zone
    link
    fedilink
    arrow-up
    21
    arrow-down
    2
    ·
    4 months ago

    I was a big Uncle Bob fan and still really like the Clean Code book. But he trashed his public reputation so I doubt this 2nd edition will do very well.

    • Max Günther@lemmy.today
      link
      fedilink
      Deutsch
      arrow-up
      4
      arrow-down
      1
      ·
      4 months ago

      I am also a big fan of his books, especially Clean Code. His (far-)right opinions are bad, but should be (to some extent) viewed separately from his technical standpoints. However, even then a new edition would not perform well, there are too many people hating Clean Code (without really understanding its message/just ranting without having read it). But I was very surprised that ThePrimeagen recently interviewed his “opponent”, it was very nice to watch.

  • EnderMB@lemmy.world
    link
    fedilink
    arrow-up
    19
    arrow-down
    2
    ·
    4 months ago

    Working in Ruby did 10x more to help me write clean code than reading Clean Code ever did.

    Many of the lessons drilled into me with Ruby (keep a consistent style, tests are cheap, keep your methods relatively small where possible, reduce nesting where possible) carry over nicely into other languages without needing to go through any OO bullshit.

    IMO, the best lesson around Clean Code is this: you’re not clever, write obvious code that works with as few tricks as possible.

    • Mia@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      5
      ·
      4 months ago

      I find this to be true for every new language I try out. Since every language has a different way of doing things and gives me a new perspective, in the long run they all end up improving my programming style as a whole. I always end up integrating the best parts of each into my next project when possible.

      Experience will always be more valuable than any set of rules these kind of books tout as “the way things are meant to be done”.

  • arxdat@lemmy.ml
    link
    fedilink
    arrow-up
    18
    arrow-down
    9
    ·
    4 months ago

    There are no inherent “rules” in software development. These books are useless and a waste of time. They offer nothing but CS Dogma and are actually against freedom of expression.

    • orcrist@lemm.ee
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      4 months ago

      CS often requires working in teams, and working it teams is often more efficient if you have some shared approaches.

    • bleistift2@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      6
      ·
      4 months ago

      There are no inherent “rules” to language, either, but when you don’t followthemthingsgetmessyandyou’reannoyingforeveryoneelese.

  • matzler@lemmy.ml
    link
    fedilink
    arrow-up
    10
    arrow-down
    2
    ·
    4 months ago

    Those of you who red and liked clean code (I did too), what’s your next best recommendation as a book? The pragmatic programmer?