Live data from Hacker News

How to effectively write quality code with AI

heidenstedt.org

311–320 of 321 posts

Re: How to effectively write quality code with AI

#311
post #307

Earlier quoted context omitted.

>Hmm... How will it filter out those by the dumbest coders in the world? if you know, and I know, and the guys at openai and anthropic know... not a big leap that the models will know too? many datasets are curated and labeled by humans

> if you know, and I know, We don't know. > and the guys at openai and anthropic know... not a big leap that the models will know too? The models don't "know" anything. They just regurgitate what they are fed. "Child abuse images found in AI training data" https://www.axios.com/2023/12/20/ai-training-data-child-abus... > many datasets are curated and labeled by humans Including these ones: "AI industry insiders launc…

> having a curated dataset of the works and posts of the top 200 coders in the world

I can't imagine many of the top 200 coders in the world giving their work to the parrots.

But show me the list of the top 200 coders in the world, and I might change my mind! :)

Re: How to effectively write quality code with AI

#312
post #274

Earlier quoted context omitted.

What are you going to do for work in 2 years?

I have enough savings for a few years, so I might just move to a lower COL area, and wait it out. Hopefully after the initial chaos period things will improve.

For someone at your position with your experience it’s quite depressing that your job is going to be automated. I feel quite anxious when I see young generations in my country that say themselves they are lazy about learning new things. The next generation will be useless to capitalist societies, in a sense that they won’t be able to bring value through administrative or white collar work. I hope some areas of the industry will move slowly toward AI

Re: How to effectively write quality code with AI

#313

Earlier quoted context omitted.

Ofc people are non deterministic. But usually we expect machines to be. That’s why we trust them blindly and don’t check the calculations. We review people’s work all the time though. Here people will stop review machine LLM code as it’s kind of a source of truth like in other areas. That’s my point, reviewing code takes time and even more time when no human wrote it. It’s a dangerous path to stop reviews because of…

No one who has any knowledge or who has ever used an LLM expects determinism. And there are no computer professionals who haven’t heard about hallucinations. Reviewing whether the code meets requirements through manual and automated tests - and that’s all I cared about when I had a team of 8 under me - is the same regardless. I wasn’t checking whether John used a for loop or while loop in between my customer meetings…

Having a team of 8 people producing code is manageable. Having an AI with 8 agents that write code all day long is not the same volume it can generate more code in a day that one person can review in a week. What you say is that, product teams will prompt what they want to a framework, the framework will take care of spec analysis, development, reviews, compliance with spec. Product teams with QA will make sure the delivery is functionally correct. No humans need to make sure of anything code related. What we don’t know yet is, does AI will still produce solid code trough the years because it’s all statistical analysis and with the volume of millions of loc, refactoring needed, data migrations etc what will happen ?

Re: How to effectively write quality code with AI

#314

Earlier quoted context omitted.

No one who has any knowledge or who has ever used an LLM expects determinism. And there are no computer professionals who haven’t heard about hallucinations. Reviewing whether the code meets requirements through manual and automated tests - and that’s all I cared about when I had a team of 8 under me - is the same regardless. I wasn’t checking whether John used a for loop or while loop in between my customer meetings…

Having a team of 8 people producing code is manageable. Having an AI with 8 agents that write code all day long is not the same volume it can generate more code in a day that one person can review in a week. What you say is that, product teams will prompt what they want to a framework, the framework will take care of spec analysis, development, reviews, compliance with spec. Product teams with QA will make sure the d…

For context, I just started using coding agents - codex CLI and Claude code in October. Once I saw that you had to be billed by use, I’m not using my own money for it when it’s for a company.

Two things changed - Codex CLI now lets you use it with your $20 a month subscription and I have never run into quota issues with it and my employer signed up for the enterprise vs of Claude and we each have an $800 a month allowances

My argument though is “why should I care about the code?” for the most part. If I were outsourcing a project or delegating it to a team lead, I would be asking high level architectural, security and scalability questions.

AI generated the code, AI maintains the code. I am concerned about abstractions and architecture.

You shouldn’t have to maintain or refactor “millions of lines of code”, if your code is well modularized with clean interfaces, making a change for $x7 may mean making a change for $x1…$x6. But you still should be working locally in one module at the time. You should do the same for the benefit of coders. Heck my little 5 week project has three independently deployable repos in a root folder. My root Agents file just has a summary of how all three relate via a clean interface.

In the project I am working on now, besides “does it meet the requirements”, I care about security, scalability, concurrency, user experience for the end user, user experience for the operations folks when they need to make config changes, and user experience for any developers who have to make changes long after I’m off this project. I haven’t looked at a single line of code - besides the CloudFormation templates. But I can answer any architectural question about any of it. The architecture and abstractions were designed by me and dictated to the agents

