Adrian's Newbie to Newbie Conversation CPT 307
This first assignment was difficult I had a hard time install any of the IDE’s for making the program. The Java Development Kit (JDK) from oracle was straightforward to install; I just downloaded the exe file and then followed the wizard. Installing NetBeans was a whole different story; when you go to the site, there are several options that you have to choose to download, I downloaded the package that was needed. Then attempted to make the “Hello, my name is program” this should have really been simple but was proven to be difficult. I have a look at videos and read the book and some other tutorials, and it was still having some issues, so after walking away for a bit (and praying that I don’t lose my mind lol). I did find a YouTube video helpful for me to use NetBeans IDE to make the “Hello, my name is program.” Java seems similar to python, but I am not sure why coding in Java is not working for me. So for the next five weeks, I am going to go with the NetBeans IDE to complete the assignments.
The first page that I went to was
the “Object-Oriented Programming Concepts” page on docs.oracle.com. This page is the basic tutorial on OOP and
describes principles that you need to program in Java successfully. The page describes an object, a class,
inheritance, an interface, and a package.
When perceiving the world, a person can quickly identify many real-world
objects. Each object shares two
characteristics: state and behavior. A
pet can have stated (name, color, breed, any valid descriptor) and behavior
(barking, fetching, any valid action).
Like real-world objects, software objects also consist of both state and
behavior. When a software object stores
state, the state is stored in fields or variables. Its methods or functions determine the
actions of a software object. Methods
operate on an object’s internal state and serve as the communicator between
objects. The site describes data
encapsulation as when an internal state is hidden, and all interaction is
performed through an object’s methods.
Encapsulation is a fundamental principle of OOP. Next, the tutorial explains what a class
is. In the physical world, you can
observe many different objects of the same type.


In OOP, we can say that a Toyota
is an instance of the class of objects known as cars. The class is the blueprint out of which
individual cars will be created. Next is
an inheritance, where it begins by stating that in the Java programming
language, there can be one direct superclass for any regular class. When using the example of motorcycles, the motorcycle
class can be a superclass. The
subclasses of a bicycle can be sports Bike, Cruiser Bike, and Sport-touring
Bike. Each subclass will inherit
specific properties that belong to all bicycles, but each subclass can then
also define the properties that make it unique compared to any other bicycle
subclass. Next, the tutorial states that the blank methods of an object from
the object’s interface. The interface
determines how the object will interact with the rest of its program. Finally, the tutorial defines a package as a
namespace that organizes related classes and interfaces.
The second article that I read was “4
Major Principles of Object-Oriented Programming.” The article describes the four major
principles: Encapsulation, Abstraction, Inheritance, and Polymorphism. The article describes encapsulation as ‘…the
hiding of data implementation by restricting access to accessors and mutators.” Following the definition, the article
elaborated on the definitions of both the accessor and mutator. An accessor is defined as a method that is
used to ask an object about itself. When
an accessor is related to OOP, the accessors are usually used to view
properties that belong to an object. In
programming languages, the get method is an accessor method. The article then describes what a mutator is,
giving the definition “…public methods that are used to modify the state of an
object while hiding the implementation of exactly how the data gets
modified.” In a similar way to
accessors, a mutator method interacts with the properties of an object. In programming, a set method is an example of
a mutator. So mutator method will change
the value of the property it is being called by. Abstraction is an attempt to simplify a
program by concentrating on developing classes, objects, and types in terms of
their functionality and interfaces.
Abstraction is a model, view, or other representation of an object
rather than how an object is implemented.
Abstraction is the name of an object, while the implementation details
are the actual lines of code for the object. Then, the article moves on to
inheritance. When an object is created
with inheritance, it will inherit defined properties from its parent
object. A folder will inherit the
properties and permissions of the folder it is inside of in a file system. Inheritance also helps to simplify
coding. By only having to name
properties once and then transferring those properties to other objects, the
code will be simplified by eliminating duplication. Polymorphism is used to define how one task
can be performed in multiple different ways.
For example, the task “to speak something” can be accomplished by “a cat
speaks meow, a dog barks woof, a human speaks words.” Java achieves polymorphism by using
overloading and overriding methods.
Among all of the articles, OOP is a way to
keep programming software modular and easily adaptable. At the same time,
procedure-oriented languages get exponentially more challenging to manage as
the number of code changes and grows.
OOP also provides a way to hide data, versus procedure-oriented, that
allows global data to be accessed from anywhere. Actually, I am not entirely sure what
procedure-oriented languages are, and I will definitely need to do my own
research to identify the real differences.
References:
Black
Tech Enterprise, Hello World (Beginner Program) using Java and Netbeans 11, https://www.youtube.com/watch?v=hMbanfqvtYs
Java
OOPs Concepts - Javapoint. (n.d.). October 17, 2018, from https://www.javatpoint.com/java-oops-concepts
Lesson:
Object-Oriented Programming Concepts. (n.d.). October 17, 2018, from https://docs.oracle.com/javase/tutorial/java/concepts/index.html
Lewallen,
R. (2005, July 19). 4 major principles of Object-Oriented Programming. October
17, 2018, from http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-object-oriented-programming/
Lysecky,
R., Vahid, F., Lysecky, S., & Givargis, T. (2015). Data structures
essentials. Retrieved from https://zybooks.zyante.com/#/zybook/DataStructuresEssentialsR25/chapter/1/section/3
NetBeans
(Links to an external site.). (https://netbeans.org/)
Oracle. (2015). The Java tutorials (Links to an external site.).
Retrieved from http://docs.oracle.com/javase/tutorial/index.html
Shaffer,
C. A. (2013). Data structures and algorithm analysis (Links to an external
site.) (Edition 3.2). Retrieved from http://people.cs.vt.edu/~shaffer/Book/JAVA3elatest.pdf
Tutorials
Point. (2016). Java tutorial (Links to an external site.).
Retrieved from http://www.tutorialspoint.com/java/index.htm
Comments
Post a Comment