DEV Community

Cover image for Why JavaScript not Python for Web Development?

Why JavaScript not Python for Web Development?

Atul Bhatt on May 27, 2021

PS: Web Development term here primarily concentrated on Frontend Development. So today one of my friend asked me how to start web development in p...
Collapse
 
sudarshansb143 profile image
sudarshan

This is great.

Although, many people says that javascript is the language of web.

but, when it comes to things like multi threading , CPU intensive task excution and many more heavy lifting stuff, then javascript is no way near to (giant) PYTHON

Collapse
 
kdenehy profile image
Kelly R Denehy

Your comment is probably 5 years out of date.

Google "javascript performance vs. python" and you'll find numerous benchmarks showing javascript faster, sometimes MUCH faster, for most of them.

Javascript has supported multi-threading for quite a while. "Web Workers" are available in both the front and back ends, and there are several language constructs for performing asynchronous operations.

But if you love python, by all means use it for the backend, preferably for providing REST services.

Collapse
 
mohitdubey037 profile image
mohit dubey

He is just put his own opinion..it should depend on individual to select a particular language, but not to stick with that thats why he has used the word love. He has also used the global survery conducted by stackoverflow for better understanding.So it bit impressed by the article

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Thanks 😊

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

I wasn't mentioning preferring Python over JavaScript as being blind by love. I meant that he is just looking at python but ignoring the improvements JavaScript had gone through. But I would say I should have been more clear on this.

Javascript without doubt is the most dreaded language. But I can bet on it being the best for Web Development.

Collapse
 
gdledsan profile image
Edmundo Sanchez • Edited

So, some backedn languages do have libraries to write front end, like python to JS or ruby to JS compilers.

You could also skip that and go for webassembly with rust.

I have nothing against vanilla JS for front end, even jQuery or other similar libraries or frameworks that make your life easier mostly because JS is not good enough.

But anything beyond that is annoying, new libraries that requiere node just to install them and have no cdn version to just use them in the front are the sign JS should have stopped years ago.

Anyone starting in front end should not need node or deno for anything, and should definitely not start with the likes of angular, react or vue.

Bottom line, you are mostly wrong on all points by failing to mention that there are ways to skip JS all togheter and still achieve things in the front.

Btw, you seem awfully biased towards JS to be written about not being biased against it.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

I agree I was biased towards JS because it is better to learn JS in comparison to python when someone is starting with web development.

Python is good and I don't deny it. And I also agree to JS being the most dreaded language.

This article was written keeping the college students in mind who learn python and try to achieve everything with it.

This article is not about why always use JavaScript.

Collapse
 
narasimha1997 profile image
Narasimha Prasanna HN

Since you are talking about web development, one must not use Python (if not backend rendering). JavaScript is of course De-Facto. So this comparison would have made much sense if it was comparison between JavaScript v/s Rust (Web assembly). Coming to Web servers, I would prefer Python or JavaScript based on the need. For example, if I want to run AI inference I would prefer Python more than JavaScript. If it is just a normal web server which just does some calls to DB or other backends, I would prefer JavaScript.

JavaScript has much better performance when compared to Python - But this is dependant on the application. If you use JavaScript for image processing for example, it would be not useful, because we have many libraries for Python written in C/C++ that can take good performance gain. If my application is purely IO based, I would happily choose JavaScript (node.js) because we can use Node.js powerful event loop and asynchronous processing.

For frontend I would prefer more of Web assembly if I need high performance.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

I made this comparison because college students learn python and then try to do everything with it. Rust is language that's still alien to them. Majority of the college students.

This comparison is done intentionally for those college students trying to do everything with python front frontend, backend to mobile app development.

There are so many things python is good at and I won't deny that. I myself prefee python for scripting because of its easy syntax and plethora of modules and libraries available.
😊

Collapse
 
leewynne profile image
Lee • Edited

Nice post πŸ‘

Worth clarification though on frontend / backend. For backend I feel like there is no real justification for using JS if you don’t want to or if you have a use case for something else like Python / Ruby etc.

If this article is front end focused then it’s a conversation about JS frameworks v vanilla JS again.

If this article is fullstack focused then again the conversation is very different depending on the required outcome.

One thing I do agree on. Learning vanilla JS for browser/dom manipulation is πŸ’― worth investing time in. Learning Node for backend, not so sure, there are many beautiful options for that full stack story.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

This was written keeping in mind that someone who is beginner with knowledge of python and just entering into the web development should prefer JS over python.
The reasons are the one I mentioned.
The college students get to know python in college and try to do every possible thing with it.

And the fact you can always move towards optimization and better things once you have stepped in.

In the end tech stack becomes secondary with experience. The knowledge to implement things become the primary goal.
And yes, it's written keeping the Frontend in mind.
Thank you for your feedbackπŸ˜€

Collapse
 
calypso_eo profile image
PETERS • Edited

"Web runs on browsers" yes but that's a client, doesn't really have anything to do with not learning Javascript over Python but instead learning it alongside it. Browsers don't care about your backend implementations hence the use of frameworks like Django and Flask. You can run React and Django simultaneously so you don't necessarily need to pick one or the other. I always encourage people to learn using their favorite languages first. Language and frameworks are just tools, you pick the best tool to complete a job and on to the next, no need to revolve our personalities around them.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt • Edited

True. That's what the last line says. Treat languages like crushes not life partners.

Collapse
 
secure_daily profile image
Artem

there is only one language running in browser

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Ahmmm

Collapse
 
bubster profile image
TvO

god the emojis.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Ooops ... they are too much. Just wanted to make it feel more like a conversation.

Collapse
 
hadar759 profile image
Hadar Dagan

Don't worry my friend the emojis are the best part! I had a great time reading your wonderful article ❀

Thread Thread
 
atulbhattsystem32 profile image
Atul Bhatt

Thanks ❀️❀️❀️
I'm glad you enjoyed reading this one.

Collapse
 
khaledeev profile image
Khalid Mesbah • Edited

Great content mate, just asking I mean If I preferred PHP/Laravel over JavaScript means I'm being blind by love?
(I know the post about Python-JS)

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

This article is mainly focused on someone who is starting to dive into the world of Web-Dev and not someone who is already into it.

If you already doing great in one you can easily switch to other. But this article focuses on someone who really just knows the language but not the web development.

Being blind by love means: trying to do all the tasks with the one language you enjoy coding with or primarily code with
I hope you got the point. So with this you can easily understand if you are blinded by love or not.

And thanks for your time reading it. πŸ˜‰

Collapse
 
anadi9 profile image
Anadi Thakur • Edited

Very well explained i also shared it with my few friends to convince them on this topic.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Thanks 😊

 
atulbhattsystem32 profile image
Atul Bhatt

I will make things more clear in this article by making some edits. I'm extremely sorry if this is what it portrayed.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

My focus was on frontend web development in this post. Backend maybe another time.