To learn CS, would it be best to pickup concepts with Java, Python, C, or C++?
Posted by TurtleSlowRabbitFast@reddit | learnprogramming | View on Reddit | 25 comments
Want to self-teach myself CS so that I can learn software engineering on a deep level.
Avro_Wilde@reddit
It doesn't matter since the idea are language agnostic. If you have a comfort level with one language over the others, use it. You'll be struggling enough to figure out the CS stuff without fighting the language.
Lost_Frosting7106@reddit
I'd start with python it's the most natural and less verbose
if you want to become a web developer then definitely learn javascript
curglaff@reddit
Yes, and also throw in a Lisp or two, some Haskell/OCaml/F#, and at least one Assembly language.
(I make no apologies for my deliberate misreading of “or” as inclusive or.)
PandorasBucket@reddit
All I ask, so that you don't come out being the same brainwashed drone everyone else does until 10 years into their career and it's too late: When they start teaching you that the proper way to write code is to break it up into objects and those objects represent things like a car just realize that there is an arguably better way to do it called functional programming. If I had known that from the beginning I wouldn't have hated programming so much because I would know that what I actually hate is the though pattern of OOP, which is messy and ugly.
Now most of the software in the world is written in OOP pattern because that is what they teach in school. Most programmers don't know anything else and it's a shame. I think the fact that the industry was sold OOP is one of the biggest tragedies in the modern world on scale that is unfathomable.
The problem started back in 1967 with Ole-Johan Dahl and Kristen Nygaard created Simula 67. Then Alan Kay in 1970.
Sumula 67 was used to define digital objects and in the real world physical things share a lot of properties. This is where this kind of coding can make sense. This is why you start out learning about 'cars' even though your chances of ever making a car object in your programming life are next to none. The reason is very simple. The VAST majority of coding that exists in the world in not a mirror of any physical objects. Our code represents completely abstract things and almost all of them are extraordinarily unique. So for 50 years developers have been trying to figure out how to make 'cars' in their code so that they can make a 'lamborghini class that inherits from the 'car' class.
The problem is they are not working with cars or lamborghinis they are working with applications that do accounting or manage a network connection. They will create parent classes that get inherited into child classes and then realize they overwrite something from the base class in almost every child class to the point where you start wondering why you have the base class at all. Oh it's because there are still 2 functions in there that some children use and a few that some other children use. You get everything in every child whether you use it or not. You just have to keep track in your head of what your classes look like when stacked on top of each other. What cancels out what. What might interfere with something in your current class. Now imagine that stack in 5 levels deep and all of that is in every object you make. Just ignore it don't worry. Just turn your brain off and embrace chaos. That is the inheritance model.
Now lets get on to the even worse thing. Hidden state. You see Alan Kay was a biologist and he thought it would be cool if software acted like the cells in his petri dish. He figured that if it works for nature, why not software? He though, hey what if we slice up our software so that it acts like a colony of cells all communicating with each other unaware of the big picture. Put them all together and they will arrive at a conclusion. Done. There is a small problem. They will arrive at A conclusion, just not any particular conclusion. As long as you don't need a correct answer or there is no correct answer this is fine. Cells are chaos. Cells exist to be robust so an organism can lose them and the organism can continue to function. The quality of that function can be anywhere from a sick orphan to a marathon runner. This is not what we use software for. For most of what we use software for there is an EXACT CORRECT answer. For instance when you want to keep an airplane, say a 737 Max, in the sky you don't let the engine sensors each act like a cell that hopefully work together. What you actually need is a machine, an army that is managed and coordinated exactly like a fine tuned machine. There is no room for the main thread of an application, the brain to not know EXACTLY what is happening everywhere. When you're controlling an airplane. There is one mind, one set of actions that affects everyone on the airplane. The main brain needs to be able to audit and control absolutely everything that is happening to the smallest detail. When you create these 'cells' with their own persistent state data they are no longer part of the main organism. They're looking out for themselves. You can hey speed up 10mph and the first time you call it maybe it speeds up 10mph, but then you ask it the same thing 20 minutes later and it speeds up 15mph. Why? Because it's a cell man, it's living it's own life, it has it's own data and that's none of your business. So the plane crashes and no one blames OOP, because how could the thing my college teacher, who never had a job writing software, be wrong?
So when they start teaching you about private variables and initiating objects that act like these independent cells that float around invisibly and you get this weird feeling that it seems completely arbitrary to what you actually want to accomplish just realize it's because a biologist thought it would be neat. It's more like if you decided to dress up like a 17th century aristocrat every day and you spend 2 hours getting dressed up every morning. Maybe because your family was big into the Renaissance faire. One day someone asks you. "Why do you dress like that every day?". And you say "Well I have to wear clothes. What else would I wear?" and they say "You could wear LITERALLY anything else." OOP should not be 'the' way people code. It should not even be considered 'correct' in most situations. It should be considered a whimsical style not really appropriate for most cases. You're doing way to much for style, you take way longer than needed to get ready in the morning and your cod piece is making it hard to walk.
So what is the alternative? Well I bet if you were to just design a way to reuse code on your own, with your own intuition you would just come up with the alternative because the alternative IS the natural way to do it. It is the jeans and a t-shirt. It is exactly what you need and nothing you don't. Functional programming is where your main thread, your application brain, the 'self', does something it actually has complete control over the entire application. When it asks it's arm to go up, the arm goes up. The arm does exactly the same thing every time, or it tries to at least. The arm has no opinion, stored memory, baggage, left over from any previous evocation. That's kind of a bad analogy because an arm does have a kind of stored state, but think about how jarring it would be if your arm didn't go up when you wanted. You could not trust it anymore. That is how most of our software today is programmed. Ironically the actual better way to keep the state of that arm in software is still not grouped with a bunch of arm code in an OOP object. The best place for the state of that arm is with other arm data from all the other arms. OOP ignores 40 years of relational database development. Even in temporary memory all the same rules apply. OOP says "let's just put all this data which could be extremely important all over the place in boxes that blink in and out of existence." This is all because the digital world is absolutely nothing like the physical world and thinking of it that way was a very naive and whimsical stab in the dark.
Why does it perpetuate? There is a lot of job security making something harder than it needs to be. It's harder to learn, you need to write more code, it takes more time to write code because you have to translate into this arbitrary and unnatural format... It keeps people out of business. A lot of people will just give up on programming because they think it doesn't make sense. That's great for job security as well. You can't leave out all the teachers in the world who never learned any other way and never bothered to question anything. When all you ever write is code long enough to complete a homework assignment you will never be exposed to the nightmare of an actual corporate OOP codebase. When you have hundreds of thousands of lines of code and you're editing an object and spending half an hour trying to figure out even what is inside, when debugging the state of any of your objects could be different at any time depending on when they are called you realize the nightmare the world is in. Don't get me wrong. It's great for a lot of people, people who like busy work, job security, and don't care about the intention of any of it. This is also why most programmers you meet today are concerned with procedure rather than product. It's all about routine and ritual for them. They never needed it to make sense. "The ford is the car, the car is the auto". They just do it. You could have told them code needs to be written in the form of a rap battle and they would be doing that.
So go off now, learn your OOP to start, because that's how they all start, but when your intuition tells you something is wrong, trust yourself. It may seem crazy that an entire industry is broken, but in this case it is. That could make you feel a lot more confident in yourself and we need good programmers, not priests doing absurd rituals.
Cautious-Bet-9707@reddit
I think there is much truth to what you said, but if your intention is a robust program OOP done well will always be safer and for cooperate applications where mistakes are costly and or dangerous, the ability to disallow unwanted behavior is very beneficial, but as a rule always no it’s very unnecessary and often times prolongs implementation and makes things overly complex and mistake prone, but if mistakes matter and your devs are competent OOP is the way to go, so students are and should practice in ways that employers expect, even if it is relatively stupid for small scale projects, but yeah to your point it also slows down development and the fact that it’s used as a rule rather than a design decision unlike most of software engineering does seem to be flawed.
Vast-Argument6206@reddit
Let me give you an actual answer. Yes like people have been telling you, it’s important you learn actual concepts and not just languages. If you prefer to challenge yourself first to make every other language easy to learn and understand, learn Java, C++, or C(the lowest level probably best way to learn). Learning any of these languages will force you to learn important concepts and actually understand what your code is doing, given you start with just basic libraries. Add libraries only if you understand what each function does in the libraries. It’ll be very easy to pick up any other language with this method, and give you a strong foundation. If you just start coding from python, with no education, there might be some mental gaps on how the code actually works which isnt what you are looking for.
Great_Garlic1215@reddit
Not much but if you learn some basics of any programming you can easily learn cs
More_Ferret5914@reddit
You’re asking the wrong question. Language doesn’t give you “deep CS,” concepts do.
Pick something simple and get moving. Python is fine to start because it won’t slow you down. If you want to understand how things work under the hood later, move to C.
Java and C++ are fine, just heavier. You’ll spend more time fighting syntax than learning ideas in the beginning.
What actually matters:
Language is just a tool. Don’t get stuck choosing tools instead of learning.
DataPastor@reddit
Nice idea, but you are talking about a 4-5 years long university level curriculum. It is like educating yourself to a dentist. In this curriculum you should learn both low- and high level languages; procedural, object-oriented and functional programming; system design; design patterns; data structures and algorithms etc. etc. And much much more.
Bottom line: probably Java is the best language to provide you solid foundations.
Astronaut6735@reddit
I'll add that 4-5 years gets you to entry level or many CS positions. My first job out of university was working on scheduling software in Common Lisp. Understanding the technology and writing in CL were the easiest parts of the job! Understanding the problem domain, solving complex scheduling problems, communicating designs, supporting the customer, and navigating all the politics that come with a big project were things that my degree just barely prepared me for.
MagicMagnada@reddit
Java —> Overview Organisation
c++ -> tecnical Performance
Rest =bs
Beregolas@reddit
Doesn't matter at all. Nearly all concepts are present in many languages.
There are a few details that only low level languages really force you to learn, like pointers. There are also some concepts that are theoretical, so you don't really learn that with a language. Some meta concepts like heap, stack and stuff like that.
and lastly, of course, Computer Science is not programming. It's much more, for example computability, algorithms and data structures, correctness and a lot of other things you will never learn by programming; some practical, some theoretical.
Cautious-Bet-9707@reddit
VibrantGypsyDildo@reddit
To learn concepts you can pick any with various degree of immersion.
If you pick any two, you can build the whole career.
Civil_Set6074@reddit
JoeyJoeJoeJrShab@reddit
While plenty of people with Computer Science degrees end up working in the same jobs as those who studied Software Engineering, these are two very different fields of study. Perhaps your first step should be deciding what your end goal is, and then choosing a learning path that will lead you in that direction.
aqua_regis@reddit
Languages do not matter as much as people tend to think. Concepts are what really counts.
Doesn't matter if you use Python, Java, C, C++ - a variable is and stays a variable. A loop is a loop, a conditional is a conditional.
You can even learn CS concepts and fundamentals with something like Scratch, which Harvard's CS50 (which is more than highly recommendable) uses before switching to textual languages, like C.
Yet, you seem to mangle CS with programming. CS is not programming. CS is the science, the theory behind programming and as such generally language agnostic.
CS only uses languages to deepen understanding and to illustrate concepts. Yet, actual programming is only a fraction of CS.
YetMoreSpaceDust@reddit
That's true, but C (and C++ by extension) also have the concept of pointers that exist, but are hidden, in Java and Python. OTOH, you really can't to proper FP in C like you can in Python.
There's not much point in learning Java unless you actually want to get a job, though.
griz17@reddit
For actual computer science (abstract concepts) use higher level language (eg. Python). For how conputers actually work check assembler/C.
peterlinddk@reddit
You want to teach yourself computer science, so that you can learn software engineering? That makes very little sense.
Software engineering is about building software, about analyzing requirements, setting up teams, distributing workload, utilizing existing systems, and use (more or less) scientific ways of improving the process itself.
Computer science is about understanding "computing" - not computers, the physical machines we use to write and run software, but the act of computing, how it was done by humans, and how to effectively do it with machines. Like proving that an algorithm will finish in this many iterations depending on the size of the input, and so on.
And you are asking about programming languages - which have absolutely no effect on either one. CS is mostly about maths, SE is mostly about processes and tools.
So ... It is a bit difficult to understand what kind of answer you are looking for.
wayofaway@reddit
nand2tetris
It's a pretty easy start to how it all works. The programming part will take a lot of effort if you don't already know a programming language, but you could learn some basic python or something and give it a try (or just don't do the software projects until later).
binarycow@reddit
If you truly want to learn things on a deep level - all of them. They all contribute useful knowledge, different ways of doing things, etc.
Add to your list C# and F#.
KC918273645@reddit
If you want to understand computers, which is the indea behind CS, then it makes a lot of sense to start from the low level languages such as Assembler or C. Both which would be very useful for you to get familiar with.
esaule@reddit
doesn't really matter.
What matters is something that keeps you engaged so that you actually learn rather than feel burned out by the task.
OldWalnut@reddit
Depends on your goals? Web dev, JavaScript. Automation, Python, etc. write out your goals and search for example projects you are interested, see what they were written with and then learn that!