DEV Community

Cover image for Where to Start: Python or JavaScript?

Where to Start: Python or JavaScript?

Ben Halpern on April 04, 2023

Based on popularity and demand in the current job market, two of the top languages to learn first in coding today are: Python because it’s versat...
Collapse
 
leob profile image
leob

If you're aiming to get into web development? JavaScript - is it even a contest?

If you're aiming to get into data science? Python - is it even a contest?

P.S. you're not even mentioning PHP, which I think is much bigger than Python in web dev BACKEND development :)

Collapse
 
atinypixel profile image
Aziz Kaukawala • Edited

Indeed PHP is underrated!

I learnt basic Javascript for DOM manipulation in frontend projects and later on learnt PHP as a proper backend language and till date I use it (first few years with Wordpress & now Laravel). Surely now I work with many other languages such as python (Django), Nodejs, dart (flutter).

Point is, PHP is underrated and termed as "dying" even before I started to learn it. Still after 8 years people term is as "dying" but I know that's not gonna happen any sooner!

Happy Coding

Collapse
 
leob profile image
leob

I hope people saying that PHP is "dying" start checking their facts, and they'll see nothing is further from the truth ... modern PHP is a joy to use, especially with a framework like Laravel.

You can deploy a Laravel app on AWS Lambda (I've done it, it's surprisingly easy), and it scales like crazy. And PHP 7/8 is seriously fast as well ... and still evolving and improving (types and so on).

I'm definitely a fan :)

Thread Thread
 
atinypixel profile image
Aziz Kaukawala

Absolutely! 🔥
Image description

Thread Thread
 
leob profile image
leob

I know where PHP's reputation stems from - it's based on PHP as it was 10 or 15 years ago ... things have moved on, I think it's not that hard to understand :)

Thread Thread
 
insidewhy profile image
insidewhy

PHP is still kind of annoying to use though, for example the typechecking still occurs at runtime even when you annotate the types.

Things have improved but the language designers continue to make perplexing choices.

Thread Thread
 
leob profile image
leob

Perplexing choices, which ones, apart from the type stuff? The type annotations do help a lot within an IDE like VSCode.

Thread Thread
 
insidewhy profile image
insidewhy

For example I can refer to a constant like THIS so the parser is clearly able to understand bare words in variable context, yet, despite variables being far more common, I must prefix them with $. So the code is littered with $ symbols that basically seem redundant.

Thread Thread
 
leob profile image
leob

LOL okay ... well in PHP variables simply must start with a $, it's rule #1 - the code is neither "littered" nor is it redundant - it's simply how the language is defined, nobody would even contemplate to ever change this.

I like the language, especially with a modern framework like Laravel - if you don't like it, don't use it.

I've looked briefly at Python and I didn't like its syntax (indentation and so on). Also worked a bit with Ruby (Rails) and yes, it's elegant and concise, but it tries to be too clever sometimes, it can lead to terse and hard to comprehend code. Javascript on the server is okay, but it's a nuisance that everything's asynchronous. And I've also used Java, but it's too verbose, and people who program in it insist on over-engineering everything.

What do I want to say with all this? For me, compared to the other languages that I mentioned, PHP strikes a good balance between being not too verbose, but also not too terse - it promotes writing code that's easy to read (you know, code is written once, but read dozens of times).

Thread Thread
 
insidewhy profile image
insidewhy • Edited

Um "That's just how it is, it's not littered or redundant". Not such a great counterpoint.

I like pretty much any language more than PHP, it's an ill-advised poorly designed mess, which explains why it's so commonly hated and pays much less than any other language at its popularity level.

Laravel is okay I guess, but I'd still rather listen to Lighthouse Family than use it, and I really hate Lighthouse Family.

Thread Thread
 
leob profile image
leob • Edited

I just meant to say they're not gonna change this, because it's not realistic - it would be too disruptive, it would lead to half the documentation becoming instantly outdated, and it would lead to highly inconsistent code bases (one dev wants to use $, the other doesn't) - that's why it's not gonna happen, it's just a matter of common sense.

I think that's plenty good enough as a "counterpoint".

it's an ill-advised poorly designed mess, which explains why it's so commonly hated and pays much less than any other language at its popularity level

LOL all of this is 100% subjective (and pretty extreme) - and you're telling me that I have weak arguments :-D

"Pays less", my hat ... in my world the rate that I get paid depends on entirely different factors.

For me it's just a tool that works ... like I said, if you don't want to use it, then just don't use it, simple as that.

Thread Thread
 
insidewhy profile image
insidewhy

Many of the design choices are objectively poor. The associativity of the ternary operator, the type system, ideas it inherited from perl, another language that famously died. If you compare php salaries to typescript, rust, go, python, the median/mean is much less. I don't like go either but it just shows the general animosity towards php, the same animosity overwhelmingly felt by most developers and for good reason.

All programming languages "work" so it's a pretty low bar.

Thread Thread
 
leob profile image
leob • Edited

I agree that some design choices are poor, but the language is old, and most of those choices stem from the ancient beginning years of the language. They've been modernizing the language systematically, and you can simply ignore 99% of the old cruft. Is it any different with JavaScript? Also many poor and confusing "legacy" choices there, but you can just ignore them and use "the good parts" (maybe you've heard about that book).

