CPT307 Newbie to Newbie Blog Part One

 Hello Class,

There are many advantages to object-oriented programming (OOP).  Four of the advantages are laid out in The Java Tutorials by Oracle.  They are modularity; information-hiding, code reuse, and pluggability (2022).

Modularity means that the code can be written in smaller sections.  Those sections can then be tested and debugged independently.  Once working, those sections can be shared among projects with programmers knowing exactly what they will get from each section.

Information-hiding can serve to protect an object from unwanted changes.  This can serve to prevent the wrong values from being assigned to objects that will cause problems later.

Code reuse, there is no need to reinvent the wheel.  Once an object is working, it can be endlessly reused in many new projects.

Pluggability, which allows for the sharing of objects as described above.  It also means that if an object isn’t working as desired, it can be debugged (as opposed to having to debug the entire project) or just replaced with another object that will work.

You can read more about this by reading the Oracle article at https://docs.oracle.com/javase/tutorial/java/concepts/object.html.  Oracle has provided a great resource for not just learning Java, but even installing it.  Using the link provided by the class leads to a great Oracle tutorial to help install and get going on Java at https://docs.oracle.com/javase/tutorial/index.html

As Oracle suggests, I did not attempt using command lines in Windows but instead downloaded the NetBeans IDE.  One hiccup I had was that a JDK needs to be downloaded and installed before installing the NetBeans IDE.  This was actually pretty simple and can be done at https://www.oracle.com/java/technologies/downloads/#jdk19-windows.

The Hello World program turned out to be too easy!  All I had to do was create a new project, which is just the button on the toolbar highlighted here by the red circle.

From there I followed the steps in the wizard and created a Java with Maven project.  I have no idea what that is, but it was recommended by the tutorial, so that’s what I did.

Once it was created, it came with some default code seen in the screenshot below.  The default code was a Hello World program, so there was actually nothing to program.

The reason that this was too easy is that there was nothing to learn here.  This would only be useful for Hello World programs, and since I don’t expect to need to keep doing this same project, I will need to learn how to actually program.

The one thing that I was able to learn is how to build a project and run a project as seen in the Run menu in this screenshot. 

I am definitely a newbie at Java (and programming in general).  Hopefully, this information is correct, but it is still a learning process for me.

John


References

Oracle. (2022). Object-Oriented Programming Concepts. The Java Tutorials. https://docs.oracle.com/javase/tutorial/java/concepts/object.html

Comments