DEV Community

[Comment from a deleted post]
Collapse
 
ravavyr profile image
Ravavyr

I've been coding 16 years and never memorized all the stupid rules.
None of these things are "bugs" if you understand the rules of the language.

Here's what I do:
I write code,
I run it,
It errors,
I change it,
I run it,
It works,
I move on to the next task,
and this is how things get built.

Javascript doesn't suck just because it has some quirks. Every single language has quirks. You learn them and make them part of your process.

Or you can complain about them on the internet because it gets you a lot of clicks.

Collapse
 
blackr1234 profile image
blackr1234 • Edited

Lol you are right but it may take a while to figure out if it has problems.

Collapse
 
stojakovic99 profile image
Nikola Stojaković

Javascript doesn't suck just because it has some quirks. Every single language has quirks.

Not like JavaScript, which has quirks because it was developed in 10 days. And it is a problem because we see more and more software being written in JavaScript even though it's not right tool for the job. There is no problem in using a hammer, but if you're too attached to it, everything will look like a nail to you.

I write code,
I run it,
It errors,
I change it,
I run it,
It works,
I move on to the next task,
and this is how things get built.

That's how I worked too. Then I realized I need to write tests if I want to have a long-term mantainable software.

Collapse
 
ravavyr profile image
Ravavyr

"It was developed in 10 days"
You are obviously biased about all this, so why bother continuing the discussion.
JavaScript isn't the problem. I do agree a hammer isn't the solution for everything. I come from a LAMP background, but have also accepted that 90% of new websites being created are done with JS so not learning and accepting its quirks is a bad move for the long term.

Tests are useful, but not most of the tests i see people that are like "did this page load? return true"....because that kinda test writing is an utterly useless waste of time.
All i know is, i work on my project until my code runs cross-browser and responsive and the logic is sound. Whether you write tests or not, the end result is what matters.

Hell, for many clients all that matters is if it works on their phone, but that's a discussion for another thread.

 
stojakovic99 profile image
Nikola Stojaković • Edited

You are obviously biased about all this, so why bother continuing the discussion.

Everyone is biased. The sentence you quoted is a fact - you can search it on your own.

We can't ignore that JavaScript is flawed. You just can't design a good language in 10 days, no matter how great your skills are or what tools you have at your disposal. I'm not saying we should ditch JS completely, just that we should be more objective. So no, it's not that I don't accept JS and don't move on - I'm working primarily in JS on my job, both on front-end and back-end, and that's why I think I have the right to discuss about these things.

Is JS better today? Yes, it's much better. And with TypeScript, it's possible to remove lot of baggage from your code base.

Tests are useful, but not most of the tests i see people that are like "did this page load? return true"....because that kinda test writing is an utterly useless waste of time.
All i know is, i work on my project until my code runs cross-browser and responsive and the logic is sound. Whether you write tests or not, the end result is what matters.

I don't know where you saw such tests but it's not proper testing. Whenever I'm working on a front-end code base I'm testing rendering of the components, not the whole pages (except if it's a purely static site with no framework at all). There is a reason we check for thing to be rendered - sometimes we may have some error in the component which can cause it to not be rendered on the page and that would seriously impact UX.

Whether you write tests or not, the end result is what matters.

Tests are not written for the sake of writing them. You write tests to ensure that your logic still works. Imagine that you're working on a huge website with bunch of different things happening all over the place. How would you ensure that everything still works as it should? You would always spend minutes and hours testing whole application again and again?

Collapse
 
fjanoos profile image
firdaus janoos

So basically you are saying you hack away at the code until it works with no particular care for rationality or logic

 
stojakovic99 profile image
Nikola Stojaković • Edited

No, I said I write tests for my code. I don't know where you got the idea that writing tests involves no care for rationality or logic when it's quite the opposite case (you need to understand your code very well to be able to write good tests). Writing tests even allows you to spot some possible problems much before the release. You should read more about TDD and testing code in general.