You're forgetting the many thousands of lines of code that went into writing the web browser it runs in, and even more that went into the underlying operating system.
I think the point being made here is that the OP only had to write 99 lines of original code using a few libraries and tools to get a rather impressive web based spreadsheet. If that's not impressive to you than your standards might be slightly too high.
Hi, thanks for the feedback! Sorry if it comes across as bragging; the line count is kept minimal both to reduce reader's cognitive burden, and make inline commentary feasible.
Technically, Web Worker is not a library, and Traceur is used to translate ES6 to ES5 while browser support catches on, so AngularJS is the only library used.
It is possible to replace AngularJS (the only external library) with regular blur/focus/change handler as @xem shows — without affecting the line counts — but the separation of concerns between view, logic and worker would be less clear.
Do you really need separation of concerns in a 99-line codebase? This is like jQuery all over again. Use the right tool for the job, and consider that the right tool might just be no tool at all.
Fair point. I should have explained the context better; this is for "500 Lines or Less", the fourth in the Architecture of Open Source Applications series, aimed more at new students than professional programmers, so separation of concern serves a pedagogical, rather than practical, purpose.
In a couple year's time, Web Components, Shadow DOM, and Object.observe may very well make application of this size not requiring AngularJS anymore, just like the "no tool at all" document.querySelector replaced jQuery.
I'd be happy to revise the chapter once a suitable polyfill exists for today's browsers — pull requests welcome, too!
Comments
... dependencies with 3 other libraries: AngularJS, WebWorkers, and Traceur Compiler
Not 99 lines anymore, hence no bragging rights
And # of lines stop being a problem since VAX computers
You're forgetting the many thousands of lines of code that went into writing the web browser it runs in, and even more that went into the underlying operating system.
I think the point being made here is that the OP only had to write 99 lines of original code using a few libraries and tools to get a rather impressive web based spreadsheet. If that's not impressive to you than your standards might be slightly too high.
Fair enough. Then libraries shouldn't count
Excel spreadsheet in 1 line of code:
<iframe width="400" height="560" frameborder="0" scrolling="no" src="https://onedrive.live.com/embed?cid=20F065AFC1ACDB2E&resid=2...
Hi, thanks for the feedback! Sorry if it comes across as bragging; the line count is kept minimal both to reduce reader's cognitive burden, and make inline commentary feasible.
Technically, Web Worker is not a library, and Traceur is used to translate ES6 to ES5 while browser support catches on, so AngularJS is the only library used.
The non-Traceur ES5 version at https://github.com/audreyt/500lines/tree/master/spreadsheet/... has exactly the same line count, but with more idiomatic workarounds that's less clear to students new to web development (the audience of this book).
It is possible to replace AngularJS (the only external library) with regular blur/focus/change handler as @xem shows — without affecting the line counts — but the separation of concerns between view, logic and worker would be less clear.
Do you really need separation of concerns in a 99-line codebase? This is like jQuery all over again. Use the right tool for the job, and consider that the right tool might just be no tool at all.
Fair point. I should have explained the context better; this is for "500 Lines or Less", the fourth in the Architecture of Open Source Applications series, aimed more at new students than professional programmers, so separation of concern serves a pedagogical, rather than practical, purpose.
In a couple year's time, Web Components, Shadow DOM, and Object.observe may very well make application of this size not requiring AngularJS anymore, just like the "no tool at all" document.querySelector replaced jQuery.
I'd be happy to revise the chapter once a suitable polyfill exists for today's browsers — pull requests welcome, too!
Thanks for clarifying. I can see why you'd go this route when presenting it to students, but it seemed odd to show off in this venue.
Understood. Not meant as a show-off, but for people interested in comparing DOM-only versus AngularJS styles, here is a version that uses only DOM functions: https://audreyt.github.io/500lines/spreadsheet/as-without-an...