Learn to Program Python - Humble Bundle

This popped up today, its a bundle of Python books from Humble Bundle

Humble Bundles come in tiers, lowest tier is a dollar or more. Second tier has a bottom limit of $19. If you think tiers are worth more, you can pay more. A good chunk of proceeds go to a charity.

The lower bundle is good for people that want to learn Python. And as a low budget roboteer, you can get tons of info for the cost of a few sprockets.

Some of you have been asking about C++ vs Blocks vs Python, here is a chance to soak up some unbiased Python info (ok well the people writing these books are Python fans) and see how you can leverage this into “real world” applications.

13 Likes

Python is absolutely a great language and is used in production for many things, and is awesome as a first test based language, but, imo, programming the robot in C++ should still be the eventual goal.

9 Likes

But why?

Python has proved itself as a sufficient language to program robots, so why would a different language like C++ be better? Yes, I know, faster calculations in languages that aren’t python, but is there another reason?

2 Likes

C++ follows the structure of a lot of other languages more closely and learning its syntax will go a long way towards many other widely used languages like Java. Of course, some languages, such as Go, which is used a lot by Google, are more like Python. Theres nothing wrong with using either language for Vex, though.

3 Likes

Ah, thanks. That makes much more sense.

VEX IQ or Lego Mindstorms are both great platforms to teach robotics and create some amazing projects like Rubik’s Cube Solver or Printer, but many middle and high school students choose the metal of VEX EDR because it feels more powerful and resembling the real world applications.

Similarly, Python could be great for quick prototyping and teaching but its ecosystem is not as mature as that of C/C++. I work on a large multi-platform application written in C++ and we recently added Python scripting option by embedding Python runtime - the versioning and numerous python module compatibility issues is a source of continuing headache, so far.

There are some exciting projects like MicroPython that are bringing programming language alternatives to the popular microcontrollers, but if you know C/C++ you are pretty much guaranteed to be able to program almost any embedded system and be very close to the metal in respect to efficiency and access to the low level hardware features.

7 Likes

Need a little more backup on this if you don’t mind.

I’ll toss in my 2 cents.

  1. We are here to inspire. According to more than a few sites (and I picked this one University page on popular languages to learn at random) that there are 5 more languages more popular. (Python, Java, Javascript, C#, and plain C) ( I try not to talk about Perl, but all my sysop friends use it every day)

  2. If I Google the top robot programming languages I get C, C++, Python, Java. And more than a few sites note that C is preferred for robots that have limited resources (like the Cortex and V5)

  3. In business the current favorites for web applications is PHP, Javascript, Python, Java and C++. If you believe the Wordpress people, 60% of the websites run on Wordpress and that is PHP at it’s finest.

I’ve always gone on the less is more. I started off on 8008, 8080 and 6502 processors. So lots of assembly, but mostly C. There isn’t anything that can be done in the V5 world in C++ that can’t be done in C. All the C++ brings is lots of extra noise. I hear “What about name spaces?” Well exactly. You have just one namespace in the closed V5 environment. Not any third party code being passed around for people to use.

@technik3k notes Micropython which is a smaller version that can run on smaller chips. I like it and have messed around with the Adafruit boards that support micropython. Easy to program and fun to use.

I’m pretty sure the “goal” isn’t getting to C++. Any syntax past Fortran will get you into any set of languages (Basic, C, Python, Processing, Java, Javascript, etc.). If you rip away the library aspect of all languages, the core syntax is about the same. What makes any of the current languages hard (like Java) is all of the library stuff that goes with it. Take Ruby which is a wildly popular language for web development. Ruby people will say “You can build a webserver in 10 lines” No you can’t. You can write 10 lines of code that calls 2,000 lines of library code and have a webserver.

Lastly, it’s not about the languages, it’s about the algorithms. Algorithms make the world go around. Things like PID for example. A key algorithm that once you know how it works you can program it in a new language in a moment. There are about 70 well known sorting algorithms and depending on your data some are much better than others. Knowing which one to pick can make a difference.

So if I was going to suggest what to do after learning a language is to start learning algorithms.

11 Likes

This. I can’t emphasize enough. Programming is about knowing how to solve problems efficiently. The language used is an expression of the algorithm to solve the problem.

As long as 2 programming languages are both Turing Complete, then anything you write in one can be written in the other.

Where programming languages matter, is how easily and clearly one can convey the algorithm. First to the author, then to others. While not the case typically in Vex, but in the real world, maintenance, bug fixes, etc. take up the lions share of time compared to the “initial implementation”. Figure good software has a shelf-life of about 7 years.

There’s a joke that makes me laugh - “I got into computers in high school so I didn’t have to deal with people. When I got a job in computers after college, all I did was deal with people”. Designing software, and then writing code is always a collaborative process. Write code clearly so that others (and that “other” may be your future self) can understand it. Don’t make functions called doThingy() because noone’s going to know what that does an hour later.

I know I got into computers partly because I hated English class. Turns out that one of the best attributes of effective programmers is communication skills.

7 Likes

I run into versioning problems with every language I’ve used (C, Java, Python, and C#) . I’m not sure that I’d personally describe Python as “immature”. And that’s the thing, people like arguing, whether it’s about which language is “better” or “tabs versus spaces” or “vi or emacs” or “water game versus air game”.

I would certainly recommend that high school (and college freshman/sophomores) learn at least 1 of the “main” programming languages (C/C++, Java, C#, Python, Go, even good old Fortran). Use it to learn control flow, recursion, functions, etc. Learning object-oriented patterns is a good stretch goal (and rules out a couple of those above). By your 2nd or 3rd year of programming, branching out to learn a new language should be an objective. Mostly just to get a different perspective, as well as being able to learn the skill of learning a new programming language. Past that, learning functional languages (Lisp, F#, etc.) can be extremely eye-opening

Micropython is what VEXcode Python is based on, we created a port for V5.

4 Likes

The lastest Github report of the most popular languages in use at Github sites.

image

7 Likes

No Rust :(. At least Typescript is up there