2 ms·
I think the only good use case I have for 50+ lines functions are finite state machines and renderers, whatever the form. Do you have other examples of 50+ lin
by orwin 3y ago
I think the only good use case I have for 50+ lines functions are finite state machines and renderers, whatever the form.
Do you have other examples of 50+ lines functions where you thought it was the best to not separate issues?
- fingerlocks 3y agoSpecialized parsers. Encoding and decoding tasks. Complex computation is often isolated to help with peer review. Pattern matching routines. Also, constructors with many validation steps that are compiler constrained to their local scope. That seems common.
- orwin 3y agoAren't specialized lexer/parsers finite state machines? As are encoder/decoders? OK fir complex computation, I left the world of mathematics 7 years ago, and I wasn't at the edge on that, I trust you, but to be clear, all your examples scream 'FSM' to me. If you have a pattern matching routine of 50+ lines that isn't a finite state machine, you're doing something wrong imho, and should consider changing abstraction (I'm not a big OO guy, but maybe use dynamic dispatch?)
- fingerlocks 3y agoYeah any routine that is not Turing complete is a FSM. Most things are FSM, so it’s not a useful distinction
- agent327 3y agoAnything consisting primarily of a switch statement with a great many cases.
- orwin 3y agoFinite state machines then. I never used more than 3 cases unless I had to write one.
- agent327 3y agoAlso event dispatchers. I've written switch statements for various event systems that need to handle 60-100 events. You can easily get to hundreds of lines without things getting unreadable.