5 ms·
AI can definitely produce a deletion. In fact, I commonly use AI to do this. Copy some code and prompt the AI to make the code simpler or more concise. The outp
by ajjenkins 1y ago
AI can definitely produce a deletion. In fact, I commonly use AI to do this. Copy some code and prompt the AI to make the code simpler or more concise. The output will usually be fewer lines of code.
Unless you meant that AI won’t remove entire features from the code. But AI can do that too if you prompt it to. I think the bigger issue is that companies don’t put enough value on removing things and only focus on adding new features. That’s not a problem with AI though.
- ryandrake 1y agoI messed around with Copilot for a while and this is one of the things that actually really impressed me. It was very good at taking a messy block of code, and simplifying it by removing unnecessary stuff, sometimes reducing it to a one line lambda. Very helpful!
- buggy6257 1y ago> sometimes reducing it to a one line lambda. Please don't do this :) Readable code is better than clever code!
- bluefirebrand 1y agoEspecially "clever" code that is AI generated! At least with human-written clever code you can trust that somebody understood it at one point but the idea of trusting AI generated code that is "clever" makes my skin crawl
- Terr_ 1y agoAlso, the ways in which a (sane) human will screw-up tend to follow internal logic that other humans have learned to predict, recognize, or understand.
- ben_w 1y agoMost devs I've worked with are sane, unfortunately the rare exceptions were not easy to predict or understand.
- vkou 1y agoWho are all these all these engineers who just take whatever garbage they are suggested, and who, without understanding it, submit it in a CL? And was the code they were writing before they had an LLM any better?
- arkh 1y ago> Who are all these all these engineers who just take whatever garbage they are suggested, and who, without understanding it, submit it in a CL? My guess would be engineers who are "forced" to use AI, already mailed management it would be an error and are interviewing for their next company. Malicious compliance: vibe code those new features and let maintainability and security be a problem for next employees / consultants.
- throwaway889900 1y agoSometimes a lambda is more readable. "lambda x : x if x else 1" is pretty understandable and doesn't need to be it's own separately defined function. I should also note that development style also depends on tools, so if your IDE makes inline functions more readable in it's display, it's fine to use concisely defined lambdas. Readablity is a personal preference thing at some point after all.
- gopher_space 1y agoMy cleverest one-liners will block me when I come back to them unless I write a few paragraphs of explanation as well.
- ethbr1 1y ago>> Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan https://github.com/dwmkerr/hacker-laws#kernighans-law https://github.com/dwmkerr/hacker-laws#kernighans-law
- johnnyanmac 1y agoYmmv. Know your language and how it treats such functions on the low level. It's probably fine for Javascript, it might be a disaster in C++ (indirectly).
- deleted 1y ago[deleted]
- banannaise 1y ago> "lambda x : x if x else 1" I think what you're looking for is "x or 1"
- jcelerier 1y agoWho says that the one line lambda is less clear that a convoluted 10-line mess doing dumb stuff like if(fooIsTrue) { map["blah"] = bool(fooIsTrue); } else if (!fooIsTrue) { map["blah"] = false; }
- johnnyanmac 1y agoMy experience in unmanaged legacy code bases. If it's an actual one liner than sure. Use your ternaries and closures. But there is some gnarly stuff done in some attempt to minimize lines of code. Most of us aren't in some competitive coding organization. And I know it's intentional, but yes. Add some mindfulness to your implementation Map["blah"] = fooIsTrue; I do see your example in the wild sometimes. I've probably done it myself as well and never caught it.
- n4r9 1y agoAre you telling me you've never seen code like this: var ageLookup = new Dictionary<AgeRange, List<Member>>(); foreach (var member in members) { var ageRange = member.AgeRange; if (ageLookup.ContainsKey(ageRange)) { ageLookup[ageRange].Add(member); } else { ageLookup[ageRange] = new List<Member>(); ageLookup[ageRange].Add(member); } } which could instead be: var ageLookup = members.ToLookup(m => m.AgeRange, m => m);
- davidgay 1y agoI'm of the opinion that var ageLookup = new Dictionary<AgeRange, List<Member>>(); foreach (var member in members) { ageLookup.getOrCreate(member.AgeRange, List::new).add(member); } is more readable in the long-term... (less predefined methods/concepts to learn).
- n4r9 1y agoWhere is `getOrCreate` defined? Is it a custom extension method? There's also a chance we're thinking in different languages. I was writing C#, yours looks a bit more like C++ maybe? Readability incorporates familiarity but also conciseness. I suppose it depends what else is going on in the codebase. I have a database access class in one of my solutions where `ToLookup` is used 15 times; yes you have to learn the concept, but it's an inbuilt method and it's a massive benefit once you grok it.
- Freedom2 1y agoI'm no big fan of LLM generated code, but the fact that GP bluntly states "AI will never produce a deletion" despite this being categorically false makes it hard to take the rest of their spiel in good faith. As a side note, I've had coworkers disappear for N days too and in that time the requirements changed (as is our business) and their lack of communication meant that their work was incompatible with the new requirements. So just because someone achieves a 10x speedup in a vacuum also isn't necessarily always a good thing.
- fifilura 1y agoI'd also also be wary of the risk of being an architecture-astronaut. A declarative framework for testing may make sense in some cases, but in many cases it will just be a complicated way of scripting something you use once or twice. And when you use it you need to call up the maintainer anyway when you get lost in the yaml. Which of course feels good for the maintainer, to feel needed.
- specialist 1y agoThis is probably just me projecting... u/justonceokay's wrote: > The solution to bad code is more code. This has always been true, in all domains. Gen-AI's contribution is further automating the production of "slop". Bots arguing with other bots, perpetuating the vicious cycle of bullshit jobs (David Graeber) and enshitification (Cory Docotrow). u/justonceokay's wrote: > AI will never produce a deletion. I acknowledge your example of tidying up some code. What Bill Joy may have characterized as "working in the small". But what of novelty, craft, innovation? Can Gen-AI, moot the need for code? Like the oft-cited example of -2,000 LOC? https://www.folklore.org/Negative_2000_Lines_Of_Code.html https://www.folklore.org/Negative_2000_Lines_Of_Code.html Can Gen-AI do the (traditional, pre 2000s) role of quality assurance? Identify unnecessary or unneeded work? Tie functionality back to requirements? Verify the goal has been satisfied? Not yet, for sure. But I guess it's conceivable, provided sufficient training data. Is there sufficient training data? You wrote: > only focus on adding new features Yup. Further, somewhere in the transition from shipping CDs to publishing services, I went from developing products to just doing IT & data processing. The code I write today (in anger) has a shorter shelf-life, creates much less value, is barely even worth the bother of creation much less validation. Gen-AI can absolutely do all this @!#!$hit IT and data processing monkey motion.
- gopher_space 1y ago> Can Gen-AI, moot the need for code? During interviews one of my go-to examples of problem solving is a project I was able to kill during discovery, cancelling a client contract and sending everyone back to the drawing board. Half of the people I've talked to do not understand why that might be a positive situation for everyone involved. I need to explain the benefit of having clients think you walk on water. They're still upset my example isn't heavy on any of the math they've memorized. It feels like we're wondering how wise an AI can be in an era where wisdom and long-term thinking aren't really valued.
- roenxi 1y agoManagers aren't a separate class from knowledge workers, everyone goes down on the same ship with this one. If the AI can handle wisdom it'll replace most of the managers asking for more AI use. Turtles all the way down.
- KurSix 1y agoAI can refactor or trim code. But in practice, the way it's being used and measured in most orgs is all about speed and output
- Lutger 1y agoSo its rather that AI amplifies the already existing short-term incentives, increasing the harder to attribute and easier to ignore long-term costs. The one actual major downside to AI is that PM and higher are now looking for problems to solve with it. I haven't really seen this before a lot with technology, except when cloud first became a thing and maybe sometimes with Microsoft products.