6
dmoen
3y

I dont like programming languages where "there is more than one way to do it".

There should be one way to do things, it makes it easy for developers to understand code others have written, it makes it easier to start working in new teams etc etc.

Comments
  • 4
    There should be one way to make a website
  • 8
    why is this tagged as a question
  • 12
    @darksideofyay because that should be the only category, obviously
  • 1
    Its@darksideofyay because its saturday and i like scottish whiskey. (Dont tell my girlfriend)
  • 1
    @dmoen I don't agree but I see where you're coming from. I spent years trying to make software development choices black and white. Most of the time it's impossible.
  • 3
    Python programmer/acolyte detected.
  • 1
    @Demolishun and yet you can do the same thing in python differently
  • 7
    It's pretty much impossible to make a language where everything can be done only in one way
  • 0
    @Crost yeah i understand what you are saying, i just think that it should be something to strive for.
  • 0
    I know its impossible to have a programming language where you can only do things in a certain way.

    In Python and PHP you can you can use both procedural and OOP styles to write code for example...

    But if we are ever going to get to the stage where robots take control of earth, then we need to atleast agree on some basic standards?
  • 0
    @dmoen well... No. People could never agree on one standard
  • 3
    @dmoen we already have standards - people just don't agree which ones to use.

    I suspect that other professions like civil engineering got to where they are over a lot longer time than software devs have had. I believe this profession really began in the 80s - but a real increase in number of jobs wasn't until 2000s (I can't remember a source for that).

    Ontop of that when things picked up and the job started to become mainstream the programmers that started it all retired around the same time as back then due to economy and age of computers programmers were not usually young.

    So we have to bare in mind that this whole thing is still in its early days compared to a mature profession.

    It also doesn't help that demand so outstrips supply, lowering the entry level skill, I have doubts that the majority of professional programmers today even read about standards.
  • 2
    This was one of my biggest issues with Java when I was a mobile developer, everyone was doing things way fucking different from standard documentation.

    Perl is attrocious at this, and the reason why there is so many bullshit codebases, even though I love Perl. Javascript is another one, every server side Node app I have encountered has a trillion different approaches molded onto it.

    I won't even touch the subject of PHP which is the one I have worked with the most.

    In my opinion, C# and Go have pretty well defined standards that most follow, Go in particular does not allow for a lot of elegant fuckery, the language is dumbed down to oblivion enough to not warrant even the idea of calling it a modern language, because it is not. But every Go code base seems exactly the same thus far for me, which is one of the reasons why I am trying to ditch php at my workplace in favor of Go.
  • 2
    @iiii

    "There should be one-- and preferably only one --obvious way to do it." (from Zen of Python).
  • 3
    I think probably part of the issue here isn't just the code, but the "thing" itself. Code is the (attempted) implementation of certain logic, but there are probably multiple logical pathways to achieve the same larger goal.

    E.g. even if there's only one way to write an if statement, there could be a bunch of different combinations of statements, negations and operators that would achieve the same resulting logic.
  • 1
    @AleCx04 well, perl was like that by design, afaik.
  • 7
    A language that has only one way to do everything is a language that has never evolved from the first release.

    If C# only had one way to do everything we would not be using the newer features like generics (added around mid 2000s IIRC), LINQ, etc.

    The older way of doing things has to be maintained for backwards compatibility
  • 1
    @nibor this. But I do wish they would work on a way that you could somehow turn off or remove old parts of the framework so that you don’t get so much noise. Even if it was somehow segregated by intellisense that would be an improvement
  • 1
    You can't.
    Take the folliwing statements in any lang:
    a == a
    !(!(a==a))
    True
    Are they the same? of course they are. So - stop being a moron, and go write your code convention guideline.
  • 1
    i agree.
    which do you think is the one right way to add x and y?
    res = x + y
    or
    res = y + x
    ?

    we will only allow the right one, and make linter rules disallowing the other one.
  • 1
    @Midnight-shcode the only right way is obviously
    res = y
    res += x
  • 0
    @dmoen *whisky when it's from Scotland
  • 1
    This is why languages like Go become popular. Then they bloat over time to end up like C# and someone reinvents C again for the 20th time.
Add Comment