C - Redis
Ask HN: What are some of the most elegant codebases in your favorite language?
31–40 of 186 posts
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#32[dead]
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 your favorite language?
#33[dead]
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#34At the beginning of the year I was rewriting a SPA and looking for ideas on how to structure a web app. One project I looked at was Github Desktop and I think it has very clean code for an app. https://github.com/desktop/desktop
Now if only GitHub desktops actual UI/UX wasn't a poorly thought out mess of anti-patterns and anti-design.
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#35In Perl, everything serializes to JSON without fuss. It can be "lossy"; objects without an explicit JSON serialization method and coderefs can't be deserialized, but serializations at least have placeholders for them.
Compare to Python's json module, which doesn't try very hard to serialize things and throws exceptions every time it runs across something new. It's very frustrating to use.
Perl's DBI provides a universal API for all databases, with implementation-specific details in an underlying DBD module (which both provides glue between the DBI abstraction and programmer access to features specific to different database systems).
Compare to Python, where you need to import a different module and use a different API for every different kind of database. As I increasingly use Python for a living, I frequently wish they'd follow Perl's example with this.
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#36Earlier quoted context omitted.
To me, "anti-pattern" has the same bogus meaning as "clean code"
That's an interesting take! I'm still early in my career and I ask with genuine curiosity, but why do you think "clean code" has a bogus meaning?
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#37[dead]
Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#38Working with Perl, two things spoiled me for other languages: JSON and DBI/DBD. In Perl, everything serializes to JSON without fuss. It can be "lossy"; objects without an explicit JSON serialization method and coderefs can't be deserialized, but serializations at least have placeholders for them. Compare to Python's json module, which doesn't try very hard to serialize things and throws exceptions every time it runs…
```rb
# hashes
{ foo: 'bar' }.to_json
# numbers
28.to_json
# anything really
['hello', 42, { lorem: "ipsum" }].to_json
```Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#39Re: Ask HN: What are some of the most elegant codebases in your favorite language?
#40Earlier quoted context omitted.
That's an interesting take! I'm still early in my career and I ask with genuine curiosity, but why do you think "clean code" has a bogus meaning?
Not the OP, but clean code misses the point. Its is very subjective and depends on one person's previous experience and patterns they've been exposed to. "Reasonably readable" is what I strive for nowadays, and a key aspect is that I no longer think there is an objective measure for it. It depends on the team/company you're in, and its important to keep in mind that the goal is to effectively communicate the program…