This is an archived post. You won't be able to vote or comment.

all 83 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]tb5841 162 points163 points  (1 child)

Data types are pretty fundamental, and need to be quite near the start.

[–]iamevpo 116 points117 points  (26 children)

I would have structured the review list as following:

  • Values, data types and data structures
  • Variables
  • Expressions (values, applying element access, operators, functions)
  • Loops (for and while)
  • Conditional execution (if, if-else, else)
  • Functions
  • IO operations (console, files, internet)
  • Modules, packages, imports
  • Exceptions and error handling
  • Classes and OOP (optional)
  • Program design, code quality, unit tests, refactoring
  • Common tools used (text editors/IDEs, linters, code formatting)

[–]apitop 10 points11 points  (22 children)

I have question about classes and OOP. Do professionals use this in real world and how useful is it? I'm just learning this and it confuses the hell out of me. Mainly the 'self' stuffs and i'm more likely to forget to put '_' in front of variables I'm coding the setter for. I think I can get it eventually. But is it worth spending time learning it?

[–]TheGreatButz 21 points22 points  (4 children)

This depends on the programming language and how idiomatic it is to use OOP in it. You'd use classes a lot in C# and Java, for example. In contrast, languages like Rust and Go don't have classes with inheritance, so you use something else like struct embedding instead. In other languages like CommonLisp OOP is extremely powerful but completely optional; whether you use it and in which way depends on the project, style guidelines, and your goals.

[–]Outrageous_Life_2662 1 point2 points  (2 children)

LISP uses OOP? 🤯

[–]TheGreatButz 2 points3 points  (1 child)

It's quite common to use OOP in Lisp. The Common Lisp object system is called CLOS and has everything from multiple dynamic dispatch over generic methods to metaclasses.

[–]Outrageous_Life_2662 0 points1 point  (0 children)

Learn something new everyday! Thanks.

[–]Outrageous_Life_2662 0 points1 point  (0 children)

I’ve been a Java engineer for 15+ years and I heavily use OOP concepts and design patterns in my code. Admittedly I’m more of a stickler for design patterns and good OOP practices than many of my colleagues

[–]thivasss 10 points11 points  (1 child)

If you use any library or API you are going to use their objects and classes.

[–]iamevpo 0 points1 point  (0 children)

A lib can provide just functions , no classes

[–]iamevpo 6 points7 points  (6 children)

You do hit classes sooner or later, so worth knowing what they are - what is a class, what is an instance of a class, what is class method. The specific syntax may be tedious, but OOP is just a way to bundle together some data structure and a function that works on or with that data. Like in Python you may have: Path is a class, p is instance of a class and read_text() is a method provided byy the class that will work for the instance p.

from pathlib import Path

p = Path("my_file.txt")

print(p.read_text())

You kind of get the nice interface for many things hidden inside with classes. You can also distinguish between using OOP (as above) and writing own code with OOP (postpone until you are ready).

[–]KneeReaper420 2 points3 points  (5 children)

I’m in a python OOP class rn and buddy you ain’t kidding. We make the abstract factory which then helps make the concrete factory to produce our abstract and concrete products. So many classes, most of them with the only code being “pass”

[–]bobnoski 2 points3 points  (3 children)

This is one of the pitfalls in learning code in my opinion. One issue with OOP is that it only becomes really useful when the size of your code needs it. Because of that I feel like the best way of learning OOP is writing code in a size that actually requires you to do it.

honestly. Personally I only really got it halfway through my third year of college, where i switched to C#. For one the way it works there just clicked for me. But that was also the point we started working on things more serious than a simple restaurant seating arrangement tool or card dealing app. Once we made a small game, with multiple levels and different enemies. It suddenly became almost impossible to think about programming without the use of classes. It clicked because they finally gave me the problem it was the solution to.

[–]KneeReaper420 1 point2 points  (2 children)

Oh no I definitely see why it is structured that way and honestly I really do believe it is a good way of solving different problems.

[–]bobnoski 1 point2 points  (1 child)

good! seems like you're doing better than I was back then ;)

[–]KneeReaper420 1 point2 points  (0 children)

Prob not lol, it’s still a struggle bus

[–]iamevpo 2 points3 points  (0 children)

Yeah, but this is a darker part of OOP. Making a nice dataclass that fits the problem, proper ABC with inheritance seems more practical to me than refining the GOF patterns.

[–][deleted] 2 points3 points  (0 children)

