×
Login Register an account
Top Submissions Explore Upgoat Search Random Subverse Random Post Colorize! Site Rules Donate
3

Is my code legible?

submitted by x0x7 to programming 5 monthsNov 30, 2024 00:29:49 ago (+3/-0)     (lab.gvid.tv)

https://lab.gvid.tv/x0x7/AdventOfCodeSolutions/src/branch/main/2023/Day2

When you care more about getting it done quickly than legibility and you know your functional programming muscle memory a millimeter above good enough to do it in one take.


5 comments block


[ - ] Sleazy 1 point 5 monthsNov 30, 2024 00:43:14 ago (+1/-0)

illegible

code in basic

[ - ] Trope 1 point 5 monthsNov 30, 2024 02:16:04 ago (+1/-0)

I stumble into a scary venue like GitHub or this place and I walk my sorry ass back the way I came.

[ - ] SithEmpire 1 point 5 monthsNov 30, 2024 04:23:05 ago (+1/-0)

I'd say it's legible with a bit of room for pretty print, basically the long lambda chains look nicer with one per line.

get_thing(source)
.split(delimiter)
.transform(somehow)
...

Also the "i=>i" idiom to filter nulls (or empty strings here), however prevalent it may be, weakens code legibility as opposed to a filter condition written more literally, or ideally if the API has a built in is_null (or is_empty) function intended to be named as a lambda.

Separately to that, for dynamic types it irks me if "i=>i" also throws out zero, false or such. Even if intended, it does so illegibly!

[ - ] JustALover 0 points 5 monthsNov 30, 2024 01:35:37 ago (+0/-0)

Worthless.

Even more worthless in 5 years, when you have to come back to it to fix something.

[ - ] x0x7 [op] 0 points 5 monthsDec 1, 2024 08:08:15 ago (+0/-0)

It's for a daily coding challenge. So being worthless in 5 years is precisely the idea.