DEV Community

[Comment from a deleted post]
Collapse
 
cathodion profile image
Dustin King

I'm not that much of a JavaScript developer, but I'd like to point out that the ability to do the same amount with less code is not nothing. Bug count is directly proportional to the number of lines of code, and difficulty of understanding and maintaining the code goes up as well the more code there is.

I'm not sure why you think code that uses jQuery is necessarily spaghetti code. Is it because it uses a lot of callbacks?

Collapse
 
belhassen07 profile image
Belhassen Chelbi

Generally when writing jQuery code, you're writing commands, when clicking on this hide an element, scroll to an element ... and maybe because it saves a lot of work and gives you some ready functions to use, it may be the case for vanilla too, I've been told in another comment that it maybe the developer work to write well organized code and I agree. But, if you used jQuery you'll find yourself throwing spaghetti code and it solves the problem, I mean it adds the functionality you want to add. So, It's not necessarily spaghetti code, but it encourages writing such code.
Thanks Dusting for your ideas and good curiosity ♥, Every comment can change my thoughts, I'm open for that.

Collapse
 
cathodion profile image
Dustin King

So as opposed to React where it at least encourages you to break it into components that maybe go in their own files, whereas jQuery lets you just put anything wherever?

I'm learning React myself. My toy project currently has most of the code in one file, but there's a feeling that I should maybe break them out into separate ones, once I get it sorted out how everything's going to work. I do like that it lets me have everything in the same file if I want without much fuss, unlike a certain language that rhymes with lava.