r/AskProgrammers • u/GlitteringResort4937 • 23h ago
C++or JavaScript?
Heyy all, I've recently started learning programming and I've already covered the basics and I think I'm now ready to start learning my first language properly. I have a very little tiny background on C and python because I took some courses a while ago but ended up not finishing them.
I ha've asked some people for advise, some said you should start with C++ to have a good foundation and it makes it easier later to learn new languages, while others said you should start with JavaScript because its faster and easier to learn. And I'm completely lost now.
Also, I'm starting my high school senior year in September so I'll need to balance school with learning to code so I can't 100% focus on coding. And I'm also still lost in what field I want to get into but Ai and web development seem pretty interesting to me. I don't want to start with something and ending up not finishing and regretting it like what I did a while ago.
So my question is what would you do in my situation?
Thanksss!!
2
u/GlassboundIllusion 21h ago edited 21h ago
And I'm also still lost in what field I want to get into but Ai and web development seem pretty interesting to me.
If you're looking to get into web development then Java or C# (if you're going the Microsoft route) will be more relevant than C++.
C and C++ are excellent tools for when high performance is a high priority, and you're creating lower level software for something that is either highly technical and/or an embedded system on a device with limited resources. In the world of web development, however, it's not used particularly often.
As for the choice between JavaScript and a heavier weight language like Java or C#, I think that would come down to whether you are more interested in front end development or back end development.
If you want to work in front end development, start with Javascript and, as another commenter already mentioned, move into using Typescript. Many modern front end frameworks use Javascript and Typescript as the basis - Node.js, React, Angular, etc.
If you want to work in back end development, then focusing on Java or C#. You'll also want to add in some experience working with some kind of database at some point along the way.
So my question is what would you do in my situation?
One of the most valuable things you can do for yourself is to complete projects. This gives you something tangible you can show to prove you not only have technical know-how, but the discipline necessary to actually finish. It also gives you a big boost of motivation.
As I'm sure you already know based on how your post starts, it feels demotivating to leave something unfinished.
One of the key elements of doing this is to start small, and increase your scope incrementally. Don't immediately jump into trying to build a fully functional web store. If you haven't yet made a hello world program, do that. Boom, one program complete. Next, you can ask the user for their name and have it print out "Hello <username>" Boom, two programs complete.
These initial projects won't be good enough to show off in your portfolio, but they serve as a good stepping stone towards projects that will be, and provides you with something tangible as a marker of progress made. Set aside the program somewhere in a "completed" projects directory and then move on to something slightly more complicated. Keep doing this until eventually you have your first project worthy of actually showing off in a portfolio.
Whenever you feel lost, you can refer back to your directory of completed projects and run a few of them to remind yourself of what you've completed so far. There is SO much to learn that it can be extremely easy to feel overwhelmed and like you haven't accomplished anything if all you're doing is tinkering without concrete goals that have a definite "complete" state. Continually completing programs of increasing complexity serves to give you a trail of metaphorical breadcrumbs so you don't get lost in the forest of learning.
2
u/aztracker1 20h ago
FWIW, modern C# works pretty great outside windows too... I prefer it over Java myself. That said, would probably start with JS for web ahead of C#/Java.
1
1
u/Capital_Brother_9304 23h ago
I think start with JavaScript. You will get used to programming and have an grasp of understanding language and logic. Then, I thinkt would be easy to learn any language. I guess.
2
1
u/One-Next 23h ago
From the get go, js requires you to understand concurrency. C++ requires you to understand the memory model. I'd say both and imo going from c++ to js is harder (you need more syntax) so c++ first I guess.
1
u/Zealousideal-Fox6463 23h ago
It really depends on what are you trying to do, both have pretty different use cases
1
u/newyorkerTechie 22h ago
I started on C++ in the 1990s. I’m doing typescript half the time these days.
1
u/Lopez_Muelbs 20h ago
You could try both by spending a month or a week onto one langiage and then move to the other to get a firm underdtanding of how does it feel to use the two languages.
C++ and JavaScript are used differently in programming so if your into web development or any full-stack applications then JavaScript is your best options. If its game development or embedded systems then C++
1
u/DarthRaab 19h ago edited 19h ago
Me personally would start with python, it's easy to learn and used in AI. It depends on your long-term goals. A big part of the knowledge you learn applies to all languages, so don't worry about sunken cost too much.
Low level language let's you play around with hardware directly, high level language let's you play with abstract concepts.
Near Hardware (Low) ---> Near User (High):
C --> C++ --> ................... --> C#
... --> Java --> Javascript --> Typescript
... --> ........ --> ................. --> .................. --> Python
There are over 100 other languages, all for specific usage or personal preference. Most run on a bedrock of C code. There are many older languages than C but it's the best of them that stuck around.
1
u/Substantial_Job_2068 19h ago
C/C++ has a steeper learning curve and will force you to learn programming fundamentals. JavaScript is easier to get started with. So it depends what your goal is. If you want to understand what's going on under the hood, go with C.
1
1
u/letmehaveanameyoudum 16h ago
you want make website javascript
you want make real apps or .NET or possibly go low level and make an OS? C++ (c is better)
1
u/low-control-labs 16h ago
C++ focus on building what you want and learn from it. That's what you'll be doing with both languages. C++ is used everywhere. JS / TS is for the web
1
1
1
3
u/aztracker1 20h ago
It really depends... If you really just want to start making things, especially anything you access in a web browser, you pretty much have to know at least some JavaScript.
It's not the easiest language to learn or start with though... That said, you will see results faster and that can help you stay motivated.
Going with C/C++ has the advantage of being the under pinning of so much of software in general. Most programming jobs don't touch it, they'll be in higher level languages for business use.
But it is good for technical understanding, especially if you're close to the hardware itself or want to play with embedding at all.
Python is probably one of the better learning languages and is very useful and widely used in education and scientific circles.
Rust, is my own preference over C/C++ but helps to understand C first.
C#/Java have lots of jobs out there for business work... But I wouldn't start with them... My day jobs have been about half C# for a couple decades.
As to more functional or esoteric languages... Leave them for later should you get curious or really interested in a lot of technical options.