logoalt Hacker News

halfcattoday at 3:22 AM1 replyview on HN

How do you stay aware of all code being written?

Maybe it’s just me, but I’ve never understood how one understands from reading code. Yes you can understand what that code does, but not why it was done that way instead of a different way. In the end I only understand it deeply if I end up writing it. Chatting through it is helpful to me, but having AI crank out code loses all of that context pretty quickly.

I’m not disagreeing. Just curious how you think about this, and if there are key parts of your process that help you stay contexted in.


Replies

bottlepalmtoday at 4:06 AM

If you can't understand why the code is done in a certain way from reading it then the code is missing comments or needs to be refactored.

Even code you write yourself, given enough time, you will forget the why unless you wrote comments. In a way comments are as much for you as they are for others.

Even before AI, understanding code you didn't write is essential to working on a team of other developers. If you can't understand the code from reading it, then that's part of the feedback loop - too complex, needs comments, etc..

On large teams you'll spend as much time reading code as you do writing it. And long term when it comes to writing maintainable code - the ability for others to read and understand it, including the why of it, is paramount. Your code could literally be around for decades.

show 2 replies