Skip Navigation
Code Smells Catalog
  • @mbtrhcs @spartanatreyu well Java Streams try to, but it's not too hard to get them to accidentally process too much, or even blow up completely.

    (This isn't a comment on coding styles or the article though)

  • It's probably time to stop recommending Clean Code @ Things Of Interest
  • @dandi8 @JackbyDev Most of the criticism in the article talks about side-effects using a far stricter (and imo more useful) definition than Martin did.

    I tend to agree, and would avoid both side-effects and writing code like Martin. However this book targets the mainstream, and afaik the mainstream hasn't yet accepted the new definition of side-effect.

    Martin has since embraced FP more than the mainstream. So he's somehow both ahead of and behind the curve.

  • Post-Architecture: Premature Abstraction Is the Root of All Evil
  • @agressivelyPassive if you routinely call indirections abstractions, then 'premature abstraction is the root of all evil' holds. If you separate the two concepts, you might think differently.

    If my team's codebase had a business logic class that had a concrete dependency on an EntityBuilderFactory, I'd vomit a little, but I wouldn't delete it (can't piss off too many people all the time). But I would route around the damage by allowing the class to depend on the EBF *or* something else.

  • Post-Architecture: Premature Abstraction Is the Root of All Evil
  • @agressivelyPassive moving from 'storing a user in postgres' to 'storing anything in postgres' is a step up in abstraction. Same with moving to 'storing a user somewhere' or moving to 'storing anything anywhere'.

    Moving from 'storing an entity' to 'storing an entity via a FacadeBuilderFactory' is not a step up in abstraction, it's only an extra indirection.

  • Post-Architecture: Premature Abstraction Is the Root of All Evil
  • @arendjr

    1. abstraction != indirection. Abstraction allows you to do a deferred architecture: store this user "somehow". Indirection is just early architecture with more steps: MyUserDatabase class is coupled to one way of doing things - it's concrete, not abstract.

    2. yet another article advocating 'pure functional' flavour, not a pure functional PL. Recommending purity in an impure language is like recommending memory safety in C. All the work is on the programmer.

  • Dumb question: how do I know if an open source project is trustworthy?
  • @Kecessa @grue knowing that the source will be published discourages bad actors from putting crap into the program in the first place.

    And if they do it anyway, other people can come along and repackage it without the bad bits, like vscodium.

  • Fix Incoming! Empty S3 buckets won't be able to make your AWS bill explode
  • @errer @pro_grammer

    I believe that the trick is not to show the developers the bill.

    Let the developers all tell each other "it's cheap because you don't have to buy the servers; you only pay for what you use!"

    Only managers see the real price.

  • If Inheritance is so bad, why does everyone use it?
  • @okamiueru @balder1993

    It's an overloaded term:

    "Dependency inversion" is a language-agnostic technique for producing testable, loosely-coupled software.

    "Dependency injection" just means dependencies should be passed in through the constructor, instead of being magically new()'d whereever.

    "DI frameworks" are Satan's farts. Classpath-scanning nonsense that turns compile-time errors into runtime errors. Not only is your Ctr still coupled to your Svc, but both are now coupled to Spring.

  • If Inheritance is so bad, why does everyone use it?
  • @onlinepersona

    An enum is a sum type because the number of inhabitants of the enum is the sum of the inhabitants of its parts.

    A product type's number of inhabitants is the product of its parts' inhabitants. So a struct would fit that definition, or a pair, or a tuple.

    Looking at the pic on your Cartesian product link:
    if A is an enum {x,y,z} and B is an enum {1,2,3}, then a struct AxB has 9 possible inhabitants.

  • If Inheritance is so bad, why does everyone use it?
  • @onlinepersona @armchair_progamer

    A type has a number of 'inhabitants'. 'Sum' indeed corresponds to adding the possible inhabitants together.

    A Boolean has two inhabitants - true and false. A byte has 256 inhabitants. A BoolOrByte type has 258 inhabitants.

    If you have BoolByte pair, that's a product type - 512 possible inhabitants.

    It may make no fucking sense depending on your exposure to Java, where Void (literally 'empty') has an inhabitant, and Boolean has 5.

  • Type inference was a mistake
  • @Windex007
    > You as the writer, you don’t know either?
    Not until the compiler tells me.

    > Or is the argument that nobody but the compiler and god need know? That having an awareness of the types has no value?
    No, I want to know, because knowing the types has value. If the compiler has inference, it can tell me, if not, it can't.

  • Type inference was a mistake
  • @Windex007 @snowe

    Yes. Type-inference typically *knows better than me* what the types should be.

    I frequently ask the compiler what code I need to write next by leaving a gap in my implementation and letting the compiler spit out the type of the missing section.

  • InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)MR
    John @mastodon.social
    Posts 0
    Comments 23