Sunday, January 27, 2013

BASIC, Good Language for Beginners

Update:
I have decided to recommend Python as the best first language for a beginning programmer.  Basic is still an excellent choice for a first language.  My reasons for promoting Python over Basic are explained here:  Python, Best Language for Beginners (July 20, 2013)

Original Post:
After much thought I have reached the conclusion that the best language for beginning programmers is BASIC.  It is close to natural language.  It was intended as a teaching language.  It is used professionally, so it is not used only as a teaching language.

Here is a list of articles I have written about Basic:
Learning to Program with BASIC Sunday, April 22, 2012
Just Basic Tutorials and WinHlp32 Saturday, September 8, 2012
Install Time: Just Basic vs VB Express Sunday, September 9, 2012
Power Basic and Liberty Basic Saturday, December 22, 2012
Small Basic Saturday, December 22, 2012

As I mentioned earlier, some people think Python is a good first language.  Many languages can be used as a first language.  A first programming language should be a procedural programming language.  In other words, not an object-oriented programming language.  There is a lot of baggage that comes with object oriented (OO) programming, so an OO language is better suited for a 2nd language.  As I pointed out in an article, The Texas Young Programmers Project, most programming competitions require use of the Java programming language, with is an OO language.  So for the sake of practicality, Java is probably a good second programming language.

I believe some young people benefit from early exposure to programming.  Programming is not for everyone, but it can be very important for some people.  I believe getting off to a good start is important, so the first programming language is important.  Then a second language is important.  As much as I like C, C++, and Python, I think the best languages to learn are Basic first and then Java second.

Middle school and early high school are good times for early programmers to delve into Basic.  Java would be good for senior high school.

Robert Canright

Here is a relatively recent (18 Dec 2013) blog post about Small Basic written by someone from Microsoft:
Small Basic is FREE!!!
Here is an earlier post (22 Dec 2012) by me about Small Basic

Saturday, January 12, 2013

Trouble Building Murach Java Code

Murach's Java Programming by Joel Murach is a popular book for people learning Java.  You can go to Murach's website and download the code examples in the book and run them.  I recommend that.  But you might run into a snag building the code (and you might not).

Here is what can go wrong and a couple of ways to fix the problem.  If you already have Java on your machine, an older version of Java, then you will have trouble building the code.  The code expects Java 7 and if you have an older version, your build will fail.

There are two ways to fix this problem.  One way is to right-click on the project, select "Properties", then where it says "Souce/Binary Format" you can pick a version of Java that you have on your machine.  I had Java 6 installed, to I selected Java 6 from the drop-down menu, hit OK, then I was able to build and run the project.  The project came from the publisher with the binary format set to Java 7 and I had to adjust that project property before the project would build because I did not have Java 7 on my machine.
Single-click on this image and you can see a larger version (right-arrow to see the other images).  Here's another fact to learn:  just because you install the latest version of Netbeans, don't think that you will get the latest version of Java when you do that.  You won't.  So when you try to build the Murach code, Netbeans will complain until you fix it either by changing the properties of the project so it expects Java 6 or by installing Java 7.

You have to go to the Oracle website to download the latest Java, which at this time is the Java SE Development Kit 7.  If you download the version for older Windows machines, you will get this executable for the installer:  jdk-7-windows-i586.exe.

After you install Java 7 on your machine, you still need to get Netbeans to recognize it.  In your project, here we are looking at the ch15_FutureValue project, select "Libraries" as shown below.
Right-click on the Libraries, select Properties, click on Manage Platforms, click on Add Platform, maneuver to the Java folder, and select jdk1.7.0.  Now that you have fixed Netbeans so it can see the Java 7 JDK, you can once again right-click on the project, select Properties, go to where it says "Souce/Binary Format" and the drop-down menu now has JDK 7 as an option.  Select JDK 7.  Now you can build your project with Java 7 as the Murach intended.  You can do a clean-and-build.  It will build without errors or warnings.  You can run the project and the Future Value Calculator works just fine.
I ran a sample set of numbers in the calculator.  If you are a young person, remember it is never too early to save for your future.

You do not really need to install Java 7.  You can set the project properties to build with Java 6 and you won't have any problems.  But when you are learning to program and a sample project that should build gives you trouble, it can be frustrating, which is why I am sharing this information.

If you are learning to program, do not get frustrated when things do not work as expected.  That happens a lot.

Robert

Saturday, January 5, 2013

Big Ball of Mud

Software design is challenging.  "Big Ball of Mud" is a term that is used to describe a bad software design:  "A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle."  If you want to write good code, you want to avoid creating a big ball of mud.

