• 0 Posts
  • 19 Comments
Joined 10 months ago
cake
Cake day: February 15th, 2025

help-circle




  • Edit:

    To clarify, I looked at existing online ruby code and gave it a small test for readability. It may be outdated, use uncommon syntax, bad practice or be full of individual developer quirks - I wouldn’t know. I did that because I wanted to highlight some weaknesses of the language design that turned me away from ruby years ago. https://en.wikipedia.org/wiki/Principle_of_least_astonishment


    Yes, very nice. But here comes the ugly;

    [1,2,3].map(&:to_s)
    

    oh ok, a bit hieroglyphic, but I can figure it out, seems like ‘&’ means element and ‘:’ means what I do with it.

    files = `ls -1`
    

    Aaah so a backtick is for strings? WRONG!!! IT EXECUTES THE FUCKING COMMAND!!!

    ARGF.each { |line| puts line if /BEGIN/ .. /END/ }
    

    What the hell is | and / ? Oh but I guess .. is a range like in other languages, but what would be that range??? WRONG! I!!T’S A FLIP FLOP!!!

    %w{a b c}     # array of strings
    %i[foo bar]   # array of symbols
    %r{https?://\w+}  # regex
    %x(ls -1)     # run shell command
    

    Ah, just memorize which letter to use by heart and that % is for type and that [ = { sometimes. But { unequal to { other times.

    if line =~ /ERROR/
      warn $~.post_match
    end
    

    =~ neat!

    $~ dafuq???

    At this point I feel like ruby devs are just trolling us. There are always multiple ways to do the same thing. Every example from above also has a tidy and readable way to do it. But the alternative ways become progressively more shorthand, unreadable and unintuitive.


  • HelloRoot@lemy.loltoProgrammer Humor@lemmy.mlTrue crime
    link
    fedilink
    English
    arrow-up
    31
    ·
    edit-2
    4 months ago

    The only flaw is that the console.log states that null means user is not logged in.

    If there are three or more explicit states, you should not use a nullable bool, but some more explicit data structure, like enum.

    For example, if the state comes from a db, the user could be successfully logged in, but somehow for a range of possible reasons this variable ends up as null and you’ll have a hell of a time debugging, because the log will give you nonsense.




  • I did that once. Went to a completely dysfunctional company. Project management was non existent. There was no planing, no defined goals. The project manager, that never before managed a project, literally told me “I think everybody know what has to be done” when I asked for a first assignment.

    I though - well I’ll just hang out there and get paid, but alas there was 2 hours of meetings, shouting, everybody blaming everybody else, non stop phone calls etc. every day. Home office got cancelled because “you developers aren’t productive”. If you do nothing (because nobody told you to do anything) you get shouted at, if you do what they tell you to do (“just make a website, it can’t be that hard, we need to be at the top of the google search results” - “what should i put on the website?” - “we don’t know, but make sure it’s at the top”) they look at the result and blame you because it isn’t what they had in mind when they asked.

    Wasn’t free money, had to take a long break for mental health afterwards.

    Years later, I still look up their project sometimes. The website is the same as when I left.


  • I think you might have fucked your data.

    1. when you get an error like on your boot, take a screenshot, write it down, search online, ask for help with the exact error online

    2. when you don’t know what a command does, don’t run it

    Afaik the command tried to re-encrypt your drive. If you canceled it, well now you have a drive in some undetermined state and since it was reencrypting it your data is now mumho jumbo.







  • I’d love to not handhold, but where I worked that was not possible, because my task came from upper management and was to handhold juniors while guarding our production code from anything they did (which often didn’t meet company standards). The tasks the juniors were getting came from somebody else.

    But also, this is not really about the style (throwing into deep waters on one extreme, babysitting on the other, and everything in between) but rather that I experienced way better results from chatGPT for 50$ / month than from a junior who had under a year of experience and costs 3000-4000$ a month. Both require some degree of attention and time investment from seniors if you want to use the resulting code in prod.

    So the real goal is to pay them to get better than chatGPT and hope they stay at your company long enough to get a return out of that investment.

    If you just want junior-grade code, let your seniors deploy chatGPT for a much cheaper price.


  • You’ve worked with juniors before?

    Because in my experience I was constantly reading their unreadable code, then telling them why it’s wrong or bad or not fitting in a digestible manner and then waiting weeks for a refactor.

    Iterate that for a month. Mentoring them took way longer than it would have taken me to write it from scratch. Not that dissimilar to trying to using AI for where it sucks (larger, a tad more complex problems).

    It only makes sense if you look at it as an investment, because they will eventually improve.