News for hackers. Stuff that matters.
Re:Ask HN: What are some of the most elegant codebases in yo... by danap on Saturday June 17, 2023 @12:41PM (#36371846)
What else my own, Java, coding for over 50 years. If YOU can't figure out what your own code is doing after ten years of not looking at it then nobody else can either. Hint, Comment your thoughts as much as possible, to make things clear when there not to you.

Format just like a book. Use full text variables, methods, class names. Don't start a project until you define your formatting. Stick to it! Do this and your documentation will be easy.

"https://github.com/csanyipal/ajqvue/blob/master/src/com/dand..."

Re:Ask HN: What are some of the most elegant codebases in yo... by irl_chad on Saturday June 17, 2023 @01:18PM (#36372210)
A great example of how NOT to write Java. You say absolutely nothing with a whole lot of extra words.

For example: //============================================================== // Ajqvue Constructor //==============================================================

   public Ajqvue()
The constructor definition is already clear, I don’t need a big header telling me what a constructor is.

Instead, use comments generously where needed - for example, if you have a piece of business logic, a comment explaining the intent behind it can help the maintainer (likely you) a year down the road. What I mean by this, is that what your code DOES should be self evident - but documenting the business decision behind the implementation has done wonders for me.

Re:Ask HN: What are some of the most elegant codebases in yo... by Blahah on Saturday June 17, 2023 @01:19PM (#36372217)
The getWebsite method comment says it returns the version. That's an example of how not to comment - totally pointless and misleading if it diverges from the code. The code is nice and clear without the comments.
Re:Ask HN: What are some of the most elegant codebases in yo... by rjh29 on Saturday June 17, 2023 @01:23PM (#36372251)
Anyone suggesting their -own- code as an example of the "most elegant codebase" is dubious. Practice some humility.
Re:Ask HN: What are some of the most elegant codebases in yo... by travisjungroth on Saturday June 17, 2023 @02:29PM (#36372992)
I’d be a little forgiving if it was almost an art piece. Like, they spent a year making the most elegant JSON serializer possible.
Re:Ask HN: What are some of the most elegant codebases in yo... by freedomben on Saturday June 17, 2023 @01:44PM (#36372482)
This is pretty good! I'd be happy to work with you :-)

There are undoubtedly some pointless comments, but there are some good ones too, and the code is understandable. I think the sibling comments are being overly harsh and are zeroing in on single examples and missing the forest for the trees.

I suspect recommending your own code as an example of the most elegant codebase is triggering to others, so there's probably a negative initial reaction and probably a lot of people clicking your link so they can point out why you're wrong

Re:Ask HN: What are some of the most elegant codebases in yo... by dasil003 on Saturday June 17, 2023 @02:26PM (#36372966)
Good structure overall and appreciate the summary at the top. For the inline comments more "why" and less "what" would give higher signal-to-noise as a large percentage of that content is adding nothing that basic Java syntax and variable names don't already tell you.