Software might start as a ball of mud, or it might degenerate from a coherent design to a ball of mud.  If you want to create good software, you need to have some understanding of lousy software.  I recommend you read the original paper by Brian Foote and Joseph Yoder:  http://www.laputan.org/mud/

You can watch  Brian Foote lecture on the Big Ball of Mud to programmers at Google in Mountain View, California.  The lecture (1 hour 6 minutes) is available at YouTube: http://www.youtube.com/watch?v=h6Y9aJhqO78.  I recommend it.  (If you want to be careful, go to You Tube and search for the Big Ball of Mud.)  The video has new content, not in the original paper.  You should see in this video his comment on the development process called Agile Software Development.  This comment is on the slide labeled "Agile Ike." It makes an important point with humor.

You will hear Dr. Foote refer to The Mythical Man-Month by Frederick Brooks.  Yes, every programmer should read this book.  He specifically mentions one essay from the book, No Silver Bullet -- Essence and Accident in Software Engineering.  You can download this from the internet from this website:  http://faculty.salisbury.edu/~xswang/Research/Papers/SERelated/no-silver-bullet.pdf.

Fred Brooks' "Essence and Accident" essay is interesting, but I can recommend a more practical exposition on writing good code:  Code Simplicity: The Fundamentals of Software by Max Kanat-Alexander.  This is small book and well worth your time.  There have been very many books written about writing good code.  This is the most practical book in that genre.

Robert

Thursday, January 3, 2013

Becoming a Programmer

You do not need a degree in Computer Science to become a programmer.  Technically, you do not need a college degree to become a programmer.  Bill Gates wrote and sold code while he was still in high school.  He dropped out of college to join Paul Allen in starting Microsoft.  Mark Zuckerberg dropped out of college when he started Facebook.  I know programmers who are fine programmers, but did not graduate from college.  Getting employment as a programmer without a college degree might be more challenging, but it is possible.

Sometimes a college graduate decides to become a programmer after completing a degree program unrelated to programming.  The following blog article (http://cacm.acm.org/blogs/blog-cacm/156836-teaching-programming-to-a-highly-motivated-beginner/fulltext) describes someone's experience in mentoring a businessman in programming.  What I hope to do with my blog, Canright on Software and Programming, is to share thoughts with people who are learning programming.

I want to assist young people, who are interested, to pursue programming.  When I was a young person I very much enjoyed learning chess and playing chess.  Chess is a game that offers as much complexity as you are willing to handle.  Programming, in some respects, is like a complicated game that some young people can enjoy.  Programming has the advantage that it can lead to useful skills.

The internet has many resources for someone learning to program.  I will mention the CodeProject as one source for beginning programmers.  Stack Overflow is another website where you can ask questions.  Sometimes just Googling a specific question will lead you to an answer.

A young person learning to program is not making a life-long commitment to becoming a professional programmer.  Sometimes programming is a useful skill in various business or scientific endeavors.

I hope some of my posts here might be helpful.

Robert

Learning to Program with Python

Some people think Python is a good first language for beginning programmers.  That might be so.  It has been around for a while so there is significant support for it, which includes the book Python Programming for the Absolute Beginner.  There is also Python Programming: An Introduction to Computer Science (2nd Ed.) by John Zelle.  There are many books and many on-line resources for Python.

Python is free.  You can download it and install it very easily.  It runs on Linux and on Windows.  It has an interactive interface you can use to test pilot Python statements, very much like the interface that Scheme provides.  This type of interface is called a REPL (read-evaluate-print loop).  Python does not require a compiler, so that is one less thing to worry about.

Here is an article, Teaching Programming To A Highly Motivated Beginner, where a professional programmer mentors someone who wants to learn programming.  This blog article mentions a free Open Course-Ware class from MIT (course number 6.00) that teaches an introduction to programming using Python.

There are three paradigms for programming:  (1) procedural programming, (2) object-oriented programming, and (3) functional programming.  You can use Python for either procedural programming or object-oriented programming.  I think it is best to learn programming with the procedural programming paradigm.

The  Python programming language is here to stay.  Whether you begin to learn programming with Python or with Basic, you will have a beginner's language that you will be able to continue using for a long time.  It some respects, it is a matter of taste or circumstance that will lead you to pick one language or the other as a first language.  If you pick Python, and you can find someone you know who is using Python or who wants to learn it with you, find out the people you know are using Python 2 or Python 3.  You will want to use the version your support group is using.

Robert

Here are previous articles by my on Python:
Installing Python  October 13, 2012
Notepad++ and Python October 13, 2012