r/AskProgrammers 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!!

3 Upvotes

21 comments sorted by

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.

2

u/Boring_Dish_7306 9h ago

I had a mentor that pushed me to learn C++ at the beginning. I did, but i really was thinking that i am wasting time, and i cant build anything with it.

Now, few years later (web dev) i am so grateful that i started with that, and gave me so much advantage with other languages.

Learning C++ will benefit you in the future, but it will be slower. With JS you will see faster results, but will need to spend more time with the basics.

1

u/aztracker1 8h ago

Yeah, I actually learned JS first (in the mid-late 90s)... Read a few books on C, then jumped into php then vbscript (classic asp) then asp.net (c#), much more advanced JS and a few other languages while mostly working with JS/TS and C# in the day jobs.

I've spent 10-15 hours a week for decades learning and trying new things. It never stops and there's always twice as much to learn in software.

But yeah, some grounded understanding of c/c++ does help a lot. Even if it's not what you use regularly.

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

u/JerryRed100s 20h ago

Fuck Java. c# bitches!

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

u/PartBanyanTree 23h ago

I basically agree except id suggest getting typescript in the mix asap

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/thaache 22h ago

Get through with C.

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

u/georgejo314159 17h ago

Javascript because you could implement something real easier

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

u/Simple_Listen1670 15h ago

C++ , even the question shows that you are really newbie on this stuff

1

u/proteinpackedpancake 12h ago

Both ultimately

1

u/mega-stepler 11h ago

c and c++ will give you better and deeper understanding of programming