this post was submitted on 20 Jan 2024
9 points (90.9% liked)

Teach Programming

301 readers
1 users here now

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

How does your school/university teach it? What have been the pros and cons of that choice?
Obviously, teaching students logical and foundational concepts is the most important part, but a student's first programming language does color their internalization of the concepts and how they approach solving different problems. For example, OOP is really hard to grasp coming from a functional background. Learning how to manage memory efficiently and use appropriate data types is really hard coming from an interpreted language like Python or Javascript. What have you and your peers decided works best for you and your students?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 4 points 10 months ago* (last edited 10 months ago) (1 children)

I'm not a good comment writer so here's some text:

Not a teacher, but Python is great to discover various aspects of programming (algorithmic, flow control, I/O, OOP, metaprogramming). It's also easy to setup.

Java is just painful. The environment setup and the various frameworks available there are just way too overwhelming.

JS is actually close to Python in my opinion, and better suited for getting introduced to functional programming while still using a non-functional language. See anonymous functions/arrow functions. APIs are heavily callback-oriented which is also a great thing to get used to: You can register a bit of computation (a function) to be executed some other time, i.e. when something happens. You are not in control of the execution of that function, someone else is and will call you back. This is something important to learn (imo).

Finding the optimum algorithm is not important in the beginning (imo). When writing code there's often two pretty different activities that happen:

  1. Defining and organizing your abstractions and flow.

  2. Identify bottlenecks and search for fast enough/memory efficient solutions.

In most real world scenarios, having good program flow and abstractions will be enough. Not everyone works on real-time terabyte-sized data processing. See gamemaking: it's a very performance sensitive domain yet frameworks allow anyone to make a decent game. Why? Because for most problems, someone already wrote a library that's fast enough. You just need to wire things properly together.

Teaching something lower-level like C/C++ is great, but you need to spend time deconstructing all the goodies people got used too when dealing with other languages. i.e. Why you can't create an array with different types/structs inside anymore (not without pointers).

And then just get them to practice writing different bits of software with increasing complexity, over the year(s). The most exposure to writing code the better. Trial and error is how anything is learned, and while you might try to warn your students about common pitfalls it might only really click once they'll make the mistake. Push them in situations where they'll make mistakes.

The most important mindset to have (imo) is to constantly challenge yourself and your work: find ways to break your own stuff. Maybe you'll miss cases but the better you get at anticipating breakage, the better you'll get at writing robust software.

The second most important thing is to seek to understand every line of code you write and as many implications as possible. A program is supposed to be deterministic, there's very few surprises to be had when dealing with code (there are some though). What I mean by that is: if someone reports a bug, it can often be enough to read the code with the unexpected result in mind and work your way back to the places that allowed for this bug to occur, just by reading statically.

Lastly one thing that was motivating for me when learning programming was when our programs would run against one another. Competition fosters innovation.

I hope these pieces of opinion help with anything...

[โ€“] [email protected] 3 points 10 months ago

By "the most exposure to writing code the better" I might have meant to expose people to as many paradigms and patterns as possible and them have dealt with it. i.e. Writing a (shitty) eventloop is what really made it stick for me with async/callback-based programming.