Live data from Hacker News

Ask HN: What are some of the most elegant codebases in your favorite language?

news.ycombinator.com

11–20 of 186 posts

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#11
My own ( c# ). It's not opensource yet, monetizing it first.

Full DDD, it was a refactor during COVID-19 for my ecommerce.

It powers https://belgianbrewed.com

Copy paste from: https://news.ycombinator.com/item?id=35257225

> But I believe the project is much cleaner and frankly better to understand than all other projects i've encountered for this size. I'm using DDD, so DDD knowledge is a requirement to navigate this in a breeze :) :

- https://snipboard.io/D03VWg.jpg - General overview of the architecture. Small fyi: Connectors => Autogenerated nugets to call the api's

- https://snipboard.io/9M24hB.jpg - Sample of Modules + Presentation layer

- https://snipboard.io/ybp6EH.jpg - Example of Specifications related to catalog ( = products )

- https://snipboard.io/lE9vcK.jpg - How specifications are translated to the infrastructure ( here I'm using EF, so I'm using Expressions a lot), but plain old SQL is also supported. A query is basically a list of AND/OR Specifications where a hierarchy is possible. This would translate to "(QUERY 1 ) AND ((QUERY 2) AND (QUERY 3))" in the Infrastructure layer.

- https://snipboard.io/7rVBpk.jpg - . In general, i have 2 List methods ( one for Paged queries and one not for Paged queries)

Additional fyi: Is V2, so has some legacy code. Uses my own STS. Has 2 gateways ( the ShopGateway that is used to develop new sites and the BackendGateway for the Backend). Enduser frontend is in MVC for SEO purpose, Customer backend is in Angular ( SPA). The basket is a NoSql implementation on top of SQL server.

The enduser frontend supports a hierarchy of themes ( so it's insanely flexible to create variations of pages for other clients).

There are more projects involved outside of this solution, eg. nuget repo's usable accross solutions (JWT, Specifications, ...) and "plugins" for a standalone project that is installed for end-users for syncing local data. So it's +101 projects :)

Edit: my specification implementation has been open-sourced here: https://github.com/NicoJuicy/Specification-Pattern-CSharp

Someone was curious to see it.

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#12
post #9
post #7

Earlier quoted context omitted.

I'm currently using Laravel at work. It's very opinionated, and some folks say it uses anti-patterns with regards to its use of facades. That being said my last job was C#/.Net and I am so much more productive with Laravel. It really allows you to develop quickly and I haven't yet bitten by any of the "anti-patterns". If you give it a shot I'd recommend just using Laravel Sail as, if you already have docker installed…

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?

#13
For Lisp I would recommend Edi Weitz's CL-PPCRE: https://edicl.github.io/cl-ppcre/

Pretty much anything else from Edi Weitz is also great.

Mezzano is quite elegant in my opinion, especially for an operating system. For example, this is the USB mass storage driver: https://github.com/froggey/Mezzano/blob/master/drivers/usb/m...

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#15
post #9
post #7

Earlier quoted context omitted.

I'm currently using Laravel at work. It's very opinionated, and some folks say it uses anti-patterns with regards to its use of facades. That being said my last job was C#/.Net and I am so much more productive with Laravel. It really allows you to develop quickly and I haven't yet bitten by any of the "anti-patterns". If you give it a shot I'd recommend just using Laravel Sail as, if you already have docker installed…

To me, "anti-pattern" has the same bogus meaning as "clean code"

Although at a high level many of things things are subjective, this take is almost entirely wrong in every dimension.

Anti-patterns are things like using a wrong data structure, using the wrong levels of abstractions, tightly coupling components so they are not composable, leaky interfaces, god objects doing too much

The strict definitions of many of these can be subjective at the edges, but they all objectively exist and cause fragility, instability, inflexibility and maintenance problems in the systems built from them.

Clean code is code that’s easy to read, has the right level of abstractions, uses the right data structures and has the minimal possible anti-patterns in them (ideally zero!) above.

Calling these things bogus is unfair, I grant they can be subjective in some places but they are prevalent in poorly designed systems especially by junior engineers.

Wikipedia page on anti-patterns: https://en.m.wikipedia.org/wiki/Category:Anti-patterns

There are project management anti patterns too https://en.m.wikipedia.org/wiki/Anti-pattern

Anti patterns are real. Clean code is real. If you cannot see that, I would suggest reading a lot more codebases from open source projects (pick medium and large codebases, not trivial programs) and after 10 or so you will see obvious structural and quality differences, as well as hundreds of anti patterns and examples of clean code.

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#16
post #10

At 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?

#17
post #6

So many, I like reading how other people write code. R - sf package is a clean example of functional OOP Python - pytudes (Peter Norvig’s notebooks) Haskell - Elm compiler. I could mostly understand what’s going on even though I barely know any Haskell. Ruby - Sequel is really nice. Rust - Ripgrep Pretty much any F# codebase is super readable too.

Do you have any F# favorites? People often mention jet.com repos, but I’m interested to hear about others.

Re: Ask HN: What are some of the most elegant codebases in your favorite language?

#19

My own ( c# ). It's not opensource yet, monetizing it first. Full DDD, it was a refactor during COVID-19 for my ecommerce. It powers https://belgianbrewed.com Copy paste from: https://news.ycombinator.com/item?id=35257225 > But I believe the project is much cleaner and frankly better to understand than all other projects i've encountered for this size. I'm using DDD, so DDD knowledge is a requirement to navigate this…

"I just finished reading the greatest script I've ever read in my life."

- "Oh, really? Who wrote it?"

"I did."

Post reply on HN