5 ms·
I also hoped this submission could trigger a discussion about the code style. This guy is a Mozilla contributor, probably what other posts mean when they talk
by swah 15y ago
I also hoped this submission could trigger a discussion about the code style.
This guy is a Mozilla contributor, probably what other posts mean when they talk about "great programmers", right?
Yet, for now, his implementation is a single 3000 line file.
[edited for alternate ending]
So there is this guy who writes a PDF viewer in a 3000 line file, and the guy who writes another simple web app neatly organized in 42 files... Which one would you want on your team?
I wonder how jslinux source code is organized.
- drivebyacct2 15y agoWhat are you asking me to agree about? I would never get caught dead working on a 3000 line file, and honestly, that seems like a terrible way to have to add new features.
- barrkel 15y agoSome perspective: $ wc -l expr.c decl.c 26638 expr.c 34860 decl.c
- drivebyacct2 15y agoReally? Downvoted this much for simply implying that I don't appreciate 3000 line files? I didn't imply that it was bad or wrong, just that I wouldn't prefer to work with that type of style. And I hardly think that a couple of hyper counter examples takes away from my own opinion in coding style.
- swah 15y agoI apologize for editing my comment - after reading yours - to try to convey my message better. And failing to do that, and making yours kinda senseless. Will avoid that in the future.
- drivebyacct2 15y agoHehe. No problem, I was just generally blown away. Loading the full thread back up makes it more obvious now. Oh well, I get edit happy too!
- dangoor 15y agoPerhaps Andreas is waiting on ECMAScript Harmony modules: https://bugzilla.mozilla.org/show_bug.cgi?id=568953 https://bugzilla.mozilla.org/show_bug.cgi?id=568953 :)
- karolist 15y agoI think this is far from production ready code and this guy just wanted compact code. Perfectly fine for a quick copy/paste demo. Another thought - this could be the output of his packed code, sort of like what we get when downloading mootools unminified - one big file, but that's not how authors store the code internally.
- jkkramer 15y ago3000 lines of spaghetti code is one thing. But this code is pretty-well modularized. The author obviously knows what he's doing. Maybe he finds it easier to jump around the file that way. I know I've built up projects like that. When it starts to transition from tech demo to real product, I would probably break it up into different files (util.js, lexer.js, etc). But no harm in the meantime. A simple web app spread across 42 files might actually be terrible and over-engineered. Or it might not. The moral is: don't judge code quality by isolated metrics.
- samlittlewood 15y agoWhich one would I want on my team? - the one that produced game changing results. If I need to send in some students with cattle prods and bio-hazard suits after the fact - so be it. I have seen _many_ important demos and prototypes that were truly ear-bleeding - to the point where I would say it is a common characteristic of this sort of work.
- RuadhanMc 15y agoHe's getting stuff done. That's what great programmers do. Also, a PDF viewer isn't simple. If he can write a PDF viewer -- that works with a variety of PDF files -- in a short space of time, I wouldn't really mind how he organizes the code. It's the research behind the code that takes the time here.
- y0ghur7_xxx 15y agowhat's wrong with a 3000 line js file? if the code is organized well, a good editor with an outline view makes jumping around 3000 lines no problem. actually I would prefer it over multiple files if I feel the code I wrote belongs to that "module".