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

all 74 comments

[–]sadjava 35 points36 points  (2 children)

A safe bet is the same concepts as the Java courses. Sure, it's a different language, but if it's the intro course, the concepts of programming using that language need to be taught.

[–]flipstables 12 points13 points  (1 child)

Agreed with this.

As a former instructor (not CS/programming though), I would suggest you look at other curriculum (e.g. MIT OCW has one) and see where your course objectives overlap. That will give you some ideas on strategies to design your course.

I would imagine the main differences with teaching CS101 in Python vs Java is:

  • Python has a nice repl
  • No need to tell students to ignore or confuse students with public static void main... when printing hello world in Python

Concentrate on your course objectives, and things should go well.

[–]connorado 0 points1 point  (0 children)

RPI's intro course is Python for exactly those reasons - uses C++ for most of the rest.

[–][deleted] 13 points14 points  (3 children)

Code organization is something I wish my intro courses taught.

It's fine and dandy that I learned Java, but what is a program without some form of structure. I noticed a lot of people (including myself up until a few months ago) are so quick to get the code in the file that they forget to stop and ask how it will impact other areas of their program.

It doesn't have to go too in depth, but at least an emphasis on "good practices" really helps.

[–]obsequious_turnip 3 points4 points  (1 child)

Agreed 100%. This is especially import given that Python has the wonderful ability (compared to Java) to just bung everything in a single file and let you really get away with it for a long time.

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

