What about useless program ?
500 Lines or Less (2016)
11–20 of 45 posts
Re: 500 Lines or Less (2016)
#12One of my goals is to rewrite all software for developing software, with each application at about (or less than) this sweet spot. Database, version control, runtime type system (Lua), proto-like serialization, code refactoring, parsing library... The list goes on. About the only heavy thing will be the text editor, and I'm still keeping that at a few thousand lines (+ a small core data structure library). When you c…
What I found to work really well to trim down my own text-editor was a combination of externalising all menus etc.. E.g. opening files, selecting themes, selecting buffers, all call out to scripts using rofi or similar to do the actual selection, and going client-server so that e.g. I get multiple windows etc. "for free" by just spawning another instance of the frontend which reattaches to the same server.
It's still certainly not 500 lines, but small-ish.
> When you cut requirements you can make things small and easy to understand.
Fully agree with this, and one great way of keeping requirements small like this for me is that I started with the idea that this is my editor. I will only cater to my requirements for the editor itself, but split out shared/reusable functionality in separate libraries so if anyone wants to fork it one day and make their editor we can share much of the code without either of us having to sacrifice.
I think too many people insist that everything they build need to be a "product" that they'll let grow to satisfy as many people as possible even when it'd be better to end up with a dozen smaller, more focused tools.
Re: 500 Lines or Less (2016)
#13What about useless program ?
Re: 500 Lines or Less (2016)
#14One of my goals is to rewrite all software for developing software, with each application at about (or less than) this sweet spot. Database, version control, runtime type system (Lua), proto-like serialization, code refactoring, parsing library... The list goes on. About the only heavy thing will be the text editor, and I'm still keeping that at a few thousand lines (+ a small core data structure library). When you c…
Re: 500 Lines or Less (2016)
#15Corpos will see "500 lines" whatever the dependencies, serious software will embrace the whole software namely with the SDK and dependencies.
Re: 500 Lines or Less (2016)
#16Hmm. I get the sentiment (500, i.e. not too short, not too long), but 500 lines will mean different things for different people and different programming stacks. It literally can mean 50000 vs 500 "lines of knowledge" required. I'm not sure why would you name your book like that. Consider: 500 lines of defensively written web server C++ code. 500 lines of C driver code. 500 lines of assembly. 500 lines of php script.…
Re: 500 Lines or Less (2016)
#17Hmm. I get the sentiment (500, i.e. not too short, not too long), but 500 lines will mean different things for different people and different programming stacks. It literally can mean 50000 vs 500 "lines of knowledge" required. I'm not sure why would you name your book like that. Consider: 500 lines of defensively written web server C++ code. 500 lines of C driver code. 500 lines of assembly. 500 lines of php script.…
I recently wrote an 8bit style CPU simulator (with it's own simple but perfectly usable instruction set) and assembler, together they fit into 1000 lines of C... To be fair that's a fairly specific case where C works really well though!
Re: 500 Lines or Less (2016)
#18Hmm. I get the sentiment (500, i.e. not too short, not too long), but 500 lines will mean different things for different people and different programming stacks. It literally can mean 50000 vs 500 "lines of knowledge" required. I'm not sure why would you name your book like that. Consider: 500 lines of defensively written web server C++ code. 500 lines of C driver code. 500 lines of assembly. 500 lines of php script.…
Re: 500 Lines or Less (2016)
#19I love this kind of stuff, because it shows one _can_ solve a pretty juicy problem with not that much code, honestly. Also because it suggests that the industrial-strength equivalent has a lot more in for use cases, corner cases, and/or optimisations that are not relevant for one's requirements (at least not yet, maybe not ever).
I aspire to write code like that. Useful, concise, but not obtuse. Some of my code is not as significant as those examples, and maybe falls short of my ideals, but it gets a lot done in well under 500 loc. e.g. my website maker in Bash [1] (hot-builds and hot-refreshes without JS), or the JS that drives text art animations for Hanukkah of Data [2].
[1] https://github.com/adityaathalye/shite is about 350 LoC counted this way (excluding the script containing HTML templates).
$ grep -E -v "^$|\\s?#" bin/{events,metadata,templating,utils,hotreload}.sh | wc -l
359
[2] https://www.evalapply.org/posts/animate-text-art-javascript/ the text art animator. $ grep --count -v -E \
-e "^$" -e "//" -e "/|\s+\*.*" \
assets/js/text_artist.js
213Re: 500 Lines or Less (2016)
#20Too bad the web page performs so poorly on mobile, when two small CSS tweaks would make it fully responsive:
1. Replace `width: 68rem` with `max-width: 68rem` on the body element;
2. Make the flex basis on the table container pixel rather than percentage based.