r/learnprogramming • • Feb 08 '19

Two mistakes that trap new programmers

Most aspiring programmers get trapped and fail to move forward. As a teacher, I get to observe how some programmers keep moving forward. Here's two signs you are trapped.

Trapped coders focus on anything but coding.

Trapped programmers love to debate which language or framework is best. They spend their time figuring out what to learn and end up learning nothing at all. So let me answer all your questions.

Learn Python.

But what if I need to learn C#?
Learn C# after.

Isn't Javascript the language of the future?
Learn Javascript after.

My developer friend told me I should learn C++ because all languages are based on it.
Learn C++ after.

New programmers fear they could be wasting time learning the "wrong language". Programming is the fastest industry in history. Good developers learn new languages and frameworks on a yearly basis. Three years from now, your knowledge will be outdated. If that scares you then find a different career.

Trapped coders following directions too well.

Trapped programmers follow tutorials like mindless robots. Copying pasting code doesn’t teach you anything. Imagine starting a python tutorial that taught you how to print “hello world”.

print(“hello world”)

Most people copy/paste this and move on. If you were my student, I'd push you farther.

  1. Change the code so it prints “howdy”.

  2. Print two alerts. One that says “whats up?” and “take care”.

  3. Continue with the tutorial (usually goes to variables). After a few problems, print “hi” from mental recall.

  4. Since we probably encountered variables by now, what will the code print below? Why?

    greeting = “howdy”
    print(greeting)
    print(“greeting”)
  5. Fix the code below so it prints “hello”.

    Print(hello)

By the end of my exercises, you would have a strong idea of how print statements work. A simple line of code can create a myriad of problems. Most people brush past it only to get stuck in the future. I always recommend finding a school or mentor for guidance. If you can't do that, be proactive with your learning and keep at it.

Good luck!

1.7k Upvotes

349 comments sorted by

View all comments

68

u/desrtfx Feb 08 '19 edited Feb 08 '19

You are attacking the problem from the completely wrong end.

Instead of "LEARN PYTHON", any good teacher would have said "LEARN PROGRAMMING".

Since you are so focused on the programming language, you completely forget that the actual code is only the very last step in a long journey.

Far more important than whatever you have listed up there is:

  • Learn problem solving - solve problems in a methodical way

  • Learn to break down problems into atomic subproblems

  • Learn abstract/algorithmic thinking

  • Learn to describe solutions with algorithms - language independent

  • Learn to convert algorithms into code - no matter what programming language you learn

Nearly every programming tutorial is about "learn language x", "learn framework Y", etc, but hardly any is about "learn programming" - your elaborate from above is no exception to that rule.

Obviously, you are also teaching your students to become "copy-paste code monkeys" instead of "real programmers". It also seems that you have zero real world practical experience, along with not really much teaching experience.

I've been teaching over 15 years, and have written plenty courses (including a couple for the European Union), besides that I've been programming as a professional for over 30 years.

While your advice is not the most destructive we've had here, it is definitely neither good advice.

98

u/Suulace Feb 08 '19

When I was new to coding, advice such as "learn problem solving" or "learn algorithmic thinking" was even vaguer than "learn programming." and didn't help me. It made my "what I don't know" anxiety even worse.

Learning an actual language that I could wrap my head around from the beginning gave me those skills along the way, which I transferred to other languages later.

23

u/TheChance Feb 08 '19

The advice should be, “Programming languages are tools, not activities. Programming is the activity.”

3

u/Macrobian Feb 10 '19

"And the best tool to start with is Python"

19

u/matter213 Feb 09 '19

I'm genuinely interested in how a curriculum like yours would be set out. Although it sounds like a great concept I have never seen a university program that is structured like this because frankly it sounds very vague and I feel that many students will become lost.

When you first teach someone how to play basketball you should teach them how to dribble, and in every 101 computer science course that I know of you learn how to print "hello world" (in some language).

2

u/desrtfx Feb 11 '19

I have not forgotten you. I am currently in the stage of collecting some resources and will come back as soon as I have something presentable. Might take a week or two, though.

3

u/michael0x2a Feb 09 '19 edited Feb 09 '19

One common tactic is to structure your course so you spend the bare minimum amount of time teaching details about the programming language and instead prioritize teaching application/problem-solving instead.

For example, you wouldn't have a lesson where you just say say "here's a for loop, here's how they work". It's a reasonable starting point -- but it'd be far superior to move on as quickly as possible to the more general concept of iteration instead.

I personally like doing this by walking through lots of practice problems. For example, one category of questions I like is to use loops to print out moderately complex n x m ASCII patterns. You can weave in lots of mini-lessons while walking through those sorts of problems: how to write nested loops, how to decompose problems (e.g. start by printing out a specific line with hard-coded numbers and steadily generalize to tackle the entire grid), how to combine basic algebra with code...

