Ad
  • Default User Avatar

    You wanna make world better place ? Tell me which one's better ? easy,non-progressive,vulnerable OR challenging,progressing,safer ? I wouldn't want kids in my world to grow up dumb and be prey! You wanna make it better? teach than defer!

  • Custom User Avatar

    Except:

    • this is not one of the real-world problems
    • nobody is talking about real-world problems either except him

    So this whole thread is basically "a person suddenly bitching about irrelevant things" and "complaining about best practice solutions because one doesn't like it". And I don't see in what way what you're adding is driving us less derailed to the thing he's bitching about. So please don't do that.


    Also, I bash people if they talk/have done shit, that's simple. Why should I conserve my ammo and tolerate bullcrap for the sake of some arbitrary measures of "kindness"? StackOverflow did that since 2012, and it didn't go well. If you're wrong about something, you're wrong, and there's nothing more clear to other people, especially newbies, that it is wrong (and you shouldn't perceive otherwise) than to object to it in the clear.

  • Default User Avatar

    Giving my 2 cents here.

    Keep in mind what i'm writing here for the rest of my comment : I do realise the solution is elegant, and is appropriate in the scope of codewards, aka in the case you're doing it to learn of more efficient ways to code for high performance / critical areas, or as a sandbox playground.

    But fojuth has a point, and a good one. In real world problems, where your code gets handed over to other people that will maintain it, modify it, add to it etc.. and most importantly, that you don't screen, choose or recruit to do your job after you move on, putting code like this in production is a serious case of tempting the devil and opening the gates to potential pitfalls down the line.

    A developer's job is building software, often in a team. It's not about code performance until it's specifically needed, it's more about team productivity, high velocity in task completion and a development cycle as smooth as possible.

    I feel the need to address your point about what comments should be used for. I saw this a lot with peers in university, but I digress. Comments shouldn't explain the what or the how of a certain piece of code (basically what intent + explanation means), they should explain the why, that's what truly adds value to readability without clogging your mind with unnecessary low level details, and makes code pieces literally essays.

    CS is, as its name suggests, a science. Programming on the other hand is a craft that uses CS to achieve what it wants. Please make this distinction in context while reading other comments.


    Also.. As a side but important note, do leave reddit-like comments far from dev communities. Our field is harsh enough as it is dealing with other stuff, and most of us like to help and be respectful to each other. Have some pride in what you do and leave bashing and shittalking to people with time to burn and nothing else to do.

  • Custom User Avatar

    Well, that's what I've been saying above: the code itself should be as concise and elegant as possible, while the intent or explanation of the code should go in the comments. Dumbifying the content of the code itself just to make less competent people able to follow, at the expense of clean and concise code, is the real wtf and unacceptable thing.

    (By the way, the explanations have been provided down the comments below.)

    But then, I'm not surprised that lots of newbies went down the path of "why you no spoonfeed me noob code". The fact that OP get something like 31 score is mind-boggling yet anticipated. It's really something that's even more basic and fundamental than "coding fundamentals"...

    p.s If anything I want to bash this OP more for his blatant and shameless "pick-a-fight-and-run" tactic. After all, you've picked a fight yourself, and then you're just going all "you misunderstood me, I do not wish to discuss any further" and try to get away with it like nothing happened? That's not going to happen, mate. There are consequences of picking up a wrong fight, and you need to face it.

  • Default User Avatar

    Good point.But you post at the wrong place.

    This code is simple and just doing one thing.It's not unreadable.

    If you don't know what the code is doing.You should learn.

    It's faster than the normal code.If you have an cost-efficient issue,it will help you.

    For honestly,you should have learned if you are studying Computer Science(At least in our country).But we just don't know where to use it.

  • Custom User Avatar

    Uhm, git gud then?

  • Default User Avatar

    Voile
    "you're accusing the wrong one-liner here. This one-liner is so simple what it does is obvious from first sight"

    No it is not simple and no it is not obvious what it does at the first sight PERIOD

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Sorry, I forgot there was mentions of the intended strat in that comment >3<

  • Default User Avatar

    Voile! Spoiler flag!! X-p

    ;)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution