Saturday, July 20, 2013

Python, Best Language for Beginners

 Basic is a great language for teaching programming.  The BASIC programming language was created at Dartmouth College as a vehicle for teaching programming to beginners.  But when I look at projects at the GitHub website, you will see that Python is on the list of most popular languages, but Basic is not:  https://github.com/languages

Based on features, Python is a good first language.  Its style of coding is closer to that of Java than to C/C++, but it permits procedural programming while Java is strictly object oriented.  Python's popularity together with its other strengths make it the best language for beginners.

I had previously recommended Basic as the best first language for beginners.  How can you go wrong with Basic?  Only if Python provides more practical opportunities.  Kirk McDonald, president of PubMatic, an ad tech company in Manhatten, wrote an Op-Ed piece in the Wall Street Journal, May 10, 2013, titled, "Sorry College Grads, I Probably Won't Hire You."  I'll quote him:  "...please learn a little computer programming."  He also said, "Dabble in a bit of Python."  So the president of a tech company recommends Python, not Basic.  (You can google the title and read the article online.)

I had previously recommended Python Programming for the Absolute Beginner by Michael Dawson.  I continue to recommend it for beginners.  You can go to the publisher's website and download the version of Python that is compatible with Python modules called Livewires and Pygame, which come with the Python installer used by the book.  You can also download the source code from the book.  This book is an excellent resource for the beginning programmer.

Robert

Here is an article with more explanation of why people like Python:
http://www.mihneadb.net/post/python-the-best-first-programming-language/ 

Here is another article saying Python is the best language for beginning programmers:
"Python squeezes out JavaScript, C as best starter programming language", January 23, 2014
http://www.itworld.com/application-management/401419/python-squeezes-out-javascript-c-best-starter-programming-language
Surprisingly, the C programming language was 2nd on the survey. I last mentioned C a a beginning language on April 13, 2013:
http://canrightonsoftwareandprogramming.blogspot.com/2013/04/the-c-programming-language.html

Additional blog posts:
Python GUIs with PyGTK and Glade  February 26, 2014

July 9, 2014
"At the time of writing (July 2014), Python is currently the most popular language for teaching introductory computer science courses at top-ranked U.S. departments.
Specifically, eight of the top 10 CS departments (80%), and 27 of the top 39 (69%), teach Python in introductory CS0 or CS1 courses." This quote is from the following blog:
http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-introductory-teaching-language-at-top-us-universities/fulltext


Sunday, June 30, 2013

Instructions for installing PyDev

Here are instructions for installing PyDev into the Eclipse IDE.  This a link to a detailed set of instructions that include the installation of the Eclipse IDE, followed by the installation of the PyDev plug-in.  This is a 35 page document.  The Chrome web browser will open it, eventually.  Mozilla might have trouble opening it (my copy of Mozilla proclaimed the file was damaged, but it was not).  Microsoft Internet Explorer will eventually open the PDF file.  It takes time because the file is large.

PyDev was developed by a company called Aptana.  They have an IDE called Aptana Studio 3 that comes with Python loaded in it.  This is another version of the Eclipse IDE.  It will work just like Eclipse, if you are familiar with it.  You do not need to add the PyDev perspective in Aptana Studio 3. The Web perspective will run Python code just fine.  You do need to setup the Python interpreter.  Refer to the instructions for installing Pydev to see how that is done.  See the section, Configuring the IDE, pages 14 to 18.

IDE's are helpful for debugging code.  It is great that you can use Eclipse with Python.

Robert

Friday, June 28, 2013

Dia - Simple and Free UML Drawing Tool

I mentioned ArgoUML in an earlier post.  Now I'll mention Dia for UML diagrams.  ArgoUML can generate code from the UML models.  Tool Dia was inspired by Visio.  Dia cannot generate code, but it is very easy to use.  Its homepage is:
https://wiki.gnome.org/Dia

The Windows installer for Dia can be found here:
http://dia-installer.de/

Here is an example of a sequence diagram drawn with Dia, which calls them lifelines.


You can see the diagram is more sophisticated than what you would draw with PowerPoint.  There is a drop-box in Dia where you select UML diagrams.

It is important to document your designs.  You export your Dia diagram to a picture file in order to paste it into documents.  I found Gimp useful for cropping pictures exported from ArgoUML.  In Dia I draw a simple box, put my diagram inside the box, and the export to jpeg automatically crops the picture around the box I drew.  That makes it easier than ArgoUML for making jpegs to paste into documentation.

Robert

Posts elsewhere about using Dia for UML:
UML Sequence Diagram in Dia?
http://stackoverflow.com/questions/3535717/uml-sequence-diagram-in-dia

