A couple of days ago I had just finished coding a feature in EZchecklist that I'd wanted to do for a long time. It took about 5 hours to get working, and it looked good, but the underlying coding was so ugly that I couldn't bear it if anyone ever saw it. The odds of someone seeing the ugliness were extremely remote, but before I went to sleep I promised myself to rewrite the code so that it was more presentable (to myself, at least).
That opportunity came the next morning because I just couldn't live another day with all that ugly code living inside my computer, even though it was invisible to the world except me, of course. Another five hours and it was done. Two hundred plus lines of code replaced with 39 lines.
Feeling much better about the transformation, I then had the thought that chatGPT 4.o might be able to do better, so I copied and pasted the code into the AI and asked it to optimize it... if it can. AI got it down to about 18 lines and did it in about 5 seconds, tops, but it's not as easy to follow as my code. Sure, it would run a bit faster but speed is not the issue here.
Having a coder to coder chat with AI about the various approaches to the problem was amazingly educational. For me. I doubt AI learned anything, and sure didn't have that warm fuzzy feeling of getting something to work.
Maybe I'll go back later and implement AI's optimized coding. Maybe not. There's something to be said for pride of human workmanship rather than the sterile perfection of AI.
And I'm happy that, at 82, my mind is still capable of learning new approaches to coding.
Note: I asked AI to illustrate the concept. It took about 10 seconds. I couldn't have done it in 10 years.
No comments:
Post a Comment