How to Build Complex Applications in Javascript

EDIT: The title should be a question!! As in: "How to Build Complex Applications in Javascript?" Sorry about that.

I'm really comfortable in Java and C#. I love these languages so much because I know them well and it's easy to be productive in them. You can create objects that help manage complexity and encapsulate data well and I actually find that fun. Also they are not as tricky as C++.

Going into the world of Javascript is daunting. The little twists on the language and the bad parts of JavaScript make me really not confident on how to begin.

I've only used Java and C# for school projects with partners, but I've made some decently complex systems with a lot of features that was manageable, flexible and fun to program in by using smart object-oriented design patterns.

I have a few questions:

  1. How do you leverage the functional aspects of Javascript to manage complex applications?
  2. Is it not recommended to use try to do everything as you would in Java/C#? Are there any downsides to fully using classes and inheritance?
  3. Are there any performance concerns when making some of the bigger applications that you can on Java/C# in Javascript? Can I just treat them the same?

Thanks.

Posted Apr 2, 2015, 12:58 AM UTC · edited

04
pierreten•
  1. Learn functional programming.

  2. Learn how to use modern javascript tooling effectively (build systems, linters, testing infrastructure)

  3. And the most important tip of all: DON'T WRITE COMPLEX APPLICATIONS IN JAVASCRIPT. Write many small, simple modules that can be stitched together to form an application (while of course leaning on the rich and diverse ecosystem of modules you'll find on npm)

Good luck!

2
x-skeww•

For larger applications, which are written by a team, the best option is to not use JavaScript. Since it lacks good tooling, it doesn't scale very well.

That super impressive Unreal demo, for example, was written in C++.

All of Google's projects seem to be written in Closure and/or GWT. Some of the new stuff is written in Dart. Angular 2 is written in a rigid style of TypeScript.

Polymer is written in JavaScript, but that's a JS library, not an application or framework.

While it's not impossible to write bigger applications in JavaScript, it's needlessly difficult. It also requires way more unit tests than anyone is willing to write.

For anything bigger than a few hundred lines, I'd go with Dart or TypeScript.

At the very least, use ES6 and something like Babel to make it work in current browsers. ES6 does add some badly needed structure with classes and modules.

2
corruption93OP•

Thanks for the reply. I was getting the impression this was the case. It sucks because I'm going for a job that uses all JavaScript but I'm slowly starting to dislike the language somewhat.

Oh well, I guess there's always personal projects I can work on!

1
x-skeww•

It sucks because I'm going for a job that uses all JavaScript

ES6 and TypeScript are viable incremental upgrade routes. Making the switch is always an option.

1