N00B 2 N00B



Image result for noob noob
His name is Noob Noob, for those who, ironically, don't get it. 

I'm taking classes toward a Computer Software Technology degree and was tasked with creating the standard "Hello World!" program...after downloading the Java Development Kit (JDK) and an Integrated Development Environment (IDE). Which proved to be harder than I thought.

You know what they say about assumptions, right?
The links within the class took me to NetBeans which I have no experience with but I thought I recalled that Microsoft's Visual Studio supports Java development...

[Spoiler Alert] -> It doesn't. 


So Microsoft Visual Studio doesn't support Java, but Visual Studio Code does. As I'm not familiar with Visual Studio Code, though I'm sure it's wonderful, I opted for Eclipse at the recommendation of a friend.

But, I've gotten ahead of myself.

First you'll need the Java Development Kit (JDK) which allows developers to create Java programs that are executed and run by the Java Virtual Machine (JVM) which is created by the Java Runtime Environment (JRE).

Once you've downloaded and installed the appropriate JDK for your operating system (pay attention to 32 vs 64 bit versions for your OS of choice) you can move on to downloading or installing Eclipse

There are plenty of tutorials out there to guide you though your first HelloWorld program in the Eclipse IDE, but I thought I'd save you the trouble and share one with you.


That's great and all, but what's Java?

Well, you see, Java a class-based, object-oriented, general-purpose programming language that was developed by Sun Microsystems in the 1990s. It's designed so that developers don't have to write multiple version of the same application in different languages for different platforms.

Many of the applications you've used have likely been written, at least in part, in Java. In fact, it's still a top language today, and was the official language for Android mobile application development until Kotlin and Go came into the picture.

syntactically, it is very similar to C# (which is often criticized as a copy of Java). As such, it shares many common features with C and C++, which helped shape Java's creation.

Every time a meme is read aloud, a noob noob gets its wings...



Object-Oriented Design Principles

There are many object-oriented design principles to choose from, though at an introductory level, the 4 major object-oriented design principles are:
  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism
You'll come across these words a lot in discussing object-oriented programming, but fear not - they're really not too difficult to understand once you view them from a different perspective. But first we need to understand what an object is in this context, and to do that we need to look into how OOP came to be...

Early programming relied on procedural programming practices which broke down seemingly endless legacy code into manageable pieces of code. A procedure, or function, now could be written once and called form anywhere - saving a great deal of duplication. 

Then came the idea of modules - a set of functions and a data structure that those functions operate on. An object is the logical evolution of the module into a single entity which encapsulates data (values) and behavior (functions/methods that operate on the stored values). 

Encapsulation 

The concept of encapsulation is that an object encapsulates, or contains these values and functions/methods while also managing to abstract data away from all but those accessors and mutators which are appropriately permissioned.

Abstraction

Abstraction is a logical continuance of encapsulation. Suppose you -

yes! you. the person reading this.

                                                                                                               - were an object

YOU ARE

And I were to write a health app with a function which calculated your Body Mass Index (BMI) by measuring your height, weight, etc. The abstraction principle would have us do it differently. Instead of having me take your measurements, I can just ask you what your measurements were because you should know them. 

To understand why this is beneficial, let's take the BMI example except IRL. 

If you've ever been in the military, they really take Ford-era manufacturing concepts to heart. 

Instead of having one doctor do all this kind of measuring by hand, the Abstraction Principle would have the soldiers all already have calculated and stored their BMI in memory. Suppose there are 50 soldiers. 

Before you'd be waiting for 1 function to be carried out 50 times, necessitating the communication of multiple values and measurements for calculation (eating up CPU usage and memory making copies).

Now, applying the principle of abstraction, there would still be a call to all 50 soldiers - continuing the analogy, the doctor still has to ask. 

Inheritance

Inheritance is the major principle of object-oriented design which is probably the easiest to understand - especially by analogy. 

We're all relatively familiar with the high level taxonomy of life on earth. At the root of the taxonomy is life. From life we have flora (plants) and fauna (animals). From fauna we have reptiles, mammals, marsupials, etc. 

Eventually we get down to humans. All 50 soldiers are humans, but not all humans are soldiers. Similarly, all fauna are not human but all human are fauna. 

Inheritance is the principle of establishing either "is-a" or "has-a" relationships between objects. For instance every circle has-a circumference and every square is-a rectangle. 

By purposely applying these relationships, we're able to extend or modify the behavior and/or characteristics of one type of object to produce a specialized version of it. 

Polymorphism (many shapes)

Don't worry, its bark is worse than its bite. 


As is subtly included in the mini-header, polymorphism means many shapes. There are two kinds of polymorphism:

Static polymorphism in which methods are overloaded. Method overloading is when a class has more than one method of the same name but the methods take different parameters. Thus when a call is made for the method, the method with the matching parameter/argument list is selected. This is also called compile time polymorphism.

Dynamic polymorphism is when methods are overriden - meaning that a program has two methods with the same name and parameter list except that one of the methods is in the parent class and the other is in the child class. This allows a child class to have specific, tailored version of method inherited form their parents. Dynamic polymorphism is also called runtime polymorphism.



0 Comments:

Post a Comment