RSS

C++ or Python

13 Dec

My wife asked me what intro to programming class she should take so I asked her the options. They were python and c++.

At first I laughed a bit and repeated the word, python? Really?

If someone was talking to me about computers and said:

nerd: “I’m a full time developer”
me: “Very cool, what language?”
nerd: “Python”
me: “Really? lol. That is unfortunate.”

I’ve discussed Perl quite a bit recently but haven’t gotten into Python since high school. I decided to poke around a bit before I advised on what class to take. The major downfall of c++ is how difficult it is. The one thing that makes it easy is the Microsoft IDE. I couldn’t find out for sure if the class would use the 2010 C++ IDE from MS. However, I had a pretty good guess they would be using something else. I guessed this because Python is an option, so there has to be a dark side to the decision making when it comes to classes. I had this strange feeling that maybe there was an uptick in Python usage because of the Android OS or the fairly recent needs for cross-platform code. But I don’t think universities make moves based on year-to-year usage.

I am fully aware there is a pretty vibrant nerd culture. The Linux folks who are Microsoft haters will spend countless hours developing something that is “cross-platform” just so they can get some street cred for not using anything Microsoft. I will give street cred to someone who develops systems with a $0 budget, I appreciate that. But to achieve the $0 goal, your time has to be worth nothing.

I’ve spent a lot of time getting linux systems working and writing non-ms code. Using notepad as your IDE was a big one on the forums back in the day. I read several instructions to use notepad instead of that other “crap” because notepad is the only way to go. If you are wanting to write code as a hobby, then by all means use notepad and languages like Python. But, don’t expect to contribute to society while you lurch over a CRT screen with some kind of simple “File not found” or other run-time error. And I know its a run-time error because your guess and check style of “debugging”.

C++ would be the obvious choice for me and should be for any hard core computer person. But I wouldn’t recommend it to my wife just yet.

Python is interpreted at run-time. It does not have to be compiled like c++. This is somewhat alluring to a beginner because they can look at and edit the source code in whatever text editor they would like. That source code file is the only thing that runs, so it doesn’t get confusing. All that is needed is the interpreter to convert the language to machine readable code.

I decided to dig a little bit deeper and write a small Python program.

http://sthurlow.com/python/lesson01/

py_lesson_1_and_2

Above is IDLE. It is a pretty lousy attempt a development environment. As you can see I point out a flaw in python right away. It assumes floating point numbers out of the box. This dates the language quite well because nobody in the 21st century would want to default to a floating point number.

Here is a better example of python. The script files end in .py. The editor does at least have syntax highlighting and string concatenations work with the + operator.

py_lesson_3

And now I have an example of the C++ IDE. Its as powerful as they come, however with great power comes a great many challenges.

c_lesson_3

I had several errors in my code to fix before my application would run. That’s pretty sad but at least I can admit it. I am not a fan of the :: syntax or the need for semicolons to end the line. Also, the main routine line seems a bit “syntaxy”. It wasn’t my first c++ program but I still needed this cheat sheet: http://www.learncpp.com/cpp-tutorial/06-writing-your-first-program/

My intro choices in CIS were VB.NET and Java which I took both of those classes. Had I chosen the computer science path I could have taken COBOL, C++, C, Visual BASIC. Yes, I listed COBOL… don’t believe me? ( http://www.cs.wmich.edu/lowercourses.php )

Its never really the language that gets me to dislike, its the environment in which you use the language. Python is for scriptors, not programmers or developers which I describe some of those differences here: ( https://nujakcities.wordpress.com/2010/08/12/express-vb-net-my-fav/ ). There are players in the game like dropbox and Eve online that do have a pretty large investment in Python ( http://www.python.org/about/quotes/ ) but I still can’t suggest it to anyone that is serious about development. But, for those of you forced to take a “programming” class, I would pick python over C++ if you want the easier route.

 

Advertisements
 
1 Comment

Posted by on December 13, 2011 in Uncategorized

 

One response to “C++ or Python

  1. RandomBob

    March 14, 2015 at 5:51 pm

    Hi, sorry that you had such a hard time with Python. Really dont usw IDLE it is OK (not good) for the start but not more. And notepad… Well its like programming in wordpad. If you try geany it will be mich easier. Linux itself is a time consuming project, thats true. If you are willing to invest the time you will habe your very own system down to the Windows manager oft your liking. C++ or Python thats a really tough one even if you leave the Syntax out. It depends in your preferences. If you need something compiling into a single exe c++ it is. Well if your system doesnt even known what to do with a exe file… Than python 😉 or if it has anything to do with the web than python. Quick Software that would be c or c++ learning the concepts oft programming python. But dont habe just one tool in your belt. Usw languages that Marke your tasks easier.

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: