Skip to main content

Java: A Powerful Programming Language






What is Java?

Java is used by the top 95% of all employers worldwide to build mission-critical systems. Because of this demand, Java is widely embraced by the education community. Amongst its many features, Java is object-oriented, is written once and runs on any device, has built-in multi-threaded programming, an integrated UI library, and a rich ecosystem maintained by developers worldwide. For this and many other reasons, Java continues to attract educators. Java continues to evolve to meet the growing industry trends. (JavaCommunityProcess, n.d.).

How to get started with Java

An easy way to start with Java is to get an IDE suitable for using the language. As a suggestion, visit https://www.eclipse.org/downloads/ and download the most suitable package for your device. Once the IDE is downloaded, you can run the setup file from the folder it is downloaded to (in Windows, downloads typically go to the downloads folder). Once the setup is done, run the application! When it starts, it will offer a few quick “cheat sheets” that are tutorials for setting up some beginner programs, such as printing out “Hello World!” Suppose you do not have a book or resource dedicated to instructing beginners in Java (or any language). In that case, I have also used stackoverflow.com, Geeksforgeeks.com, and tutorialspoint.com to get help from other experienced programmers. I often turn to one of these forums if the leading resource for learning a language becomes confusing or a program will not compile or run as expected. There is no shortage of programmers willing to exchange information on the Internet. It is advantageous to remain humble, use your favorite search engine (such as Google or Yahoo), and search for any question about your programming. Programming can be very challenging, but it does not have to be impossible.

Getting Used to Terminology

Class & Object – What’s the difference?

With object-oriented programs (OOP), it is essential to know a few terms. To illustrate through example, I will use a common Legend of Zelda enemy known as the Moblin. The term class and the term object are similar. They can both have a state and a method. The state refers to attributes such as height, color, strength, and defense. In comparison, the method relates to an action such as running, walking, jumping, or attacking. The class will refer to the Moblin in general. It can have any states or methods listed in the original class. The object is then the implemented class, where the state and methods can be altered from how they were defined in the class. When an object is used in an application, it is considered an “instance of the class of objects known as [Moblins]. A class is a blueprint from which individual objects are created” (Oracle, 2015, Section: What Is a Class?)

Inheritance – Not a blessing from a passed loved one (but close).

Inheritance is another common term that allows a class to extend to a superclass. Consider a Moblin that is purple and carries a club for the attack (we will specify this as a Purple Moblin) and a Moblin that is red, a bit larger, and wields an axe (we will specify this as a Red Moblin). The original class of Moblin might not have the state that defines the weapon, but it does have color and height. The superclass can then inherit all of the attributes for a Moblin, allowing new states or methods such as the weapon type and how the weapon is used, respectively (swing, jab, etc.). So, while this is not similar to receiving dear Uncle Jim’s priceless pea coat, it is similar to genetic similarities between families – some of the characteristics are repeated, and some are different.

Interface – How actions for a class are enforced.

Interfaces are methods by which an object must be considered an “x.” In this blog, that is a Moblin. “No VARIABLES are allowed to be declared by the interface. An interface is about actions that are allowed, not data or implementation of those actions” (Germain, n.d., Section: Interfaces in Object Oriented). “An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object (class)” ” (Germain, n.d., Section: Interfaces in Object Oriented).

Package – As much as I love them, these are not the items delivered by internet shopping.

A package is a namespace (an abstract container or environment created to hold a logical grouping of unique identifiers) used to group common classes and interfaces (Oracle, 2015, Section: What is a Package?). In Java, packages are readily available for the programmer, including classes and interfaces common in programming, known as Application Programming Interfaces or APIs.

Four Principles of Object-Oriented Programming: Encapsulation, abstraction, inheritance, and Polymorphism

Encapsulation involves accessors and mutators, which can inquire about or alter the states and methods of a class. Encapsulation is then the protection of these accessors and mutators from the rest of the program so that they do not get changed unintentionally. “In a nutshell, encapsulation is the hiding of data implementation by restricting access to accessors and mutators” (Raymondlewallen, 2005, Section: Encapsulation). Abstraction is similar to interfacing in that it breaks down an object into parts without which it would not be. Inheritance, we discussed briefly, is the characteristic (state or method) that objects share. Polymorphism Polymorphism is one name, and it has many forms (Raymondlewallen, 2005, Section: Polymorphism). Relating to OOP, it is like the Moblin class, from which the objects Red Moblin and Purple Moblin are created. They share some states and methods, but not all. This principle intertwines with interfacing, inheritance, and abstraction.




References

Germain, J. (n.d.) Interfaces. School of Computing University of Utah. https://users.cs.utah.edu/~germain/PPS/Topics/interfaces.html#:~:text=An%20interface%20is%20a%20programming,on%20an%20object%20(class).

JavaCommunityProcess. (n.d.) Java in education. https://www.jcp.org/java-in-education

Oracle. (2015). The Java tutorials: Lesson: Object-oriented programming concepts. Retrieved from http://docs.oracle.com/javase/tutorial/java/concepts/index.html

Raymondlewallen. (2005, July 19). 4 major principles of object-oriented programming [Blog post]. World Documents. https://vdocuments.net/4-major-principles-of-object.html



Comments

Popular posts from this blog

Information Technology and Technology Literacy

  IT and Its Relation to Technology Literacy and Technology History Information Technology is a career field centered around technology literacy. IT involves computer hardware, software, programming, architecture, security, database, developers, network and system administration, and IT leadership (Aha!, n.d.). “Information Technology refers to the management and use of information using computer-based tools. It refers to both hardware and software. Mostly, it is the term used to refer to business applications of computer technology rather than scientific applications” (Mathew & Murugeshon, 2013, p. 15, para. 1). The need for IT could be said to have started in the 1990’s “The information age just began in the 1990's, with human activity shifting from traditional industry to creating/managing/using computerized information” (Vahid & Lysecky, 2019, Section 1.1, Para. 3). Considering that IT has fields that manage data such as a Big Data Engineer (a type of data considered to...

Using the Scratch Programming Language

  The Scratch Language Programming Experience Scratch is a building block for beginner programmers. It is considered a visual programming language and helps the programmer learn to use conditional logic, systematic reasoning, and program creativity (Integrating Computing, n.d., p. 1, para. 1). I created an interactive program that allows the user to manipulate multiple sprites simultaneously by using various inputs from the keyboard. The outcome was to enable the user to make a set of three cats appear to dance. Once I got used to the language, I had fun with it. Difficulties, Solutions, and Insight Gained from Using Scratch Learning any new language or platform is easier once the general idea of the layout is understood. Once I understood the layout of the IDE, the next difficulty was testing to see how connecting blocks, clicking on blocks, and editing blocks affected the sprites. There were some functions I would have to view the tutorials for, such as the if-then statements. Th...

The Necessity for Computer Literacy in the Workplace

The Functions of Computers in Manufacturing and My Personal Experience With Them. I have worked in the manufacturing industry for 18 years. For ten years, I compression molded fiber-reinforced thermoset polymers (fiberglass matting and thick liquid resin mixed with colors and other chemicals, then pressed them into shapes at high temps to cause the liquid resin to cure and harden). Then I switched to the CNC industry, where I found automation and was fascinated by the potential of some of the devices. Many of the devices that make automation possible are unique and have unique types of Operating Systems and IDEs that make implementation difficulty range from easy to moderate. We rely on Microsoft Windows-based products for PCs with a more common OS. A prominent program that we use on PC is called Plex. Plex allows information to be transferred around at all the computer stations, both plant-wide and from locations outside the plant. However, access from outside the plant is only grante...