I got the first prototype version of the code for the project I’m currently working on. It is an Arduino Sketch, that contains 1k lines, stores every single Value needed as a global Variable and every function reads and writes to these global variables, instead of taking them in as parameters. This code is so bad, that I refuse to even look at it. The effort to take the existing codebase and transform it into something useable is as high as rewriting it from scratch.

When telling my colleague that his code is absolute garbage, he just told me “its not my code, Claude did it”. I am constantly pushing towards implementing the project in a proper way, but it has been nothing but fights against people who don’t know how to code and who refuse to acknowledge that ignoring any standards of maintainable code does not turn out in the end and it makes sense to rewrite the project sooner than later.

  • surewhynotlem@lemmy.world
    link
    fedilink
    arrow-up
    17
    ·
    5 hours ago

    "its not my code, Claude did it

    You have to own what you produce regardless of what tool you use.

    He created shit using a shit factory. His use of a shit factory was his choice and does not absolve responsibility.

  • squaresinger@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    6 hours ago

    Arduino is a toy/prototyping platform that you really shouldn’t use for productive solutions (it’s got terribly bad code quality, bugs that have been open for over a decade, it’s basically unmaintained by now).

    1k lines is a micro project. It’s really small.

    All that’s on a level where if this is just an internal solution that isn’t sold to customers it’s ok if the code is shit as long as it works.

    If you are actually selling it to customers or you rely on it performing a critical function, you should urgently move away from Arduino anyway.

    Remember: code quality is not an end to itself, but instead a means to an end. It gives you a more maintainable, less buggy project. If you don’t care about maintainability and stability, it really isn’t worth the time to optimize code quality here.

  • lime!@feddit.nu
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    5 hours ago

    hate to break it to you but that’s called procedural programming and it’s a legitimate design for constrained systems.

    not that it would work as intended on an arduino considering the ide uses a c++ compiler, but still

  • SayCyberOnceMore@feddit.uk
    link
    fedilink
    English
    arrow-up
    18
    ·
    8 hours ago

    You’re gonna need some top-down support there.

    Get some coding(& documentation?) guidelines agreed with a manager (I’d hope there were some already) and then it’s not 1:1 opinions, it’s now “Best” Practice.

    But, keep it high level… rather than just going in anti-AI and having more resistance, have the structure there that enforces what you want; local variables (& no emojis for variable names), comments are / not required, etc. and then they could still use Claude, but their output would have to match what you’re after.

    Good Luck

    • ivan@piefed.social
      link
      fedilink
      English
      arrow-up
      16
      ·
      8 hours ago

      I teached embedded programming for a while and students were to find out that AI often failed miserably at our tasks.

      And the funny thing is that when I tried it myself to see if it’s that bad at given tasks - I explained the task like I would explain to a student, and actually got a decent result - readable comprehensive code with meaningful comments. It all simply comes down to the fact that AI won’t really help you if you can’t do without it. So I double that making the guy pass some guidelines on styling the code to Claude should at least make the code less shit to debug.

      • cass1312 (she/her)@piefed.blahaj.zone
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 hours ago

        I took an arduino class after already having programmed for years, and at one point the teacher wanted everyone to use chatgpt to write code for an assignment that was basically “run a motor while a button is pressed and stop it when it’s released”. The code for that is an extremely simple one liner, and if phrased correctly an llm could definitely spit out that single line, but everyone seemed to have it generate like 10+ line blocks with a bunch of if statements and stuff.

      • squaresinger@lemmy.world
        link
        fedilink
        arrow-up
        10
        ·
        6 hours ago

        This here. It makes a huge differenche which AI you use and what you do with it.

        “Free ChatGPT, make me an app” is going to result in pretty bad code.

        “Claude Opus 5.5, here’s a project with a well-defined agents.md, coding guidelines, tests, …, please analyze this well-defined ticket and grill it. Together we knock out the remaining kinks in the ticket. Then put the analysis into .md files, and I review that you actually understood what you are supposed to do. Then in a new session read the .md files and start the implementation, always stopping and asking if something’s unclear. Then in a new session let’s review the result together, before I send it on to the next developer to do a pull request review.”

        This results in actually pretty good code that often catches issues that a human dev alone wouldn’t.

    • da_cow (she/her)@feddit.orgOP
      link
      fedilink
      arrow-up
      11
      ·
      7 hours ago

      The problem is, that there is no management. I’m working on a small team of 4 people and I am the only person that knows now to code. The rest just asks Claude and doesnt bother as long as it works.

      Im also an advocate of moving the project to an RTOS, which would mean a complete rewrite, but for now they are still quite eager at fighting that.

      For now I will just do the minimum required work to maintain this mess and rewrite everything from scratch in the meantime, because we will have to do it anyway at some point.

      I will definitely talk to them about some minimum coding standards.

    • sbird@retrofed.com
      link
      fedilink
      English
      arrow-up
      12
      ·
      7 hours ago

      I feel like that’s disrespectful to all the mums in the world! For one, Claude isn’t capable of feeling anything, and certainly nothing like a parental bond with their children

  • makeshift0546@lemmy.today
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    4 hours ago

    Skill issue. That and they are probably using a shit free model with low context.

    You also seem pretty ignorant of most arduino projects and the hobby nature most of them show. Confidently so.

  • CrypticCoffee@lemmy.ml
    link
    fedilink
    arrow-up
    9
    ·
    8 hours ago

    Frustrating.

    I would not say garbage. It is rude. But make clear it is not fit for purpose. Insist that code has to be maintainable and that code has tight coupling. “If I wanted Cluade to write everything, we could hire less devs, but you are trusted because the organisation wants high quality, so please rewrite it as it will not be approved so this work is not done.”

  • ivan@piefed.social
    link
    fedilink
    English
    arrow-up
    10
    ·
    8 hours ago

    My friend had an old colleague that was maintaining one project for decades. Grandpa sadly kicked the bucket at some point and friend inherited that project - tens of thousands of lines of Assembly. 🌝

  • locuester@lemmy.zip
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 hours ago

    Have you tried having a frontier model redo it in a coding standard that you prefer? You can do that by simply asking it.

    Dont knock it til ya try it.

    • da_cow (she/her)@feddit.orgOP
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      7 hours ago

      No way am I going to trist AI on rewriting that. The entire underlying structure is so bad that feeding that into an AI model and tasking it with making a decent code structure out of it will very probably not work the way I want it to. AI is a tool that excels at small isolated tasks, but under no circumstance do I allow it to create the outline of my project.

      • glibg10b@lemmy.zip
        link
        fedilink
        arrow-up
        4
        ·
        7 hours ago

        If you break it into simple tasks, it’s not that bad. For example, for each function, ask it to add reference parameters for the global variables used by that function, and to modify the call site accordingly

        With tasks this small, you’re not asking the LLM to think for you, you’re just using it to automate a boring task

        Once that’s done, seeing each function’s interface should make it easier for your brain to identify what further refactoring is needed