It's been a while since I've posted, for obvious reasons a lot has changed in the realm of programming.
LLMs, "agentic" coding et al. I've started using them almost from day one, when they were pretty bad and they could barely generate some readable text in their images.
When it comes to coding, being in my late 30s, I'm clearly what I'd call an "old-school" programmer: I'm using vim with a couple of plug-ins, a fast terminal emulator, minimalistic Docker, brew on MacOS i.e. nothing fancy, not even using IDEs.
I like my dot-files, I love the idea of slowly improving them, it's a nice hobby that keeps me anchored and reminds me to keep learning new things. This is just to a bit of context in order to make my bias clear when it comes to LLMs and using them.
My main gripe with using LLMs for coding is that they incur a cognitive debt and no, I'm not quoting all the studies around this problem (nothing wrong with them), this purely from my empirical point of view.
For example, I was cleaning up my cloud storage, which is a mess of lots of tiny files moved from different cloud storages: Google Drive to Dropbox to iCloud. Over the years this generated a lot of duplicate files i.e. bad syncs, the infamous file_name { 2}.jpg
.
As I usually do, I apply the brute force approach and started cleaning them up one by one - this got tedious fast so I was ok, hello generic-LLM, please write a Ruby script to remove these kind of duplicates. The generated code looks like this:
#!/usr/bin/env ruby require 'optparse' require 'fileutils' require 'find' # CLI options options = {} OptionParser.new do |opts| opts.banner = "Usage: ruby dedup.rb [options] /path/to/dir" opts.on("-d", "--delete", "Delete duplicate files") do |d| options[:delete] = d end end.parse! # Directory check directory = ARGV[0] unless directory && Dir.exist?(directory) puts "Please provide a valid directory path." exit 1 end # Helper to detect duplicates in "filename 2.ext" style def find_duplicates(files_by_dir) duplicates = [] files_by_dir.each do |dir, files| files.each do |file| match = file.match(/^(.*?)( \d+)(\.[^.]+)$/) next unless match original_name = "#{match[1]}#{match[3]}" duplicate_name = file if files.include?(original_name) duplicates << [File.join(dir, original_name), File.join(dir, duplicate_name)] end end end duplicates end # Helper to format size nicely def human_size(bytes) units = ['B', 'KB', 'MB', 'GB', 'TB'] return '0 B' if bytes == 0 exp = (Math.log(bytes) / Math.log(1024)).to_i "%.2f %s" % [bytes.to_f / 1024**exp, units[exp]] end # Recursively collect all files by directory files_by_dir = Hash.new { |h, k| h[k] = [] } Find.find(directory) do |path| next unless File.file?(path) dir = File.dirname(path) name = File.basename(path) files_by_dir[dir] << name end # Find duplicates duplicate_pairs = find_duplicates(files_by_dir) # Track total size total_duplicate_size = 0 # Compare sizes and act duplicate_pairs.each do |orig_path, dup_path| if File.size(orig_path) == File.size(dup_path) size = File.size(dup_path) total_duplicate_size += size puts "Match: #{orig_path} <=> #{dup_path} (#{human_size(size)})" if options[:delete] File.delete(dup_path) puts " Deleted: #{dup_path}" end end end # Final total puts "\nTotal duplicate size: #{human_size(total_duplicate_size)}"
It's pretty meh from many points of views, for example as I love ActiveSupport, the generated method human_size(bytes)
is just horrid. I could have generated this using standard *nix tools + some bash, but I went with Ruby as it is much more familiar and easier to grok for me.
The script was generated in around 15.minutes ? a couple of promptly iterations - now, if I were to write this from scratch, knowing myself - this would had been a small gem and I'd probably would have spend some time getting the recursive directory checks right.
At the end of the day - I created something useful for myself, which was rather easy to check since it was "coded" in Ruby. If I were to write this from scratch this experience would have been completely different.
There's also a cognitive dissonance about this: why didn't I just write it myself ? it would have been fun, I just wanted to save some time, but at what cost?
This is why the whole LLM human assisted code generation is not a full boon - it's like cheating your brain, not learning anything, and it also leaves you in a state of dissonance.
Are LLMs going away ? No. I will stop using them ? No. I just need to fix my cognitive dissonance when it comes to their use and in the process, avoid rotting my brain, after all, people will start calling me soon enough an "analogue programmer".