And of course, have the students do plenty of practice. (Which, as a side-effect, will make them more comfortable using whatever programming language I'm using to teach the class, but whatever.)

Anyways, the insight is that it doesn't really matter which programming language you use to teach this, so long as it has a relatively simple way of doing iteration. Java, Python, C++, JavaScript, whatever... The goal is to teach about the general concept of iteration, and really any mainstream programming language will do.

Of course, depending on your teaching style and your goals, your lessons might be pretty intertwined with whatever programming language you're using, or they might end up being quite separate. For example, I personally like to intertwine the two at the intro level: I think beginners benefit from having tight feedback loops. I then gradually switch to using more diagrams, flowcharts, and pseudocode and trust that the students have mastered the language well enough to start connecting the high level ideas to code on their own.

I could see somebody with a different teaching style approaching this quite differently though: maybe they want to have students start consciously reasoning about algorithms from day 1 and so deemphasize or defer actually writing code in favor of more general problem-solving exercises.

Or alternatively, you could perhaps start by teaching one language then hard-switch in the middle of the semester/after a semester to a radically different language and leave it mostly up to the students to self-teach and catch up -- basically, you force them to figure out how to generalize what they already know. I could also see this working with certain types of students.

I have never seen a university program that is structured like this

It's quite possible that your teacher may have actually taught you in this sort of way without you noticing.

At a superficial level, it can be a little hard to distinguish between a poorly-taught class and a well-taught one -- they're both going to have a lesson about loops at some point, for example.

The main difference is ultimately rooted in factors like what end goal and learning objectives the teacher has, the level of emphasis and time that's given to different topics, the number and difficulty of exercises/homework students are made to do (and the tempo of the practice itself), the prep-work and foreshadowing you do before the lesson itself, the execution of the pedagogy itself...

For example, suppose you're teaching Java or C++. To what extent is it correct teach students about the syntax of for loops? Obviously, you need to teach the basics -- but is it worth spending the time to teach students that you can write crazy loops that look like this: for (int a = 0, b = 3000; a < 2*b; a++, b -= 3)? I think probably not -- that sort of knowledge is completely useless.

2

u/[deleted] Feb 09 '19

It's kind of funny. I did terribly in my only programming class in college, Java. We spent the entire time just learning Java and I just couldn't really grasp any of it. Years later I ended up self studying to be a programmer which only took a few months. I didn't struggle the second time around because I got a degree in math.

Writing proofs requires you to really get in touch with many of the core concepts that programming uses. Proofs don't have compilers or runtimes to tell you when you screwed up either, so you really have to understand it.

1

u/wheatless Feb 09 '19

Yea it definitely seems to vague. When you teach abstract theory and eschew practical application, students will (perhaps unsurprisingly) learn abstract theory and have no idea how to apply it. Then they'll forget the theory because they haven't had any way to use it. Even people who have been teaching for the longest time seem to forget this for some reason.

Long-term learning means connecting concepts. Connecting concepts to each other and, most importantly, connecting them to reality (where the student spends most of their life).

0

u/[deleted] Feb 08 '19

[deleted]

1

u/desrtfx Feb 11 '19

I have not forgotten you. I am currently in the stage of collecting some resources and will come back as soon as I have something presentable. Might take a week or two, though.

-3

u/tanglepuff Feb 09 '19

Agreed! Please advise the noob (me).

3

u/[deleted] Feb 09 '19 edited Feb 09 '19

I'm starting to teach myself to code, and what you're referring to has honestly been my biggest struggle. I'm able to read guides and watch videos. I can pick up the language being taught reasonably well, and I don't struggle to follow along with the guides to solve simple problems. But it seems like there's very little out there to teach me how to apply these simple concepts to complex, real-world problems that I will actually encounter. Or even practice material of gradually-increasing difficulty to make me think harder and apply the concepts better. I look at code that my company uses, and it's like a foreign language where I know some of the vocabulary, but not the grammar or the overall meaning. It's been very discouraging, and I keep hitting the end of available online guidance before I'm really able to grow my understanding.

So since you seem to be one of the few that has identified my actual problem, and have a good deal of experience to go with it... What would you recommend that I do to actually learn these real-world problem-solving skills? If it helps at all, I'm currently in an IT-lite kind of job (mostly using proprietary software, with some very limited and template-based actual coding), trying to move in to a more technical job at my company. I have some access to outside learning-center online classes paid for by my employer, if I request and justify the expense. I'm also willing to pay some out of my own pocket, if needed, but going back to school and earning an entire degree on my dime isn't an option. The languages most related to my job, and thus easiest to justify, are VBA and SQL, though I'm also open to Python or really any other language for general learning purposes. Even just a guide that teaches the problem-solving better would be a godsend.

Thanks in advance if you're able to respond.

2

u/p1-o2 Feb 09 '19 edited Feb 09 '19

There are lots of good services out there which are focused on these skills. Destroy All Software is the one I typically recommend to people. I know that's kind of a terse answer but DAS really is just a library of lessons and examples of those real-world problems you're asking for.

1

u/[deleted] Feb 09 '19

I'll check it out, thank you!

1

u/[deleted] Feb 09 '19

Math helped me to learn problem-solving skills and how to break problems down

1

u/Python4fun Feb 09 '19

I'd disagree about not being good advice. Your basis of learning programming is a great thing, but unless you are in a structured program it is odd and difficult for someone without some idea of how to use code to understand how to approach the more abstract things. This is why in a college environment you will learn the basics of what is an algorithm (make a sandwich trope) and then start into a language so that you have some understanding to build with as you move from simple to more complex problems to solve and move into data structures and complex algorithms.

1

u/AiexReddit Feb 09 '19

Yeah OPs post isnt perfect but this kind of abstract advice was the same kind of thing that made it hard to grasp CS as practical tool as a young uni student many years ago. "learn programming" as language agnostic advice sounds obvious to me now but wasnt the right way of getting us clueless youngsters on board at the beginning. setting the "python" specific part aside, id bank on OPs method producing more successful programming students in the long run.

1

u/RedRedditor84 Feb 09 '19

It's abstract advice so the real advice should inherit from this advice.

-4

u/Prime624 Feb 09 '19

Total BS. "Programming" isn't a thing as you're referring to it. Python is programming. C++ is programming. Problem solving and algorithms is not programming. They can take you from being an okay programmer to a great programmer. But if you don't know how variables work, then all that is beyond worthless.

When you learn algorithms with knowledge of programming, you can hone in on how it actually applies to coding. Otherwise it's just math.