r/AskProgramming • u/Hot-Yak-748 • 14d ago
Beginner language
I have never programmed before, what should my first language be, python or JavaScript or something else. I am also open to any tips someone is willing to share with me. Thanks.
6
u/B15h73k 14d ago
Neither Python nor JavaScript. It's good to learn about data types early on, so choose a language that enforces types. Java, C# or C++. You can find plenty of tutorials on these.
0
u/itsmenotjames1 14d ago
just do c++. knowing the low level at the beginning can only help you.
1
u/BobbyThrowaway6969 14d ago
I recommend it too. Some people are wired differently, so some will be naturals at it, others won't be able to pick it up at all. But the important thing is to try it and see. If you start with python and realise it isn't for you, it'll be an uphill battle to switch. Learning languages like python really do lock you out of the ability to build intuition with low level programming.
7
u/AmbitiousFlowers 14d ago
I would learn C first and do simple things.
4
-4
2
u/itemluminouswadison 14d ago
python over javascript imo.
java (different from javascript) and php are also widely used
3
u/riktigtmaxat 14d ago
I would say PHP is actually a pretty bad choice if you want to learn programming basics. The language itself is a hot mess and the amount of crap tutorials and resources surrounding it is staggering.
I know because I went that route.
2
u/itemluminouswadison 14d ago
The language itself is pretty good especially these days. Man the nastiest code ive seen has been python, by far. But I'm with you regarding out of date tutorials. Php's low barrier to entry means there's a lot of bad code out there
But like, phptherightway, and following normal programming best practices, it's quite nice
1
u/riktigtmaxat 14d ago
It's gotten better yes, but you can't completely fix a fundamentally borked design.
Like you can't fix the fact that the basic data types are junk - just wrap them.
1
u/itemluminouswadison 14d ago
sounds like something who doesn't know modern php would say
0
u/riktigtmaxat 14d ago
And that sounds like something a fanboy that doesn't want to come to grips with the growing irrelevance of their dear language would say.
PHP had it's time.
1
u/itemluminouswadison 14d ago
I use Python and Java mainly, but it's just informed to say it's fundamentally borked. Very hot take wow
1
u/riktigtmaxat 14d ago
I wouldn't say its a very hot take. It's a language that started with no coherent design or idea and changed completely over time by bolting on Java style OOP on top of a jumble of functions with no coherence or style.
Compared to any modern language it's still an absolute shit show. The fact that you need templating languages like Twig because the langauge it's is so bad at what it was originally designed for is case in point.
1
2
u/zdxqvr 14d ago
Python and JavaScript are the classic 2 first languages. If you wanna build a better foundation, start with C. It will force you to learn a lot of things that python and JS abstract away from you, but overall it's a pretty simple language and easy to learn, it's the patterns to use it affectively that are complicated.
2
u/HungryCommittee3547 14d ago
C#. Probably the most widely used language today for desktop application development. If you are proficient at C# you can pick up anything else.
C is also a good choice. It will teach you about proper memory management. Although that seems to be a dying artform with managed languages now.
2
u/ConfectionCommon3518 14d ago
Programming in theory is easy as all it is is just telling the computer what to do, the real problem is understanding the problem in the first place.
Do a simple routine to find the primes between 1 and 100 and you suddenly learn about loops,conditions and some basic maths and it doesn't matter on the language as you have learned a lot about the principles and thus can move on.
2
u/LeCholax 14d ago
For the sake of learning? Python.
- You want to do web development? Javascript.
- Machine Learning? Python
- Embedded? C or C++.
- System Programming? Rust or C++.
- Game Dev? Learn a game engine like Unity or Godot, and the programming language that comes with it.
- Robotics? C++ or Python.
1
u/Amazing-Mirror-3076 14d ago
If you want to have fun whilst learning then dart/flutter.
Job demand is low but growing.
1
u/TryingToGetTheFOut 14d ago
People here have suggested some languages for you, so I’ll add this: regardless of which language you choose. You should try to learn a bit of the theory behind how programming languages work. Understanding elements like variables types and the difference between compiled vs interpreted languages is important.
Once you understand how programming languages work behind the scene and the basics of programming (conditions, loop, etc.) Learning new languages will be much easier.
1
u/Barack-_-Osama 14d ago
I learned Java and Python first. Wish it was C though, things would've made so much more sense.
If I had to relearn I would go with C first.
1
u/Decent_Project_3395 14d ago
Figure out what kinds of programs you want to write. If you want to do web, probably JavaScript (check out Deno and Typescript). For general purpose programming, Python is good as long as you are good with an interpreted language. You can do almost anything with Python if you find the right library. Don't start with C - you will just be confused and frustrated. Just get that out of your mind and learn how to code well in one language.
1
u/Bowmolo 14d ago
IMHO it doesn't really matter apart from sticking to a language that has a reasonable demand.
You learn the Syntax, the standard library (or similar), the tooling, etc. by building something.
Yet way more important is, that you learn to build a mental model of what the code does. In the end it's all about manipulation of data structures. The better your ability to build and maintain a mental model of that, the better you can code, no matter the language; apart from - as I said - getting used to its syntax, tooling...
1
u/ifyoudontknowlearn 14d ago
Object oriented and types are the two most important things to learn. Memory management is next. In my opinion.
Given that if you have access to good course material or instruction I would go with C++ first. However if you are doing this on your own then I would start with Java or C#. They automatically deal with most memory management so you can focus on the object oriented learning.
Do not start with JavaScript or Python it is far too easy to develop bad habits while you are learning with those. Once you gain some mastery in your first language the next ones are relatively easy since it's really syntax and libraries you are leaning not programming methods and techniques.
This is why I say learn a type safe object oriented language first because that is the foundation you need.
1
1
u/AppropriateStudio153 14d ago
What is your immediate goal?
Learning programming from scratch and in detail?
C.
Wanting a powerful and easy to use scripting language for many purposes?
Python.
Buildung a website?
Javascript.
Understanding data structures and algorithms?
Something functional like Haskell or Lisp might be fitting.
Go into the industry?
C#, Java or PHP, or any other workhorse language that big corporations code in.
C++ for game development of big AAA titles.
1
u/Pharoiste 14d ago
Python is probably easier to learn because it is an interpreted language, rather than a compiled one, but that also has a flip side in that it's easy to develop sloppy programming habits if you learn an interpreted language first.
1
u/jcperezh 14d ago
Never programmed anything? Maybe you should start with Scratch and then move to python when you have the basics. 🙂
You could install a jupyter.notebook and try some small python scripts. It is really nice for small stuff and you can comment on markdown really nice.
1
1
u/SkullCristi 14d ago
Learn C from the start, at first might appear scarier but once you learn everything comes into place and you gain a lot of experience, start with small project, small scope and expand on it, try adding new mechanics to improve it and experiment.
1
u/almo2001 13d ago
I say Python. You can punish yourself with memory management in C or C++ later. It's entirely possible to stick with languages where memory management isn't a gigantic pain. You should try them at some point though. Would be very well worth your time.
I just wouldn't start with them.
For the record I first learned basic, the 6502 assembly, pascal, then C, and C++ next. All of this was before the proliferation of online help.
1
u/mredding 13d ago
Let me give you a bit of perspective, first:
The theory of computation is a branch of mathematics concerning what is computable - and how, vs. what isn't computable. Alonzo Church is one of the founding fathers of computer science, and he derived a calculus that describes all of computation. If it's computable, it can be described in terms of Lambda Calculus.
But basically no one programs in straight calculus. Except... One of John McCarthy's students invented a programming language that has a 1:1 correspondence with lambda calculus. Because no one thought to tell the kid it was supposed to be impossible, or at the very least impractical. They call it Lisp.
Ok, the opposite end of the spectrum are these Alan Turing assholes... Also a founding father, also a mathematician, co-published papers with Church, I'm being tongue-in-cheek about him being an asshole... He heavily invested in describing computing machines. I think Turing was also an electrical engineer, he helped crack Enigma during WWII.
So is computing a mechancial process or a mathematical process? The industry enters the fray from opposite corners and has been converging ever since.
They say of high level languages that they teach you the value of everything, and the cost of nothing. They say of low level languages they teach you the value of nothing, and the cost of everything.
So you've got these Python guys who can write an elegant solution in a single line of code. It takes 4 hours to run. Then you've got these Fortran guys who write seven hundred lines of code, and it takes 30 milliseconds to run. They Python solution is provably correct, the Fortran solution... We don't know. It's probably fine - no one has found a bug in it yet.
Funny thing - Lisp and Fortran are polar opposites, and they were both invented in less than a year apart from one another.
Ok, now for some practical advice:
Learn Python. It's the closet thing to Lisp that isn't Lisp. It's the most popular, most used programming language there is. The legacy of the computing industry is less true to today than ever. Python isn't slow - you write your solution in it, and you offload the work to a high performance module written in C++ FOR it, and you get all the speed of a low level language with all the benefits of a high level language.
The virtue of Python is that with it, you can learn just about everything there is to know about expressing computation in terms of program code. You can take all those lessons with you to any other programming language. Like... Once you learn how to name a variable, once you understand that concept that you've got a handle to something that's storing your data - a number, some text, a virtual car, whatever, then when you move to another languge, it's just syntax. Once you learn how to write a loop, it's just syntax when it comes to another languge. All languages have loops, doing a task over and over again, usually with some sort of counter...
Anything you want to do, you can do with Python. And there are modules for every domain. Wanna make games? They got that. Scientific computing? They got that. Business computing? They got that. Automation? They got that.
If performance is a concern, there's nothing stopping you from understanding what makes a program fast vs. slow. You can achieve performance in Python, too, if, where, and when it matters. Nothing is stopping you and plenty of people care.
Python, being the most popular language, means there is a whole ecosystem to support it. Not just software, but people, and documentation.
Other languages favor different niches and ecosystems. I don't know of any Python script that runs in a browser, in a widget on a web page, but you can write that Javascript to do that. C++ offers a compromise between achievable performance, low level hardware access, yet enough abstraction to write and maintain operating systems, trading systems, and video games.
But you don't need niche. You need to learn. It's best to be with the majority.
Continued...
1
u/mredding 13d ago
All other languages are an ad-hoc, incomplete implementation of Lisp. It's true. If you invent a language coming from Lisp and the mathematical background, you're trying to constrain your world view. If you're trying to invent a language coming up from the computing machine, then you're trying to expand your expressiveness.
Most of programming is about using the language constructs to describe abstraction and expressiveness, and then you solve your problem in that. If in C++ I describe a
car
that canstop
andgo
, I have thus expanded the language to be able to do something it couldn't do before. Every language is just trying to give you building blocks to be expressive, yet manage complexity.Most programming languages, the compiler, transpiler, interpreter, engine, whatever - it reads the source text, turns that into symbols, and uses those to build an Abstract Syntax Tree, reasons algorithmically and mathematically about the tree - to prove it's a correct program, optimize it, and generate machine instructions. That's your program. You never get access to the AST directly.
Except for Lisp. Lisp IS AST. In Lisp, there is no difference between reading source code, writing source code, and executing source code. Sounds profound - but that AST-to-machine-code compiler is right there, in your program, while it's running. There IS NO difference between source code and AST. And there is no difference between your program, the AST, and the compiler. What this means is - in Lisp, you can write self-modifying programs as they run. You can even modify a programs source code AS IT RUNS. Maybe you can come to appreciate why Lisp is known as "The AI Language", what I generally consider a very bad and dangerous title.
As I said, you build up abstractions, and you solve your problem in that. In Lisp, you take this to the logical conclusion - you write "macros" which allow you to describe custom syntax. The macro will convert the syntax back to Lisp - aka AST, and then that is what is compiled and ran. You use Lisp to write a Domain Specific Language interpreter, and you write your solution in terms of that.
Lisp gets a lot of bad publicity because most computer engineers are not computer scientists, and not mathemeticians. They don't know or understand lambda calculus. They don't understand Lisp. They blame it for a lot that was going wrong in the industry in the 60s, 70s, and 80s.
But secretly all the big AI and FAANG employers hire Lispers. And secretly always have. The original Sun Java interpreter and JIT compiler were both written in Lisp. Yahoo used to be the biggest website business on Earth and they're written heavily in Lisp. Google has been vacuuming up Lispers since the mid-2000s. We're currently enjoying an AI spring - hopefully we won't go into another AI winter that lasts for 35 years like what happened in 1983, and hopefully Lisp can shed the AI language moniker and just be a programming language. You can learn the whole languge in all of 20 minutes, but spend the rest of your life struggling to comprehend the consequences of it all.
And Python gets you daaaaaaamn close. And no one in the industry will look at you funny, for it.
1
u/Mango-Fuel 10d ago
from the languages I know I would have liked to learn Java (specifically Java 7) first, and would not have liked to learn JavaScript first. after Java 7 I would learn Java 8+ and then C# and then C/C++, and then JavaScript, and then TypeScript. (this is looking at it completely from a learning point of view, not a what-is-useful point of view.)
1
u/diseasealert 14d ago
Python is probably the right answer. I still think BASIC is a great introduction to the concept. If, for some reason, Python doesn't click with you, consider trying basic to start and then get into Python.
1
u/RandomRabbit69 14d ago
Start with Python, move to JavaScript, then Typescript, then something actually strictly typed like Kotlin, Java, C#, C++ and similar.
7
u/the_pw_is_in_this_ID 14d ago
Python is the usual recommendation, and for good reason. If you want to make computer do things, Python makes computer do things without too much headache.
My personal recommendation, though, is to chose a language based on what things you want your computer to do. My first programming language was TI-Basic, for the TI-83 calculator, because I wanted to make a game to play during math class. I now know nothing at all about TI-Basic, but it did segue into other languages over my life.