Well and I'm not an employee, I'm a freelancer/contractor, so "median salary" is irrelevant to me. Customer wants a site, app or platform with certain functionality, we agree on a price, then I build it - in most cases they don't care about the technology (but, Laravel is hugely popular for web projects, has been growing like weed).

I can develop an application locally in Laravel, then with one terminal command I can deploy it to AWS Lambda and it scales like crazy, without changing one single line of application code (only config variables). I know it because I've done it. Hugely powerful, can any of your supposedly superior languages do that too?

"the same animosity overwhelmingly felt by most developers and for good reason"

There we go again, a highly emotional argument which is 100% subjective ("general animosity", "overwhelmingly felt" and "for good reason"). I can't begin to tell you how comical it is, I had a good chuckle.

Can you back up your claim with statistics? Maybe most of those devs have at some point been forced to work on WordPress sites and yes, then I can imagine that they hated PHP, because WordPress sucks, it's old spaghetti garbage. Their opinion would probably be different if they'd had to work on a well-structured codebase created with Laravel or a similar framework.

Long story short, your assumptions and opinions are mostly based on ancient and outdated facts, and on a huge amount of bias.

P.S. could be me, but I also fail to see what's the purpose of these pseudo-religious battles, where people need to go around discussion forums on the internet, declaring "my language is better than yours", and denigrating another language and their users. Last time I'm saying it: you don't like it, you don't use it - other people like it so they use it, it's called "freedom of choice".

I think we should leave it at that, I've said everything I had to say, and I don't want to be repeating myself.

Have a nice day!

Collapse
 
frankfont profile image
Frank Font

Python is easier to learn and illustrates some fundamental concepts more cleanly than Javascript.

I'd suggest kids get introduced to CS concepts using Python but then when it is time for a job -- make sure you learn Javascript. That stuff is everywhere.

Collapse
 
vulcanwm profile image
Medea

I personally prefer starting with Python.
I started coding with Python, and I found it really helpful.
I learnt basic techniques like variables, loops and functions.
Now I'm learning JS, and it's been very easy to migrate.

Collapse
 
bad_request400 profile image
Bad Request 400

I would second that. In my intern years i had to start in C then C++.
Later on i teached myself a bit of java. But coding never "clicked" for me in the sense that i never wanted to code or had any fun with it.

Python was the first language i looked at (for a project back 7 or 8 years ago) that when i started to get the hang of it i had fun coding. I cannot tell you how important that moment was for my professional life.

Having fun coding and solving problems was what got me my current job which i love (not like, but love).

No matter whats choosen. When you start coding and its your first language having fun with it is the most important thing.

There are many reasons a lot smater ppl could come up with but for me its the following:

  • If you learn new things its hard, coding is hard
  • Coding cant be learned by reading but only by practicing (im partial to project based learning)

Funny enough having some ancient background knowledge i was forced to learn with C (like how a programms works fundamentally) has come handy more often than not. So take what im saying with a grain of salt.

so long

Collapse
 
andrewbaisden profile image
Andrew Baisden

I would start with learning JavaScript because the community is so big and active so finding help is incredibly easy. And its a versatile language you can build web, mobile, desktop, and machine learning apps. Both frontend and backend giving you infinite job opportunities across the techbnical stack.

Learning Python should be a must as well though if you know them both then you are not going to run out of job opportunities.

Collapse
 
satriopamungkas profile image
Muhammad Raihan Satrio Putra Pamungkas

Based on my previous experience teaching coding to several peoples from different backgrounds in a community bootcamp. I've taught both languages on different occasions.

In my opinion, using Python as a first programming language is a better approach for general people as it's much easier to understand and has a straightforward syntax. On the other hand, JavaScript is also beginner-friendly, but it has broader knowledge prerequisites.

For instance, we need to understand some basic web concepts since JavaScript is attached and executed directly in the browser. Even though we can use NodeJS to execute the code in our terminal, it can be more challenging to explain the concept related to JavaScript and web browsers to people without an additional IT background.

Collapse
 
owentechke profile image
Abraham Gumba

Exactly! I'm surprised many people are missing this fact - Javascript requires some prior knowledge. Python can start from zero.

Collapse
 
max24816 profile image
Max

The choice of which tech skills to learn depends on both your personal interests and the demand for those skills in your local job market. If you are just starting out, I would recommend starting with Python. However, as your career progresses, you may need to learn multiple tech stacks, such as React for frontend development and Django for backend development.

Collapse
 
eerk profile image
eerk

For me it would always be Javascript because it's so much easier to visualise and share your work. In python you will learn abstract concepts, but it's super unclear how you can build something other than console.log to see the results of your work.