On this particular project, on the coding level, there is absolutely nothing that application code like this can do that could be insecure except hypothetically embed AWS credentials into the code. But it can’t do that either since it doesn’t have access to it [1].

In this case security posture comes from the architecture - S3 block public access, well scoped IAM roles, not running “in a VPC”. Things I am checking in the infrastructure as code and I was very specific about.

The user experience has to come from design and checking manually.

I mentioned earlier that my first stab it scaled poorly. This was caused by my design and I suspected it would beforehand. But building the first version was so fast because of AI tools, I felt no pain in going with my more architecturally complicated plan B and throwing the first version away. I wouldn’t have known that by looking at the code. The code was fine it was the underlying AWS service. I could only know that by throwing 100K documents at it instead of 1000.

I designed a concurrent locking mechanism that had a subtle flaw. Throwing the code into ChatGPT into thinking mode, it immediately found it. I might have been better off just to tell the coding agents “design a locking mechanism for $x” instead of detailing it.

Even maintainability was helped because I knew I or anyone else who touched it was probably going to be using an LLM. From the get go I threw the initial contract, the discovery sessions transcripts, the design diagrams, the review of the design diagrams, my project plan and breakdown into ChatGPT and told it to render a detailed markdown file of everything - that was the beginning of my AGENTS.md file.

I asked both Codex and Claude to log everything I was doing and my decisions into separate markdown files.

Any new developer could come into my repo, fire up Claude and it wouldn’t just know what was coded, it would have full context of the project from the initial contract through to the delivery

[1] code running on AWS never explicitly has to worry about AWS credentials , the SDKs can find the information by themselves by using the credentials of the IAM role attached to the EC2 instance, Lambda, Docker container, etc.

Even locally you should be getting temporary credentials that are assigned to environment variables that the SDK retrieved automatically.

Re: How to effectively write quality code with AI

#315

Earlier quoted context omitted.

You’re asking to see my company’s code base? It’s not like with AI we’re making miraculous things you’ve never seen before. We’re shipping the same kinda stuff just much faster. I don’t know what you’re looking for. Code is code it’s just more and more being written by AI.

Do you find reading hard? I'm asking for examples. Why isn't anyone showing this off in blog posts. Or a youtube video or something. It's always this vague, it's faster, just trust me bro bullshit and I'm sick of it. Show me or don't reply.

So you want a video of me coding at work using AI? There are entire YouTube channels dedicated to this already. There are already copious blogs about people's AI workflows -- this very post you're commenting in is one (do you find reading hard?)

Clarify the actual thing you need to believe the technology is real or don't reply.

Re: How to effectively write quality code with AI

#316
This sounds like all of the things you should be doing anyway in a team environment, only now you can't trust your own judgment of where to spend the effort or knowingly leave gaps, because agents with no judgment of their own will be the ones to encounter the consequences.

Re: How to effectively write quality code with AI

#317

Earlier quoted context omitted.

> if you know, and I know, We don't know. > and the guys at openai and anthropic know... not a big leap that the models will know too? The models don't "know" anything. They just regurgitate what they are fed. "Child abuse images found in AI training data" https://www.axios.com/2023/12/20/ai-training-data-child-abus... > many datasets are curated and labeled by humans Including these ones: "AI industry insiders launc…

> having a curated dataset of the works and posts of the top 200 coders in the world I can't imagine many of the top 200 coders in the world giving their work to the parrots. But show me the list of the top 200 coders in the world, and I might change my mind! :)

Top 200 that work partially in public. A good example is Mitchell Hashimoto. Works open source, uses AI a lot and writes about it. Next gen AI will learn from the lessons people like him share

Re: How to effectively write quality code with AI

#318
post #317

Earlier quoted context omitted.

> having a curated dataset of the works and posts of the top 200 coders in the world I can't imagine many of the top 200 coders in the world giving their work to the parrots. But show me the list of the top 200 coders in the world, and I might change my mind! :)

Top 200 that work partially in public. A good example is Mitchell Hashimoto. Works open source, uses AI a lot and writes about it. Next gen AI will learn from the lessons people like him share

> uses AI a lot

https://en.wikipedia.org/wiki/Model_collapse

Re: How to effectively write quality code with AI

#319
post #273

Earlier quoted context omitted.

Very nice. BUT, what is the point of max line length enforcement, just to see if there are crazy ternary operators going on?

It makes diff split view nicer to use. At least this is the reason why I do use it

I see. That makes sense, but sometimes is makes code harder to read.

Re: How to effectively write quality code with AI

#320

I can't help but keep finding it ridiculous how everyone now discovers basic best practices (linting, documentation, small incremental changes) that have been known for ages. It's not needed because of AI, you should have been doing it like this before as well.

These best practice protections become essential only when you give the work to really bad programmers - such as parrots.

Completely disagree. That's like saying that user manuals and driving assistances (e.g. alerts about approaching an object) in cars are only for bad drivers.
Post reply on HN