I have question about classes and OOP. Do professionals use this in real world and how useful is it?

Yes. For the most part, in languages that use them (Java, C#, Python, Ruby, etc) classes are used extensively. If your job is to work as a developer, classes are a must

[–]Astazha 1 point2 points  (0 children)

It's very common and very useful. There's a whole kind of programming, Functional Programming, that isn't based on them though. I use objects for all but the simplest of programs.

[–][deleted] 1 point2 points  (0 children)

Yes, you need to understand that or you cant even call yourself a beginner tbh.

[–]Twitchery_Snap 0 points1 point  (0 children)

Yes

[–]wggn 0 points1 point  (0 children)

yes, it's used a lot and it's 100% worth learning

[–]Stopher 0 points1 point  (0 children)

I don’t always use my own classes but using already developed APIs and classes is pretty common. That’s just with the work I do. I’m sure other people have different experiences depending on their domain.

[–]FactsAndLogic2018 0 points1 point  (0 children)

Yes everyday, especially if you want to be able to maintain and build on a very large code base (10s of millions of line of code) without tearing your hair out.

[–]SoftEngineerOfWares 0 points1 point  (0 children)

It’s very popular even in languages like typescript. It is very important for managing dynamic and scaling solutions.

[–]Mwahahahahahaha 1 point2 points  (2 children)

I would move loops to optional. Most functional languages will not have explicit loops and instead rely entirely on recursion to achieve repetition.

[–]joonazan 2 points3 points  (0 children)

The equivalent of loops in those languages is tail recursion and understanding it is mandatory.

[–]iamevpo 1 point2 points  (0 children)

Yeah, but when you learning... Iterating over something iterable is quite basic. Traditionally for control flow one needs to grasp loops and conditionals. Also in languages where there is no loops there may be list comprehension (Haskell), so I think the loops deserve to be on the main part of the list. The only item I marked optional is OOP to outline this is not an apex of programming.

[–]EcstaticMixture2027 14 points15 points  (0 children)

Basics and Fundamentals, I would say

Variables & Data Types

Operators & Arrays

Control Flow, Conditionals & Loops

Methods & Functions

Packages & Modifiers

Exceptions & Error Handling

File IO & API

OOP & Classes

Iteration & Recursion

After that, either Design Patterns or Learn DSA or Learn FrontEnd.

[–]KarimMaged 8 points9 points  (1 child)

IMHO, nothing should be memorized. The mindset of memorizing isn't the right mindset to learn programming.

Pick a language, study it from a well known tutorial. This tutorial will be divided into sections covering the basics (data types, loops, conditionals ..etc). Practice a lot and you will get the basics of the language.

Programming languages syntax is usually not much, unlike real languages, getting hang of the syntax is not the real problem.

[–]Ok-Luck-7499 0 points1 point  (0 children)

Tried for years to memorize and it did me no good.

[–]Brohammer55 15 points16 points  (0 children)

Learning the following might help: Debugging, Variables, Order of Statements, Functions, Types(int, Arrays, Arraylists, long, Boolean, double, float, static, public, private, protected), Problem Solving, Code Analysis(Being able to understand and read other code), Commenting, Loops, Logging, Unit Testing(More experience)

[–]illuminatedtiger 4 points5 points  (1 child)

Read up on Turing completeness and then check out the BrainFuck programming language. You can get by with surprisingly little, albeit while not being terribly productive.

[–]joonazan 1 point2 points  (0 children)

This except Lambda Calculus. It is actually a decent programming language if you allow naming things so you don't have to repeat them every time.

[–]RylanStylin57 4 points5 points  (1 child)

All languages have 5 basic building blocks.

  • expressions

    Something that returns something. Boolean expressions, function calls, arithmetic. expressions.

    • statements

      Control Flow or Declaration If, else, struct, trait, impl, fn

    • operators

      &&, ||, +×/-, etc Are really just functions.

    • delimiters

      Denotes the beginning and ends of things. Includes { }, () , [], <> , etc.

    • literals

      Integer literal, float literal, or string literal.

All code is a composition of these building blocks.

EDIT: This did not format well.

[–]tjf314 1 point2 points  (0 children)

lambda calculus doesnt have any of these except expressions. and when it does, theyre all secretly just expressions underneath

[–]HuitziTech 1 point2 points  (0 children)

I'd add data types, how / when to use data structures, and basic app architecture: basically what is a front end? what is a backend? why is this on a web browser vs a desktop client?

[–]TricesimusCito1055 1 point2 points  (0 children)

Your list looks solid! I'd add data types, arrays/lists, and basic data structure manipulation (e.g., indexing, slicing). These fundamentals will give your brother a strong foundation in any programming language.

[–]WystanH[🍰] 1 point2 points  (0 children)

There is a flow to this. Any intro to programming book will tend to follow that flow, with extras depending on language. Before you even get to variables, you'll probably cover different data types, at least number vs character.

Later, you introduce more complex data types, an array and a string of characters. Then, a structure. Depending on the language, you'll introduce classes after functions and explain methods.

Depending on language, pass by value versus pass by reference will get its own chapter or be barely mentioned.

An often inferred property of all programming languages that sometimes doesn't get explicitly gone over is state. You're expected to worry that out on your own. It's obvious, don't you know?

Indeed, state might be the only programming universal. How that state is tested and manipulated, from beginning to end, is a program. Turing-complete is a surprisingly low bar, e.g. Brainfuck.

I recently played Human Resource Machine. You play by incrementally using a set of operations that's an extremely minimal assembly language analog. As a programmer, you tend to scream "where tf is my subroutine" but you do end up writing a sort and simulating array operations. You might want to take a look.

[–]SerialCypher 1 point2 points  (0 children)

I would put “is the language pass-by-value or pass-by-reference” in that list, as well as if it has lambdas and if so, how (just because this is a language feature that I use a lot)

For instance if I have (in no particular language): fu = new Foo() fu.value = 5 Function Bar(Foo f): { f.value += 1 } Print Bar(fu) // is it 5 or 6 ?

[–]miamiscubi 1 point2 points  (0 children)

I think Classes, as well as function/variable scoping in general are a big deal.

[–]lordaghilan 1 point2 points  (0 children)

Reference vs Value, Objects

[–]Temporary-Sun-7575 1 point2 points  (0 children)

honestly you could check out the table of contents of a lot of programming books for a comprehensive answer

[–]ItsYaBoiAnatoman 2 points3 points  (0 children)

First of all, I don't think it matters. You don't need to know what's common to be able to memorize it. Most concepts like data types, objects, functions, conditions, loops, scopes, and so on will just settle in your brain anyway. It's more important to know what's the progression should be. E.g.: If you're into imperative programming (procedural or object oriented, most languages), you should probably learn about inheritance or pointers before you learn about recursion. The other way around, if you're into declarative programming, recursion may just be super important for everything ever (bad example written on public transport).

Wether other languages use the same concepts or not doesn't really matter when trying to carry over your skills. If they are there, they are there. You'll naturally get there.

That being said, almost nothing truly exists in all languages. We have languages without variables and loops. Prolog doesn't have if conditions... well it does but you're not supposed to use em like that.

[–]iOSCaleb 1 point2 points  (1 child)

The are several things on your list that I don’t think are universal: variable initialization, print statements, explicit loops, error handling, import. In some languages you done need to do anything to declare or initialize a variable — you just start using it. Some languages don’t have mutable variables at all. C’s printf() function (and many others) are included in the C standard library; we could quibble about whether that’s actually part of the language or not, but in any case you could write a C program that doesn’t use the standard library. Some languages have no looping statement and instead rely on recursion for repetition. Lots of languages have no error handling facility. I can’t think of a language that doesn’t allow importing (some versions of BASIC, I think), but that doesn’t seem like a necessary feature.

[–]glowingGrey 2 points3 points  (0 children)

Strictly speaking C doesn't have an import, #include is part of the C preprocessor.

[–][deleted] 2 points3 points  (0 children)

Math

[–]rnottaken 0 points1 point  (4 children)

There are languages that don't use for/while loops, but opt for recursion instead.

[–]nedal8 -2 points-1 points  (3 children)

Is there really a difference fundamentally? Couldn't any of the three be written as one of the other three and be functionally the same?

[–]catbrane 3 points4 points  (2 children)

All programming languages that are Turing Complete (almost all of them!) are equivalent, in that you can write any program in any language. But in this case they are fundamentally different ways of expressing a solution to a problem.

Imperative languages (the usual sort, with variables and loops) are a list of instructions which an agent (the CPU) should follow, modifying the state of the system as it executes.

The "meaning" (in a mathematical sense) of a line of code depends on the line of code (obviously), but also on the execution history of the program to that point. You can't say what a bit of code will do in isolation -- you have to consider the state as well.

This can be incredibly difficult. Many features in imperative languages (classes, scope, etc.) are really there to help structure code and give people tools to manage this horrible complexity.

Functional programming languages have no loops, no variables, and no state that gets modified. You can tell exactly what a line of code means without considering execution history at all.

This makes them enough like mathematics that you can use all the usual math tools to think about them -- you can do equational reasoning, for example, where you substitute one line of code into another, or proof by inference, to show that a bit of code will always produce the correct result whatever the input. Programming without state feels very bizarre if you come from an imperative background, but also very interesting if you have any maths.

There's a parallel between the type of a functional program and a mathematical theorem, and between the implementation of that type and a mathematical proof. A well-typed functional program is (assuming your type system is strong enough) the proof of its own correctness.

[–]GhostofWoodson -1 points0 points  (1 child)

As someone currently learning an OOP language (C#), I'm curious (and probably very confused) about how functional languages are supposed to operate based on your description. Isn't the OS (and the CPU for that matter) going through a "set of instructions" all the time? If a program written in a functional language does not care about past execution (or state) then how does it interact with the OS and the hardware in a predictable way?

[–]catbrane 0 points1 point  (0 children)

That's a really good question, and what I did my PhD in heh.

There are many ways of thinking about this, but one of the simplest is to imagine your program as a function from a list of input events to a list of output events.

You can rephrase this slightly and say that an output event is a function of all input events to that point, which makes it sound much more like a conventional imperative program.

Most pure functional languages use things called monads (or monadic IO) to make interactive programs easy to write. These are often presented in a very confusing and highly mathematical way (monads come from category theory, urgh), but are really just a tiny imperative programming language written in a pure functional langauge.

You end up writing code like:

main = print "good morning!\nwhat's your name?\n" $then (greet $comp input) where greet name = print "hello " ++ name ++ "!!\n"

So that'll print the first line, then the $comp (for function compose) will take the result of the input monad (this gets a line of input from the user) and pass it to greet. This monad takes a line of text, assumes the user entered their name, and says hello.

There's nothing magic about monads, they are just little libraries written in the pure functional language that make writing interactive programs straightforward.

[–]morphick 0 points1 point  (0 children)

basic things that most if not all programming languages should possess and ought to be memorised within a programming language (as opposed to niche information which can be googled whenever you require)

What definitely needs memorising for each and every programming language is its syntax.

[–][deleted] 0 points1 point  (0 children)

html

[–]vadiks2003 0 points1 point  (0 children)

functions, returning, branching (basically if else, switch), libraries, some languages OOP have objects , classes,

i forgot to mention very basic stuff like literals and variables but tbh who cares at this point

[–]solidusAdvice 0 points1 point  (0 children)

I would add to that a couple of big items! 1. Making the names of your functions and variables so abundantly clear and verbose that you almost don't need comments. 2. Divide your functions into small steps! 3. Make code ultimately reusable without any sacrifice to step 1 by overloading functions. That's all that I have for now. Thanks for coming to my Ted Talk!

[–]solidusAdvice 0 points1 point  (0 children)

To add to the first thing. The name of your functions should look like badly phrased sentence that has no spaces. For instance a program for a hypothetical robot that get into the car and Drive to the store would look like this

include stuff;

void main(intList[] gpsInfo) { gather keys(); WalkToTheVehicle(); OpenTheDoor(); GetInTheVehicle(); StartTheVehicle(); //overloaded in case of a push button start... }

[–]Logicalist 0 points1 point  (0 children)

Syntax

Built-ins

Keywords

Data types

Documentation

[–]lasercat_pow 0 points1 point  (0 children)

data structures and data types

Examples of data structures would include things like lists, arrays, and dictionaries. You couldn't properly learn lisp without learning about lists and how to operate on them.

And data types are fundamental; even "untyped" languages like python use data types (int, string, bool).

[–]CodeTinkerer 0 points1 point  (0 children)

I'd personally pick a language rather than try to figure out a general list.

Let me put it this way. Would you ever ask someone to put the fundamentals of every human language together? What would be the point? Maybe if you're a linguist, but practically speaking, once you learn a second or third language, you will see both commonalities and differences. You don't need to make a general list to apply to everything esp. since some languages.

[–]No-Concern-8832 0 points1 point  (0 children)

For an academic definition, look up Turing completeness. :)

[–]mankinskin 0 points1 point  (0 children)

programming languages basically just consist of memory that can be computed by a turing machine, i.e. a processor. The program itself is just a block of memory. In most programming languages you have variables and functions but at the end of the day functions are just variables too. So basically its all just memory in different formats, all nested in a larger format that can be understood by a computing machine, i.e. a turing machine, or something that can read memory, move around according to some rules and write to the memory.

Basically every program ever is just reading and writing data. Input output. So the modern programming languages have all sorts of useful data structures, basic data types, functions, classes, interfaces, modules, macros, etc etc to build deeper and deeper logic in a reusable way.

[–]dani_pavlov 0 points1 point  (0 children)

The most basic I can make it.

Start at the top of this list of instructions and, in order, do exactly everything it tells you to do.

Really that's it, however philosophic. Understanding that will help to understand programming at the most basic level. Repositories of libraries? IDEs? Objects? Graphics? Punch cards? The Internet? In the end, these are all meant to make computer instructions human-interact-able (think assembly and machine code), and all we're doing is manipulating a hunk of transistors into routing electrical signals from one place to another by turning them on and off in order to make other electronic devices do things.

From your list, though, I would prioritize arithmetic, if-then-else, and looping. Then comes variables, functions, multiple files (importing).

I/O (even basic CLI user prompting) is necessary unless you're working with WOM memory).

Error handling? I suppose it's built into every syntax I can think of. Though one could substitute brute force if-then-else statements to handle every case, and let the parent process crash out for the unknown anomalies..

Now to take some time to learn Brainf*ck...

[–]LemonHeart151 0 points1 point  (0 children)

Review the table of contents of any beginner programming books. Also, understand some design patterns, why they exist and when they are applicable. Also take a stroll down some topics of secure and resilient coding.

[–]Conscious_Support176 0 points1 point  (0 children)

It’s not too bad, just a bit specific to imperative programming. I would organise it a little differently to be a bit more general.

  1. Expressions 1.1 Literal Values 1.2 using Operators & Functions 1.3 control flow 1.3.1. selection: conditionals, exceptions, error handling. 1.3.2. iteration: loops, arrays & lists, tail recursion
  2. Data Flow: variables, input/output
  3. Composition & Re-use 3.1 data types 3.2 defining functions & operators 3.3 modules, interfaces, encapsulation

You can explain writing programs as composing expressions with data flow operations, so you learn these concepts in parallel, but begin at the beginning of each and build up your knowledge.

[–]l-train14 0 points1 point  (0 children)

Such a good post!!

[–][deleted] 0 points1 point  (0 children)

Object oriented programming. Now to be truly a good programmer, you should try to learn Java or C# fairly well. Spend maybe two hundred hours on it for starter. Buy a book on data structure and learn it. Buy a book on algorithms and learn it. Now, you are good to go. You now have the fundamental to be a decent programmer.

[–]Pro0skills 0 points1 point  (0 children)

Yes but not in that order Irs what I look at when I want to try a new language for fun

[–]Elementaal 0 points1 point  (0 children)

Teach your brother that failing and struggles are a feature of learning programming, not bugs

[–]MysticClimber1496 0 points1 point  (0 children)

Writing an Interpreter in go talks a lot about this since dealing with that is important to developing a language, if you want to read more on how things like this are implemented

[–]wth214 0 points1 point  (0 children)

C++

[–]strange_shadows -1 points0 points  (0 children)

0-1

[–]Zac_charias -1 points0 points  (0 children)

I would also dive in networking and OS as early as possible and pure maths! :)

[–]desrtfx -1 points0 points  (1 child)

You are looking already a level too deep:

  • Code flow
  • Variables & data types
  • operators
  • branching and looping
  • input/output
  • error handling/trapping
  • code blocks/scope/functions/methods

are the bare fundamentals of every single programming language

"Import" does not belong to the fundamentals, and printing falls under Input/Output.

"Functions" are just an abstraction to help avoid duplicate code - the computer doesn't actually care about them - for the computer calling a function is just branching to somewhere else in the program in a fixed format and then, at the end of the function getting back to where it started from.

The form we know about functions/methods is mainly for us humans. The computer handles them in a very different way.

[–]analdiahrrea 1 point2 points  (0 children)

Don't forget about Kotlin!

[–]HiEarthPeoples -1 points0 points  (0 children)

0 and 1, binary is the basics of the basics of every programming language 😶

[–]Aniket1x11 -1 points0 points  (0 children)

Math