Object Oriented Programming

When writing code, it is best to limit the duplication of code as much as possible. To that end, I am going to share here the articles and websites I used to get what I feel like is a good grasp on the idea of objects and OOP.

I started with a good understand of what objects and classes are, as defined by Oracle:

https://docs.oracle.com/javase/tutorial/java/concepts/

I also read part 5 of the transcript from a David Gries speech here:

https://www.cs.cornell.edu/gries/programlive/OOfirst.pdf

Next, I went through part 3 of Yakov Fain’s book Java Programming for Kids. Yes, its for kids but combined with the 2 listed above I was able to get what I consider a sound understand of how objects and classes work.

http://yfain.github.io/Java4Kids/#_meet_classes_the_main_language_constructs

Please share any insight on OOP that you care to. My mind is an open book at this point and I’m trying to take in everything I can. Thanks in advance.

Next I’m going to start on actual programming, the obligatory “Hello, World” type stuff as well as  operators, which I want to take a deep look at, it seems relational are usually taught early and the others added in as needed but I’d like to cover everything up front, we’ll see how that goes.

 

 

 

 

 

Discussion

I want to make it a point to discuss and explain everything I cover, as I cover it. I’m hoping this will give me a better understanding of everything. So, I would like to take a step back and expand on a few things I have learned so far.

First of all, Java.

Java was developed by James Gosling at Sun Microsystems and released in 1996. In 2006, Sun made Java available under the GNU General Public License (GPL). It is written to run on any type of processor because it uses a Java Virtual Machine (JVM) to run the software (bytecode) and translate it on the fly to a language any processor can understand.

  1. Program written in Java ->
  2. Compiled into bytecode (understood by JVM but not the OS) ->
  3. Run in the Java Virtual Machine ->
  4. Translated to machine language usable by any processor or operating system

The end-user must have Java installed on their machine to execute the program.

Next, the JDK.

The Java Developers Kit comes in 3 flavors, Standard Edition (SE), Enterprise Edition (EE) and Micro Edition (ME). We will be using SE (the links in my last post pointed to this edition). The kit comes with a collection of programming tools, some, like the compiler and loader, I will be using right away, others I will be learning more about as I go. The JDK comes with a complete JRE, JVM, and the Java API. The Java API is a set of classes written in Java that can be used to aid your programming by allowing you to call those classes instead of writing new ones for things like file access and displaying text on the screen. This kit is really everything you need to write and applications.

And Finally, the next step.

Next I will be going through some various Java tutorials and other texts with the goal of coming up with a good definition of Object Oriented Programming, how it works, and how to visualize it so that I have a complete understanding of the concept and how it can work for me.

 

 

 

 

 

A little prep work

The first step in learning a language, of course, is to get our hands on a compiler. In Java, code can be written in Notepad (or any text editor) and then compiled, using a Java compiler, into a working program.

The JDK, or Java Development Kit, includes the Java Runtime Environment, the Java compiler, and the Java APIs.

We will need:

The Java JDKhttp://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

The Java JDK with NetBeans (more on this below)http://www.oracle.com/technetwork/articles/javase/jdk-netbeans-jsp-142931.html

I will not go into installation, there are many tutorials that can be easily found with a quick search.

Once the JDK is installed, we’ll want an IDE, or Integrated Development Environment to write the code. As I said above, you can certainly use a text editor but the IDE has many advantages.  I have used Notepad++, which seems to be a very basic IDE but worked well for me. An IDE is like an advanced Notepad, when you type code, it highlights reserved words and numbers the lines for you. In an operating system, reserved words are words or commands that have a specific meaning in the language. For instance, PRINT, is a reserved word in many languages and can’t be used as a variable name. There are many options to choose from, I will list a few here:

Notepad++ I will be using this to begin with – https://notepad-plus-plus.org/download/v7.3.3.html

“Notepad++ is a free (as in “free speech” and also as in “free beer”) source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License. Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.” (Notepad++ – website https://notepad-plus-plus.org/)

NetBeans IDE – see above to download with the JDK

“Fits the Pieces Together. Quickly and easily develop desktop, mobile and web applications with Java, JavaScript, HTML5, PHP, C/C++ and more. NetBeans IDE is FREE, open source, and has a worldwide community of users and developers.”

Eclipse IDE – used by the top CS programs in the country – https://eclipse.org/downloads/packages/eclipse-ide-java-developers/neon3

“The essential tools for any Java developer, including a Java IDE, a Git client, XML Editor, Mylyn, Maven and Gradle integration”

This package includes:

      • Git integration for Eclipse
      • Eclipse Java Development Tools
      • Maven Integration for Eclipse
      • Mylyn Task List
      • Code Recommenders Tools for Java Developers
      • Eclipse XML Editors and Tools

The goal today is to get both the JDK and the IDE up and running. I’ll update once I get that installed and discuss my plan for learning. Please comment with any suggestions or pros and cons, they would be much appreciated!

Why?

I have wanted to code since I was a kid. I got my first computer at 8 and taught myself rudimentary BASIC. I have always wanted to do more, really understand what it takes to program useful and meaningful software. You know, something beyond the “Hello World!”s and endless lines of “Will is cool!” running down the screen of a monochrome monitor. To this end I have decided to attempt teaching myself to code. I am going to start with Java as I have recently taken an introductory class and I feel like Java is a great language to start with due to its wide use and the many texts and tutorials available for free online. I thought about starting with Python as well, but settled on Java. I intend on documenting my trials and tribulations here along with laying out the path I will take and even posting coding problems, examples and ideas. When I have finished, should I be successful, I would like this blog to be a useful guideline to other non-traditional learners on how to go about teaching yourself to code, for free, online. My goal is to approach programming in such a way that I truly understand the nuances of different aspects of coding. I will attempt to discuss the language used by programmers and share the ways in which I was able to understand concepts. This is my preface, my next post will be about my overall plan and I’ll attempt to give this plan some structure in the short term.