Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Either run it through a minifier or have the whole thing unminified, these single lined functions look horrific, and are saving characters for the sake of it.

Terrible naming, e.g. 'vis' -> reading the function it means toggle visibility, so it should be called 'toggleVisibility', you shouldn't have to read what the function is doing to understand what it will do.

You ever get a bug in your code, It's not fun to look back at badly maintained code and go 'oh, shit, what does this do again?'.



> Terrible naming, e.g. 'vis' -> reading the function it means toggle visibility, so it should be called 'toggleVisibility'

But it doesn't toggle visibility. It sets visibility.


Yeah, you're right, I misread the code. It should be called 'setVisibility' then.

A problem that wouldn't exist if it was named correctly in the first place ;)


I couldn't disagree more with your first sentence - being able to see all those functions in the first page of the code above the fold is what makes this 10 times easier to understand than any React or Angular component I have ever seen. In fact if a function doesn't fit on one line, it should be refactored into simpler functions until it does. Oh for a full UI framework like this made of single line functions - One Line Framework. However I am biased having used asm in the 70s, C in the 80s, java in the (late) 90s, and javascript in the naughties and teens.


Official name of the one line per function framework is FOOL - Functions on one line.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: