DEV Community

loading...

Discussion on: The Shocking Immaturity of JavaScript

Collapse
guledali profile image
guledali • Edited

I agree with everything said in this blog post, probably the best thing I have read so far this year.

I have been reflecting lately on Ruby on Rails, how it brought two developers to the same page.

For example let say your manager comes to you one day and says,

"Hey you see this username field in creating a new user, I like it to be required to fill in when creating a new user"

You thinking to yourself yeah that make sense.

If you ask three rails developers from different part of the world, one junior, mid-level and senior. They all going to present the same answer

class User < ApplicationRecord
  validates :username, presence: true
end
Enter fullscreen mode Exit fullscreen mode

The difference might be that the mid-level and senior are going to make constrains in the database level. Probably having model-test, controller-test and system test as well and maybe some better validation-rules some nice validation message along side but the bottom-line is.

At the core they all have the same answer and they know where to fix it and what or which methods to use.

Now ask three javascript developer and you will get 3 different answers and none of those answers look a like. Not only that, but should it be handled in the backend or the frontend? What npm-package should we use?

There is this famous quote of javascript

"Any application that can be written in JavaScript, will eventually be written in JavaScript"

We are living in that reality right now and honestly I don't think it's good one to live in and we have seen that play out for the past 10 years the Everything.JS movement

I also believe frontend frameworks themselves are bringing some issues with them. For example rails provides awesome form builders that are nicely integrated with rest of the framework(rails routes, controllers and so forth).

Why would you wanna replace that and rest of ActionView library with react.js or any other javascript framework?

The sad part most people are doing that for no reason spinning up rails api instead using the framework as MVC and spending days building a CRUD app that would have take you 1-minute to implement in vanilla rails app that's well tested.

Collapse
mangor1no profile image
Mangor1no

Bruh. w3schools.com/tags/att_input_requi....
You don't need a package to make a field to be required when submit. It's just there are many different ways to do it. There are simple ways and advance ways. Just the personal decision to finish the task tho. IMO I follow KISS principle and try to reduce libraries/packages in my project as much as possible.

Collapse
guledali profile image
guledali • Edited

Make a field "required" and adding a validation to a field, are two different things number one. Let's get that straight. Btw you can easily go around this by inspecting and remove the flag required but to the point and you said it yourself,

" It's just there are many different ways to do it "

Which is the main problem with JS development that we see today so many ways of doing this and bike-shedding and no-one agrees on anything even if they are using same tools, libraries & framework. It's still different enough somehow.

One thing that all JavaScript frameworks and projects have in common,

"Is that they can easily get of the rails, whereas ruby on rails stay on the rails"

Thread Thread
mzzfederico profile image
Federico Muzzo

If your backend isn't doing validation there's no amount of JavaScript that can fix it.

Forem Open with the Forem app