22
When we work with object-oriented languages like Java and C# we have a whole process of analysis and design that helps us to know how to design the application to write more cohesive, less coupled and easier to maintain codes. The object-oriented analysis and design process serves any object-oriented language and therefore this process does not even depend on the chosen language.
At the moment I am working with Javascript. Basically, I have a layered division so that the application client is done with Javascript and the server (where all the logic is really) is done with C# and uses object orientation.
While the server part I know how to design and everything, the Javascript part I get quite lost. It turns out that Javascript has a different notion of objects. The language has no classes, no interfaces, is not strongly typed and this seems to me to be enough impediment to use the process of analysis and object orientation project as I know in Javascript.
So, is there any analysis and design process for Javascript? Principles, recommendations and standards that allow us to write more uncoupled Javascript code, easier to maintain and higher quality?
It’s a little wide. You can have a Javascript-rich site or just use jQuery for one or the other thing. When using little Javascript unit analysis and testing are dispensable as they are just simple events. When using full frameworks such as Emberjs or similar, it has its own conversions/way of working, which will help you. There are several frameworks that promise to fix the "little typing" of pure Javascript, but most sites maintain almost 100% of the logic in the same backend. It’s easier, Javascript is very bad in terms of maintainability.
– user7261
@Andrey agrees that JS is not as verbose as other languages, but the issue of maintainability goes far beyond that. As long as your code is clear and properly modularized, with each module performing a specific function and being well tested (Unit tests), there is no problem with maintainability. And the part of "most sites maintain almost 100% of the logic in the backend, JS is very bad at maintainability" is also questionable -- we have had a great growth of Spas (Single-page Applications) in recent years, not to mention that Node.js is a very popular back-end nowadays.
– Fabrício Matté