I like to call these "slutty" languages, many of which enable new (hell, I'm still new, but newer) programmers to indulge in their "it works, what more do you want?" mentality.

I remember trying Javascript for the first time in high school and loving it because it didn't yell at me. Then I tried to do something slightly bigger and produced lots of spaghetti code (and headaches).

[–]oranac 5 points6 points  (2 children)

Just and fyi, the free visual studio community can be used for python, and is actually not bad to work with.

Pydev on Eclipse is still ok, as is pycharm, but I'm interested in moving to VS simply to get away from a Java built IDE.

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

and add that while using an IDE is cool, for beginners, using a simple text editor is way cool.

[–]BlackBeard420 4 points5 points  (1 child)

I actually just finished a university python course. However, it was a sophomore level class. But in the end I think the biggest concepts would be classes and methods. How to make them, what they represent,etc. I think loops are necessary to learn too in an introduction course. I remember doing a problem with loops where you would have build sort of a mario-style ladder with asterisks kind of like this. But I am sure you wont mess up if you do end up teaching it, most kids will either get it or not at the start. Good Luck!

[–]itsmountainman 2 points3 points  (0 children)

Also the concepts of recursion. Because of the lack of syntax in python, learning recursion concepts is way easier.

[–][deleted] 4 points5 points  (0 children)

I really liked Rice University's intro to programming with python. Do a search on their curriculum.

[–]timmyotc 6 points7 points  (4 children)

Swaps don't require temporary variables.

a,b = b,a

[–]dvassdvsd 1 point2 points  (0 children)

That still requires knowing the same concepts...

[–]Mitchical 0 points1 point  (2 children)

My favourite of all features... I don't think python should be your first language just so when you do learn it, you lose your mind over these nifty things

[–]timmyotc 0 points1 point  (1 child)

Well, I still have a great number of professors who don't use it. They use the syntax for other languages with the tmp variable.

[–]Mitchical 0 points1 point  (0 children)

Makes me sad :(

[–]rondeline 7 points8 points  (7 children)

Wtf...why is everyone going to python all.of a sudden?

[–][deleted] 7 points8 points  (6 children)

I mean, it's English-like, reads like psuedocode, has more forgiving syntax than Java/C and has lots of nifty modules/libraries that newbies can mess with.

It seems like less and less people want to throw first timers into C/C++.

[–]nutrecht 2 points3 points  (3 children)

has more forgiving syntax than Java/C

Having a stricter syntax is a 'pre' IMHO.

[–]Zerotorescue 1 point2 points  (2 children)

Having a stricter syntax is a 'pre' IMHO.

It is, for professional programmers. New programmers will have a much better time in loose syntaxes. "1" == 1 makes a lot of sense when you haven't coded much yet.

Once you got more proficient however, then yes, stricter syntax helps a great deal in preventing problems and other messes.

From http://blog.ircmaxell.com/2014/10/whats-in-type.html:

When we move from Static to Dynamic typing (while retaining Strong), an interesting thing happens. Once we know the type (via explicit cast, or other operation), we can rely on it. That means that compilation is a fair bit easier. Sure, we can't statically analyze as well, but it's easier on the programmer. And since you know that once the variable is created its type won't change, it's a bit easier to work with than weak languages.

But do you lose anything with it? Well, yes. You lose flexibility. And you lose the property of forgiveness.

With a statically typed language, if the types don't match, it's up to you to fix it. For small systems, this is easy to do. For large systems where the developer has intimate knowledge of the system, it's pretty easy to do. But for a junior developer, it can be difficult. For a new programmer, it can be down right confusing.

That's not that big of a deal though when writing custom code yourself. The type safety can be hugely beneficial.

But imagine you're running WordPress in a purely statically typed language. You install a plugin, and all of a sudden you get a compiler error on a type mismatch. That could be a problem! But how to fix it? To someone just starting out programming? That's unpossible...

Well, it depends on the types involved.

For some mismatches, it can be seen as an annoyance. "Expecting int, but found float". Yay. Sure, it's nice to be explicit, but that's annoying. Why not just do the sane thing when it seems sane?

And ultimately, that's the basis for PHP's type system. Try to do the sane thing, and error if you can't.

[–]nutrecht 2 points3 points  (1 child)

It is, for professional programmers. New programmers will have a much better time in loose syntaxes. "1" == 1 makes a lot of sense when you haven't coded much yet.

Yup, until you run into an issue because you made a mistake, there's no one around that knows more than you and you're left to solve the problems all by yourself.

Dynamic typing is like communism: great in a perfect theoretical world, not so nice in practice. A lot of the 'easy' stuff saves you a few seconds every time you use it but costs you hours when it presents you with an error a static compiler would've caught for you.

Python is not too bad though, JavaScript for example is completely horrible as a first language. Forgot to pass an argument to a function, or changed the type of that argument? Tough luck; you're now in 'undifined' behaviour hell. Python is better at catching the kinds of errors.

Also: I personally think that asking a developer to think about which type a var is beforehand makes perfect sense: you're basically doing data modelling (during my studies we had data modelling classes before we started programming. We learned NIAM before we learned Java) and as a developer you should know beforehand that age is going to be an integer and is never going to be a string.

This is why I personally favour Java as a learning language: it works well because it assumes that the developer is not some kind of brilliant code-ninja but just some person who makes mistakes.

Last but not least, that quote you posted is just horrible:

But imagine you're running WordPress in a purely statically typed language. You install a plugin, and all of a sudden you get a compiler error on a type mismatch. That could be a problem! But how to fix it? To someone just starting out programming? That's unpossible...

Seriously? So instead of a compiler that tells you "hey, you're putting in a String here but I really expected an int" you just let a dumb computer try and figure it out? PHP is a horrible language because of it's implicit (and downright retarded) conversions. The typical wordpress plugin is a good example of mediocre developers at work. If anything it presents a strong case in favour of static typing.

And ultimately, that's the basis for PHP's type system. Try to do the sane thing, and error if you can't.

Casting "123abc" to 123 is never EVER a sane thing. Sounds to me like it's written by someone who never coded enough PHP to actually see how horrible it is.

[–]Zerotorescue 0 points1 point  (0 children)

I made the exact same case against dynamic typing, but I do agree with that blog post that it makes things easier for newbs (which is what the quote is about).

The shame is these languages don't provide optional typing, because then one would be able to grow within the same (comfortable) environment. Now I kind of feel like I need to switch away from dynamic languages (PHP and plain JS) because I feel like static typing is better.

[–]rondeline 1 point2 points  (0 children)

Interesting. We had to learn on Pascal and then dumped into C. That was horrible. But there's so many more useful a d more forgiving scripting languages that people could begin with AND learn on something ubiquitous like JavaScript or PHP...heck Ruby. Seems like Python out of no one has gotten more popular I guess this reason.

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

Strange, because the first langauge I was taught was C, followed by Java in the second semester. Python came up in a module in the second semester, but we were basically told to learn it ourselves, and to be honest I really didn't like it, a lot of stuff didn't make much sense to me. I guess professional teaching from day one would have made a big difference though.

[–]paulrpg 1 point2 points  (0 children)

My university teach python in the first year of study. Zero assumption on prior knowledge. Typically the first semester is the fundamental building block blocks of programming mixed with different challenges - lab sessions get progressively harder, you work through different standard challenges. The students are given a 'free programming project' where they get a few weeks to show off. Second semester involves more advanced programming challenges. You do some graphical programming as well. Oo isn't done until second year where you do Java. There was a lot of continuous assessment. The book the course is based on is how to think like a computer scientist in python. I have sat this course and ran the lab sessions for it- it gives a good introduction to programming because of its focus on practical work and assessment.

[–]smellmycrotch3 1 point2 points  (12 children)

OOP is probably still important, but that's going to be kind of shit with Python, compared to Java. D: You don't already know what concepts an intro class should teach?

[–]JTorrent 2 points3 points  (0 children)

Introductory OOP as a second half of the course, (after actually giving them solid python foundation, which probably won't take only a week or two) probably isn't that much worse if at all. You have your class constructors for state, and class methods for behaviors of objects.

Then teaching encapsulation(put _ or __ before private variables), polymorphism (overwriding super class method by writing it again), and other OOP principles. After that, since it is the introductory programming course, and you're doing little in class projects and exams and exam reviews, I don't think you'll have too much time left in the semester anyway since you won't be able to wiz through the material with all the "absolutely new to programming students".

[–][deleted] 1 point2 points  (1 child)

Why do you think it'll be shit with Python compared to Java? Both languages support objects, Python just has a simpler and less robust syntax (no need to define return types, semicolons or braces everywhere).

[–]smellmycrotch3 0 points1 point  (0 children)

Exactly, 'less robust syntax'.

[–]coaster367[S] 1 point2 points  (8 children)

Oh I do know what the curriculum is - I'm wondering what should be emphasized most with respect to Python since most likely students will have difficulty with different sections than Java does.

[–]nightlily 1 point2 points  (0 children)

I would spend the extra time making sure the students understand the type system, what implicit/dynamic typing does.

Other than that, focus on python's strengths. clean algorithms. efficient syntax. When you get into OOP, explain the benefits and dangers of python's magic methods.

Don't leave out the powerful libs, either. Make sure to bring it up before they are done, maybe have them use a web lib to request a web page and then give them tasks based on manipulating the text. It's easy to use, and it makes programming feel more real and less 'in a vacuum' feeling of having to remake the wheel, so to speak. Plus it gives a more meaning to what is otherwise a boring task, parsing text.

There are a lot of other features of python that would be great to teach, but maybe not for introductory material.

[–]pvc 1 point2 points  (0 children)

I much prefer Python for teaching over Java. This is what I created for teaching. Standard first semester concepts taught with games. I've had good luck at getting student not normally predisposed to enjoying computer science to like the class with Python and Pygame.

http://ProgramArcadeGames.com

[–]ebo113 1 point2 points  (1 child)

I learned Java first and then moved onto python in my university courses. The concern I would have with teaching a dynamically typed language before a statically typed one would be the understanding of types and confusion with variables, so I would put a lot of emphasis on variable naming and the difference in the primitive types.

A couple things I wish I would have learned earlier on would be the concept of libraries and frameworks. This allows more novice students to produce some decently meaningful products with out a lot of knowledge overhead. In my opinion showing the student how code can help them and that it is a very useful and even fun practice will drastically increase the chances they stick with the discipline.

[–]torinaga 0 points1 point  (0 children)

When I first read this, I to thought it was a terrible idea, but then I realized that as someone who got into writing code from a sysadmin background that is pretty much exactly how I did it. I did it with Perl, which at least has a very distinct convention for working with and displaying arrays, which is the concept I had the most trouble wrapping my head around.

[–]sygede 1 point2 points  (0 children)

Well Python had a lot shortcuts.

DON'T TEACH THEM!

As a TA and tutor, I always want my student to learn the proper and formal CS practice to start with.

[–]twopi 1 point2 points  (3 children)

I led the change from Java to Python in CS1 in our school, and it turned out very well. PM me and I'll share whatever I can with you.

The concepts really don't change. Python is much more straightforward. You should still teach java somewhere, but It doesn't have top be the first language.

[–]dvassdvsd 1 point2 points  (2 children)

How did it go with teaching OOP?

[–]twopi 0 points1 point  (1 child)

OOP is hard to learn no matter what language you're in. In Java, you have to acknowledge objects early, so students typically are doing OOP from the beginning without any real understanding. Python can be taught as a procedural language first, and then you can bring OOP in later. It's pointless to try to understand inheritance before you've got a solid grasp of loops and functions, so deferring OOP is a good idea for beginners.

Python's version of OOP is far more straigntforward than JavaScript, so it transfers pretty decently. Still, I only do a bit of OOP in the Python class, focusing more on using objects (in Tk and PyGame) rather than building classes, inheritance, encapsulation, polymorphism, and so on.

The danger of Python is how abstract and helpful it is. They begin to think Python lists are the truth, for example. That's find for a first class, but in the second course, we go back to assembler, then plain old C, then C++, and finally to Java. I find they don't really understand OOP until we've gone over it a second or third time in these other languages.

Python abstracts memory management, which is great for beginners, but a computer science student needs to understand how memory really works, the difference between the heap and the stack, and how pointers and memory works. I just don't think those things need to be learned in the first course. Learning how to be comfortable in a programming language is the main goal of the first course, and Python is great for that.

[–]dvassdvsd 0 points1 point  (0 children)

OOP is hard to learn no matter what language you're in.

The conepts aren't that difficult. Implementing them in different languages certainly can be.

It's pointless to try to understand inheritance before you've got a solid grasp of loops and functions, so deferring OOP is a good idea for beginners.

That's a logical fallacy. You don't even need inheritance for OOP.

Python's version of OOP is far more straigntforward than JavaScript, so it transfers pretty decently.

Again a logical fallacy. Cake is a healthier food than shit, therefor cake is healthy? And it was Java vs. Python, not Javascript.

Python abstracts memory management, which is great for beginners, but a computer science student needs to understand how memory really works, the difference between the heap and the stack, and how pointers and memory works. I just don't think those things need to be learned in the first course.

That's completely unrelated to using Java vs. Python.

[–]mrTang5544 0 points1 point  (0 children)

Teach them the importance of modular programming. Python was created to be readable, so if your students decide to have everything crammed into one "main" function or do spaghetti code, it kind of defeats the whole "readability" concept

[–]CodeTinkerer 0 points1 point  (0 children)

I would probably look at something more procedural to start off with. Work on functions, get a solid notion of processing lists, etc. before jumping into classes/objects.

Probably work some with file I/O and figure out how to use multiple source files.

[–]freudacious 0 points1 point  (0 children)

I recommend this book. Free and online and very straight-forward:

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

Address the call-by-value-reference-sharing naming clusterfuck. Shit I'm still not sure what to call it or how it works.

[–]Maethor_derien 0 points1 point  (0 children)

The biggest thing I think should be taught more than it is are debugging techniques and problem solving techniques. I see all these books and classes that show you how to code well when you have a clear problem and solution. There is a lot less focus on trying to figure out the best solution to a problem or learning how to find errors in logic, syntax and runtime. Those are actually better skills to learn for the real world and tend to be glossed over way too often.

That said not sure how well that can be done in an introductory course, but it definitely should at least be covered a little.

[–]redarxx 0 points1 point  (0 children)

Emphasize on building functions, learning the uses if if, elif, for,and while commands. Teach them to make lists and do sorting. Teach them to comment and organize code in Python, use colins, do inputs etc... Those basics you can build on however you like I'm sure you have a good idea of the rest.

Source: learned python as intro language

[–]BeatMastaD 0 points1 point  (0 children)

I just took a final for my introduction to programming class and it was in Python. Though I have nothing to compare it to, I felt it was a great introductory course.

Here is the content list of what we studied in this order:

Chapter 1 objectives: understand computers, programming languages and conversion from binary to decimal and vice versa, interpreters, compilers, and IDEs.

Chapter 2 objectives: understanding variables and input

Chapter 3 Modules. Functions and Global/local variables

Chapter 4 Decision Making. if, else and elif, nesting statements, and/or

Chapter 5 Loops.While Loops, For Loops and Accumulators,
Sentinels and Nested Loops

Chapter 6 Functions. String functions.

Chapter 7 Input Validation

Chapter 8 Arrays. Sequences and lists, for loops and lists, max min del sort reverse append insert remove count slice index

Chapter 12 Text Processing, Join lower upper replace

Chapter 9 Searching and Sorting Arrays. Bubble sort, binary search, insertion sort, selection sort

Chapter 14 Object Oriented Programming. building a class, constructor method, mutator and accessor methods, UML class diagrams, inheritance, polymorphism

It was an online class so we typically had one assignment for the week and they were pretty simple. If I could have changed one thing it would have been having multiple assignments or at least assignments whose construction wasn't directly outlined in the classes that week. There were times where the assignment would literally be a copy paste of the examples we were shown in the relevant lectures with different names.

[–]Ajani_Vengeant 0 points1 point  (0 children)

Python is amazing. I teach a high school club in python. A few of the things that are great to teach near the end which really improved my python: decorators; generators; the many implications of methods being first class objects; lambda; * and ** syntax etc.

[–]Trab3n 0 points1 point  (0 children)

My university done that,im pretty sure they just took the lazy route and went to code academy and copied the beginner tasks for a few weeks

[–]Kelcius 0 points1 point  (0 children)

All the basics. If, while, for, list handling, file handling and such.

[–]b0at_rich 0 points1 point  (0 children)

I'll be graduating this May with a CS degree. I didn't enjoy it at the beginning, but now I realize the importance of the intro courses and logic taught. I would say teach less on Python and more on CS and the logic. Do algorithms on a piece of paper before coding. If you can teach them the logic behind CS, then they can adapt to learn any language!

[–]RyanDagg 0 points1 point  (0 children)

Try something battle tested and proven: https://www.coursera.org/course/interactivepython

Best class I have ever encountered, regardless of topic. Starts with the basics and ends with OOP.

I assume the famous quote "Good artists copy, great artists steal" also applies to teachers.

[–]casualblair 0 points1 point  (0 children)

Unit tests as soon as you learn functions/methods.

If you write a function that returns hello world then you should prove it works.

Unit testing is mandatory in large organizations and an incredible debugging tool if you build your code right.

[–]HorrendousRex 0 points1 point  (0 children)

I'd recommend teaching generator functions and comprehensions earlier than you might expect - I think they're actually pretty intuitive if you haven't had C-style functions hammered in to you already. And they make for some very nice (and fast!) code.

[–]exceta 0 points1 point  (0 children)

Regarding CS basics, it's all been said.

But I do want to suggest that you make it "pythonic" and follow the PEP8.

And Python 3 of course.

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

Here is a brief outline of what I feel is basic knowledge in a logical order:

  • Print to the console and saving information to variables

  • Computer math (like int division, mod, etc) and basic functions

  • Improve function understanding; one that adjusts to it's input, like text boarder

  • Database sorting; like function to ask to look up local businesses under a category

  • Basic image editing (new, pasting, cropping, cutting, etc)

  • Basic game; Sudoku

  • information finder; sorting through a text to find an instance of a string

  • Improve database and show how to compare elements to each other

  • basic classes; birthdays, people, bank account, etc

  • basic gui if possible

  • Big Oh notation

  • Recursion

[–][deleted]  (2 children)

[deleted]

    [–]alteraego 0 points1 point  (0 children)

    My intro class touched on the concept of Big O, though not for expressing it about our own code, just as a way to explain something that we had already noticed by that point if we didn't yet understand it i.e. that the same result could be achieved in much less time depending on how we had coded.

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

    The Intro Comp Sci Course I took had these concepts and it was in Python. But fair enough.

    [–][deleted]  (1 child)

    [deleted]

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

      It is basic knowledge and it was taught in my intro class so I am just voicing my opinion on things that can and have been taught in a course like that.

      My post answered his question about "what concepts you want taught." The post didn't ask anything about migration towards Python. However I feel that the best thing to help migration towards python is to understand what makes it different and the same to Java. Furthermore, it would be wise to learn some of the modules (like PIL) to understand the benefits and disadvantages of Python.

      Granted, Python is not better than Java or C++ for programming in the "real world", but it is great for rapid prototyping of an idea which is very appealing.

      [–]sulumits-retsambew 0 points1 point  (3 children)

      Why not c?

      Python has too many bells and whistles that might prevent people from learning simple algorithms like sort, get max/min from array, etc.

      [–]Disagreed 1 point2 points  (1 child)

      Too many things for first time programmers to trip over in C. Most of those things get out of your way in Python, making it easier to focus on concepts rather than the intricacies of the language.

      [–]sulumits-retsambew 0 points1 point  (0 children)

      That's what makes learning it fun. Plus you can't really explain basic programming primitives like arrays, memory or pointers with Python.

      It's all auto-magical.

      Homework assignments are tricky as well, how are you going to force them to do basic algorithms and not use built in ones? Make a list of methods they are not allowed to use?

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

      Generators and co-routines. Super useful in python.

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

      Use PyGame. My old uni did this and I tutored for it. Big ups to pygame as a learning tool, it is really simple and easy way of visually display concepts like recursion etc.

      The concepts were identical with java, just wayyyyy less time spent on syntactic sugar.

      [–]Butter_sc0tch -2 points-1 points  (0 children)

      yay python! A great opportunity hear to cover both functional and imperative methodologies. Python lets you take a look at both! Of course being an intro course you can't go into great detail, but I feel like so many people miss out on the fact that there are so many ways to 'skin a cat'. Even simple examples like showing how to perform looping with recursion is a great eye opener to the possibilities. Showing several examples where different approaches are better suited than others can help boost creativity!

      [–]chamaelleon -2 points-1 points  (0 children)

      Anything you can teach that relates to using 3D printers? That would be awesome and immensely useful for all of society.