DEV Community

Discussion on: Do you think writing clean code is a bit difficult in javascript compared to other languages ?

Collapse
 
codewithbug profile image
codewithbug • Edited

thank you for your response. i often look at the opensource project at Github, for projects which are written with php or python it it easier to read and it takes less time to understand what it is for. but when it comes javascript , i think javascript's oop approach is not what it should be, i mean in my opinion it lacks of oop principles. when i wrote code in a procedural style , other people read and understand it a lot easier but when i do it with oop paradigm, it is harder for them to read it. i think that another reason is manupilating dom with js. generally when i write a script without any DOM interactions is it much more easier to read and extend it

Collapse
 
aminnairi profile image
Amin

I agree with all of your points.

JavaScript prototype-based was one of the hardest points and I spent a long time understanding it coming from C & C++.

Recently, with the ECMAScript standard, they tried to make it look like a real OO language by adding some keywords like class or static but it is just syntactic sugar over this prototype-based programming paradigm. And since they are two different concepts, this OO emulation in JavaScript is nowhere near complete compared to PHP or C++.

In my opinion, it was a huge mistake. They should have gone to a more procedural path, or even functional, it would have been far easier to take, again still in my opinion.

It's funny how I can relate to your comment. I feel less lonely now. Haha!