How to lengthen lifeline of sequence diagram in Dia?
http://stackoverflow.com/questions/9955587/how-to-lengthen-lifeline-of-sequence-diagram-in-dia

Post about ArgoUML:
http://canrightonsoftwareandprogramming.blogspot.com/2013/06/argouml-free-uml-drawing-tool.html


Saturday, June 22, 2013

ArgoUML - Free UML Drawing Tool

UML diagrams are vital for documenting code.  I have used and I recommend the free diagramming tool called ArgoUML.  I have used ArgoUML 0.34 for Windows.  You can download it from here:
http://argouml.tigris.org/

ArgoUML does more than create diagrams for documentation.  You have to export your diagram to a picture file to have pictures for documentation.  Then you might have to crop your image.  I use Gimp to crop pictures.. ArgoUML can generate code from your diagrams.  It supports code generation for these programming languages: C++, C#, Java, PHP4, PHP5.


For large projects, or for professional projects, I recommend buying Sparx Systems Enterprise Architect.  The last time I looked it was $135 for an individual license.  Sparx Systems Enterprise Architect will generate C++ code for you from the class diagrams, which pays you back for the effort of creating detailed documentation.  I have used this at a customer site and was very impressed.  I highly recommend this professional tool.

Here is their website:
http://www.sparxsystems.com.au/
They are an Australian company.

Robert

Cppcheck - Free Static Code Analysis for C and C++

Cppcheck is a free static code analysis tool for the C and C++ programming languages.  It is integrated with the Code Blocks IDE.  I like the Code Blocks IDE and this is one more reason for liking it.

You can download Cppcheck for free from SourceForge:
http://cppcheck.sourceforge.net/

Cppcheck can help you find potential null pointers.  You must be careful with memory creation and destruction in C/C++.  I highly recommend static code analysis to look for null pointers.  I have used Cppcheck.  I recommend it.

Robert

SourceMonitor - Freeware for Code Review

SourceMonitor is a free software tool for code complexity analysis.  It will give you a line count for your project and provides complexity analysis.  I have tried it and found it interesting.  It is free, but you have an opportunity to donate payment to the author.

Here is a link to its website:
http://www.campwoodsw.com/sourcemonitor.html

Its website says SourceMonitor measures metrics for source code written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML, including method and function level metrics.

Complexity analysis can pin-point sections of code that are overly complex.  Code that is overly complex might be more likely to contain logical errors.  Overly complex code is also harder to maintain.

Robert

Saturday, April 13, 2013

The C Programming Language

Should a beginning programmer learn the C programming language?  The C programming language is a great language and it is a fine choice for a first language.  But if your buddies in school are all coding in Java or Python, you might consider using the same language they are using.  If you want to join an open source project eventually, then you might pick as your first language the language used by the open source project of your choice. The open source chess playing software GNU Chess v5 was written in C, but the next version, GNU Chess v6 migrated parts of the code to C++.  The open source chess program called Fruit was written in C++.  Then you might find that many scholastic programming contests use Java for the programming contests.

I think it is best to learn C before learning C++.  So if you plan to eventually learn C++, then learning C first is an excellent idea.  C++ is used a lot in video game programming.

Many tools and programming languages are written in the C programming language.  The GTK widgit toolkit used for GUIs was written in the C programming language, as was the Linux operating system.  Parts of the Python language are written in C.  The Pidgin open source instant messaging client was written in C.  The Ruby programming language and the PHP scripting language were written in C.

Here are a couple of excellent blog posts about the C programming language:  Why I Chose to Learn C and The Unreasonable Effectiveness of C.  The former blog mentions this website for learning C:  Learn C The Hard Way.  Here is another website for learning to program in C:  http://www.cprogramming.com/.  The blog also mentions a new book on the C Programming language:  21st Century C: C Tips from the New School by Ben Klemens.  I had mentioned other books for learning C in a previous post:  Logic for Programming and Comments on C Programming.

The C programming language would be a fine language for a first language, but Python or Basic would also be fine.  Java is not my first choice for a beginners language, but I do notice it is used a lot in high school computer science classes.  I will mention that I use the C programming language to prototype algorithms and functions that eventually end up in C++ or Java projects.  Because C uses curly brackets to define a code block, functions in C can drop easily into C++ or Java because they too use curly brackets.  However, if you use Python to prototype functions, then you will have to go back through the code and add all the curly brackets because Python uses indentation to define code blocks.

I will observe that the C programming language is used now mostly by hard-core programmers writing tools.  Applications programming is done mostly in Java these days.

Robert

The previous post mentioning the C programming language is:
Logic for Programming and Comments on C Programming, October 22, 2012 (Monday)