I am trying to make my way back to JavaScript (been there last time some 7 years ago) with the help of lovely "Eloquent JavaScript" book.

While I admire author's capabilities and approach, I have also began being concerned. I am from C/C++ background and there I learnt it rather hard way that funky constructs often undermine project survival.

Experience with the Perl proved different. Being capable of cool tricks seemed a valuable perk.

So, what is the common view upon JavaScript code complexity. Does using it at "full speed" (OOP done own way, higher order functions everywhere etc) help having maintainable projects? Thanks for your answers

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers
2

Some people may not like javascript frameworks, but the fact that such frameworks are popular means that they really help to structure your code and make it more maintainable.

The most popular framework seems to be backbone.js, they even explicitlly say that Backbone.js gives structure to web applications.
It looks like some kind of a MVC framework, i.e. data are stored in models, they are rendered by views and also there is a router (like controller) that makes http requests.

Some people prefer knockout.js which uses different pattern which is called Model-View-ViewModel instead of MVC. Promoted by Microsoft.

Angular.js is popular too, but it isn't a pure javascript framework and it uses lot of HTML annotations. Promoted by Google.

Also there are lot of frameworks that look like backbone.js but slightly different, for example ember.js.

In conclusion I can say that javascript frameworks became very popular recently and maintenability isn't an issue anymore.

in my opinion is hard to maintain js code of a project by using pure java script code. I recommend to use java script libraries like jQuery. Also you may take note that js code can be written in OOP manner. Some documentation you can find here.

So, my common view upon JavaScript code complexity and maintainability is to use java script libraries/frameworks in order to reduce/handle complexity, and also it help you to standardize the code, from where it results a easier way to maintain it. You may also consider to use OOP paradigm in your java script code.