News for hackers. Stuff that matters.
Re:JavaScript is not suitable for large web apps by voidr on Thursday June 14, 2012 @05:40PM (#4113649)
This article only proves the author's incompetence to develop and maintain large JavaScript projects, nothing more.

> I don’t know why but JavaScript programmers tend to put all of their code into few files. That’s not so useful, though, if you want to have multiple developers work on the same project. Splitting up the code into multiple files enabled us to scale the project.

Let me rephrase that:

"I don’t know why but incompetent programmers tend to put all of their code into few files."

Last time I checked JavaScript does not have a file count limit.

The author should learn to talk in first person. I'm pretty sure I could write a horrible ActionScript app, if I wanted to, but that would not make ActionScript horrible in general.

Re:JavaScript is not suitable for large web apps by Arelius on Thursday June 14, 2012 @06:19PM (#4113816)
Ok, seriously, I'm sort of sick of the file-stew meme in software development these days. Our editors aren't particularly designed for the one-file-per-function method of development that's been ohh-so-common. Serious, if a file is under a hundred lines of code, it probably doesn't need to be a separate file, it only undermines the grouping value that files are useful for.
Re:JavaScript is not suitable for large web apps by voidr on Friday June 15, 2012 @01:16AM (#4115150)
I usually do the following:

- if function A and B are always used together, than they are one file.

- if linecount gets to big, split A and B into separate files

- if function C is shared between modules than it belongs in it's own file

So far it worked out great.

Re:JavaScript is not suitable for large web apps by Arelius on Saturday June 16, 2012 @02:51AM (#4120050)
So long as #3 takes #1 into account.
Re:JavaScript is not suitable for large web apps by untog on Thursday June 14, 2012 @06:22PM (#4113838)
I know exactly why they do it- to cut down on HTTP requests. But then it's trivial to minify and compact your JS into a single file. It sounds like he's just worked on bad projects.
Re:JavaScript is not suitable for large web apps by CmdrKrool on Friday June 15, 2012 @01:50AM (#4115245)
And also because browser-side JavaScript does not have standard modules, where one is able to 'import' another. So even in the development phase, pre-minification, one is discouraged from making new files because of the pain of adding corresponding <script> tags in the HTML file or files and then getting them in the right order, and the larger the project the less you want to be tracking those dependencies manually.

While you can use a module loader library you still have to choose one, learn it and its quirks and adapt other external libraries to use it (some of which might be written for another module loader or - horror of horrors - use their own half-arsed module system).

As for "file-stew" mentioned by the sibling comment, small units are good if you like code reuse. For example, I get sick of writing very basic classes like 'Rect' and 'Vector' (for graphics) over and over again.

Re:JavaScript is not suitable for large web apps by daba on Friday June 15, 2012 @04:41AM (#4115601)
In my opinion "That’s not so useful, though, if you want to have multiple developers work on the same project." is much more revealing. Has this guy never heard of VCS? If you use a modern VCS it does not make any difference if you split your source into lots of different files or have it all in one. At least not regarding the number of developers working on the project.