Mini-rant:
Installing python is a nightmare beyond belief, your whole system gets littered with different versions in different install locations, unless you learn first how to create virtual environments in the terminal. Even tools like anaconda still don't fully solve this problem.

Collapse
 
ingosteinke profile image
Ingo Steinke, web developer

Might be odd to favor C-style languages with their curly braces and semicolons and everything, as a German, when those braces, colons and single quotes are surprisingly hard to type on a German keyboard! When I started long ago with BASIC, there was none of that, just 20 IF A$>1 THEN GOTO 10
We even had to type end edit the line numbers!
But have you ever tried to read and write python or any other indentation based syntax on a small screen? Personally, I'm not a great fan of Python. But I still think it's a very good, and useful, and beginner-friendly language. And there is a lot to criticize about JavaScript, even about ES2023, so, yes, I will vote that everyone starts to learn Python!

Collapse
 
bmraubo profile image
Bartosz Raubo

I don't think you're going to be disadvantaged by either choice, although if you set out learning a programming language with a general fascination with frontend work, then JS would be the obvious choice.

If you are just learning programming for the hell of it - with no real plan or direction for what you might use it for in the future - then I would pick Python, mainly due to Jupyter notebooks being such a valuable tool for experimentation and seeing the effect of your code line by line.

Collapse
 
lionelrowe profile image
lionel-rowe

Observable gives a similar interface to Jupyter but with JS, and the code runs directly in the browser, so there's zero network latency (except for things like async data fetching). Each cell also updates automatically based on its dependencies, so you get instant visual feedback across all cells.

Collapse
 
jimmymcbride profile image
Jimmy McBride

I think there's no one size fits all answer here. Check both out, see what they have to offer and choose the one YOU like, not the one that someone else tells you, you should learn. Once you learn your first language, all languages come so much easier after that.

I think making the choice based off of what you want to do will lead to sticking with coding more than making a choice based off of what someone else says is best.

Personally if I had to start from scratch and relearn everything, I know that I like frameworks like React and Vue, and building back end api's and making web apps/services, and the full stack experience. So I'd go JavaScript. But you can do all the same things Python using things like Django and Flask and especially if you like hard core web scraping, data science, machine learning and building services based off those kind of things, Python will serve you better.

Which sounds better to YOU? I know what sounds better to me.

Collapse
 
wizdomtek profile image
Christopher Glikpo ⭐

Deciding whether to start with Python or JavaScript depends on your goals and what you want to accomplish. Both Python and JavaScript are popular programming languages, and they have their strengths and weaknesses.

Python is a popular language for data science, machine learning, and artificial intelligence. It has a simple syntax and is easy to learn. Python is often used for scripting and automation, and it's widely used in scientific computing and data analysis. If your goal is to work with data or build machine learning models, Python might be the better choice.

On the other hand, JavaScript is a language used for web development. It's used for creating dynamic web pages, interactive user interfaces, and web applications. JavaScript is also used for server-side programming, mobile app development, and game development. If you're interested in web development, JavaScript might be the better choice.

In summary, if you're interested in data science, machine learning, and scientific computing, you might want to start with Python. If you're interested in web development, mobile app development, or game development, you might want to start with JavaScript. However, both languages are valuable skills to have in today's job market, so it's a good idea to learn both eventually.

Collapse
 
bybydev profile image
byby.dev

If you are interested in data analysis, scientific computing, or machine learning, Python may be the better choice. If you want to focus on web development, JavaScript is the way to go. However, both languages are useful and widely used in different industries, so learning both can be beneficial.

Collapse
 
bustersenior profile image
Buster Senior

Python
Pros:

  • It's very easy compared to other languages
  • It sets you up for doing stuff with data and backend development
  • It's can be used for almost anything Cons:
  • It's slow
  • It can be so easy it makes other languages seem hard
  • Many people hate it's use of colons

Javascript
Pros:

  • It's has many libraries and frameworks
  • It's fast
  • It's can be used for almost anything Cons:
  • It can be overwhelming learning it's frameworks
  • It's harder then Python
  • Some people disable it on there web browsers

I would suggest learning them on Free Code Camo

Collapse
 
tfantina profile image
Travis Fantina

I'd argue that the best first language is the one you enjoy. If you spend a few days in Javascript land and it's not your jam try out Python, try Ruby try PHP whatever. Learning something you enjoy is a lot easier than trying to force yourself to learn something based on what you predict the job market will want. Programming is about solving problems, the skills of debugging, problem solving, algorithms, and breaking down a complex system into manageable parts will transfer from language to language.

Collapse
 
c0mmand3rj profile image
James Batista

Both Python and JavaScript have their strengths and weaknesses, and the choice ultimately depends on what you want to do and where you want to start in your career. I'd say Javascript would be the fist thing to learn. Its everywhere and continuing to grow. Python would be my secondary choice to learn after. They are both widely used in the industry.

Collapse
 
cyblance profile image
Cyblance

the basic is javascript so go with java script.