Menu

Java_Fundamentals

Gregory M Lyon Jay Jay Billings Dasha
There is a newer version of this page. You can find it here.

A comprehensive overview of fundamental computer science terms and Java programming concepts. External links are provided in case of special interest in a particular topic. With specific programming definitions/keywords, please note that this article explains the fundamentals of Java, and many of the external links point to Wikipedia, which will usually be generalizing on behalf of all languages.

Computer Science Terminology

General

API: Application Programming Interface. The specification of how a programmer writing an application accesses the behavior and state of classes and objects.

Compiler: A program to translate source code into code to be executed by a computer. The Java compiler translates source code written in the Java programming language into bytecode for the Java virtual machine.

Expensive: Heavy loads of computational work.

JavaDocs: A documentation generator from Sun Microsystems for generating API documentation in HTML format from Java source code.

JavaSun: Oracle's java support website, an excellent resource for tutorials and definitions.

JFace: A UI toolkit that provides helper classes for developing UI features that can be tedious to implement, operating above the level of a raw widget system.

JSP: JavaServer Pages technology provides a simplified, fast way to create dynamic web content.

Logging: Using or controlling the process of a computer to collecting data through sensors, analyzing the data, and saving and outputting the results of the collection and analysis.

Processors (XML Parsers): Analyzes the markup and passes structured information to an application.

  • DOM: Document Object Model, parses an entire XML document and load it into memory, modeling it with Object for easy nodel traversal. DOM Parser is slow and consume a lot memory if it load a XML document which contains a lot of data.
  • SAX: Simple API for XML, does not load any XML document into memory, the SAX parser uses a callback function to inform clients of the XML document structure.

Pipes: Common source or destination of data, providing the ability for two threads running in the same JVM to communicate.

Reflection: The operation to access private methods and fields.

SQL: Structured Query Language. The standardized relational database language for defining database objects and manipulating data.

  • Connectors: Java database connectivity (JDBC) is an industry standard for database-independent connectivity between the Java platform and a wide range of databases. The JDBC provides a call-level API for SQL-based database access.
  • Access: Connect to a data source. Send queries and update statements to the database. Retrieve and process the results received from the database in answer to your query.

SWT: An open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.

System Call: A mechanism to execute command line commands from an application. These provide the interface between a process and the operating system. This may include hardware related services, creating and executing new processes, and communicating with integral kernel services.

Abstract class: A base class that passes general shared methods with no implementation down to other classes.

Argument: A data item specified in a method call, passed as a parameter. An argument can be a literal value, a variable, or an expression.

Assign: To throw away the old value of a variable and replace it with a new one.

Behavioral: Characterize the ways in which classes or objects interact and distribute responsibility.

Block: A sequence of statements, local class declarations and local variable declaration statements within braces.

Casting: Explicit conversion from one data type to another.

  • Upcasting: Permits an object of a subclass type to be treated as an object of any superclass type.
  • Downcasting: Permits an object of a superclass type to be treated as an object of any subclass type.

Class: The blueprint for an object to be instantiated from containing attributes, data structures, and methods. This is also a Java keyword, and cannot be used as the name for a variable.

Composition: Creates an object of another class to use. (A “has a” relationship.)

Creational: Involved with the process of creating objects.

Database: A structured set of data held in a computer, esp. one that is accessible in various ways.

Declare: A declaration states the type of a variable, along with its name. A variable can be declared only once. It is used by the compiler to help programmers avoid mistakes such as assigning string values to integer variables. Before reading or assigning a variable, that variable must have been declared.

Encapsulation: Keeps data hidden and allows for adaptability through organization / code reuse.

Enumerations: Identifiers that behave as constants in the language.

Garbage Collection: The automatic detection and freeing of memory that is no longer in use. The Java runtime system performs garbage collection so that programmers never explicitly free objects.

Heap: Global memory, runtime data storing objects and class level variables.

Inheritance: Creates a derived subclass as an extension of a superclass. (An “is a” relationship)

Initialize: A special kind of assignment: the first. Before initialization objects have null value and primitive types have default values such as 0 or false. Can be done in conjunction with declaration.

Inner (or Nested) Class: Class whose only application is within the scope of its parents class.

Instantiate: To create a new instance of an object, i.e. to realize it.

Interface: An implicitly abstract type that classes must implement, used to define a contract for how classes interact with an object.

Intrinsic lock: Responsible for enforcing exclusive access to an object's state, and establishing happens-before relationships that are essential to visibility in synchronization.

Method Overloading: Using one identifier to refer to multiple items in the same scope. In the Java programming language, you can overload methods, but not variables or operators.

Object (or Instance): An encapsulated entity based on a class blueprint.

Object Pooling: When a process needs an object, it checks out a copy from an object pool rather than instantiate a new one. The process then returns the object to the pool when it is no longer needed.

Overriding: Providing a different implementation of a method in a subclass of the class that originally defined the method.

Polymorphism: The ability to create a variable, a function, or an object that has more than one form.

Proxy: A system that acts as an intermediary for requests between clients and servers. Also a class functioning as an interface to something else.

Refactoring: Altering a body of code's internal structure without changing its external behavior. Most commonly used in reference to renaming a plugin, package, class, or variable.

Search: Using an algorithm find data.

Sort: Using an algorithm to organize data.

Input/Output

Compression: Many sources of information contain redundant data or data that adds little to the stored information, and one method to alleviate a portion of data storage and information transfer is through the representation of data by more efficient code.

Creating Files: You can create a file, append to a file, or write to a file by using the newOutputStream(Path, OpenOption...) method. This method opens or creates a file for writing bytes and returns an unbuffered output stream.

Encryption: The process of transforming information using an algorithm (cipher) to make it unreadable to anyone except those possessing special knowledge to decrypt the information with a specific decrypting algorithm.

I/O: Refers to input and output. Input is the data the computer takes in, and output is the data the computer gives back.

Readers/Writers: Work much like the InputStream and OutputStream, but Reader and Writer are character-based rather than byte-based. They are intended for reading and writing text.

Serialization: The encoding of objects, and the objects reachable from them, into a stream of bytes and the complementary reconstruction of the object graph from the stream.

Stream: A sequence of data, representing many different kinds of sources and destinations.

Memory & Performance Optimization

Benchmarking: Comparing two or more operations' performance (memory, speed, etc.)

Iteration: Has the same effect of recursion, except that because iteration uses loops and pointers, it leads to amuch better use of memory. The overhead does not have to handle ______. Also the stack does not have to continuously grow with each cycle from re-initializing all the variables, returns, etc. Overall, iteration uses less memory and is faster because it does not have to waste time storing variables within its block.

Memory leak: Simply allocated memory that was not released when it was supposed to be, leading to continuously raising levels of memory consumed. Normal behavior is for the memory to be allocated (raise in consumption level), then to fall again when the memory is released.

Profiler: Used to determine hot spots (areas of heavy computational load) are located in the code. Once located, these allow for performance optimization tweaks or bug fixes.

Recursion: The act of calling back the same process once that process is fully executed. This stores overhead and stacks very inefficiently, and will lead to crash or system failure. This can easily be replaced by iteration in the form of pointers or while loops.

  • tail: Calling back from the end of the method.
  • head/body: Calling back from the beginning/middle of a method.
  • mutual: Calling between two methods that are defined in terms of one another.

Resource Contention: A contention event occurs when a function in a thread is forced to wait for access to the resource because a function in another thread has acquired exclusive access to the resource.

Networking

Client Server: A computing model that acts as a distributed application which partitions tasks or workloads between the providers of a resource or service, called servers, and service requesters, called clients.

Distributed Application: An application made up of distinct components running in separate runtime environments, usually on different platforms connected through a network. Typical distributed applications are two-tier (client/server), three-tier (client/middleware/server), and n-tier (client/multiple middleware/multiple servers).

Socket: an endpoint of a bidirectional inter-process communication flow across a computer network

TCP/IP: Transmission Control Protocol based on IP. This is an Internet protocol that provides for the reliable delivery of streams of data from one host to another.

NiCE Team Terms

Hashing: Any algorithm or subroutine that maps large data sets, called keys, to smaller data sets.

JAXBY /JAXRS: Java architecture for XML bindings.

Maven: Software to more easily build projects with their own Ant builds and JARs.

NiCE: An integrated computing environment for nuclear simulation, providing features that allow for large simulations to render on a separate server while providing all GUI elements on a local client with universal web access (using Visit by default to handle the data processing for the images). It works across any standard OS, many machines (including android), and provides a unified set of frameworks to make data simulations across the scientific community easily shareable.

Reference: A variable data type in which the variable's value is an address.

VisIt: A visualization software that can process very large sets of data.

Parts of the Computer

CPU: Central Processing Unit. Performs basic arithmetical, logical, I/O, on a large scale. This does not process small amount efficiently, rather the large chunks of data is its specialty.

Hard disk drive: For storing and retrieving digital information, a RAM device.

JVM: Java Virtual Machine. A virtual machine is a software implementation of a machine that will execute a program like a machine. The JVM will specifically be for executing Java bytecode. This is an essential part of Java, because it makes it a “run anywhere” program rather than a “compile anywhere” program.

OS: Operating System. The software that supports a computer core functionality, i.e. Linux, Unix, Microsoft Windows XP, Mac, etc.

RAM: Random Access Memory. Integrated circuits that allow stored data to be accessed in any order with a worst case performance of constant time.

User Interface

The user interface is the part of your program that is visible to the user, and with which the user may interact.

Event Handling: The process of a program reacting to external events, such as the user clicking the mouse or typing something. Objects called Listeners react to events.

GUI: Graphical User Interface. Refers to the techniques involved in using graphics, along with a keyboard and a mouse, to provide an easy-to-use interface to some program.

MVC: Model View Controller.

  • Model: The data management center, can have any number of V/C's
  • View: The presentation (UI [User Interface] which can be GUI [Graphical UI], audio turning on air conditioning,etc.)
  • Controller: Gathers input from the world and tells model what it needs to change.

Layering: Having several components that make up the UI. This is necessary if user interactions must take place.

Use Case: A single task, performed by the end user of a system, that has some useful outcome.

Z-Order: This determines the order in which windows appear on the screen--how they overlap.

Basic Coding

Parts of Code

Access Control Modifier: The umbrella term for keywords that determines the visibility of the class--as the following chart explains:

Class Package Subclass World

Public
Y
Y
Y
Y

Protected
Y
Y
Y
N

Package
Y
Y
N
N

Private
Y
N
N
N

Classpath: An environmental variable which tells the Java virtual machine and Java technology-based applications where to find the class libraries, including user-defined class libraries.

Constructor: Initializes the already constructed (created) object, called right after memory is allocated for the object. Has no return (not even void) and has same name as the class.

Fields: A data member of a class. A field is not static by default

Library: A set of dynamically loadable libraries that Java applications can call at runtime.

Main(): A method in the controlling class used to initialize the program.

Method: A piece of a class, used to implement actual pieces of code

Method Signatures: Collection of information about the method including name, visibility, type(static or not), its arguments, and return type

Package: A group of types (class or interface), and are declared with the package keyword.

Keywords

A complete list of Java's (currently) 50 keywords can be found here, but there are some of the more basic ones.

abstract: A modifier used in a class or method definition to specify that it is not to be instantiated, but rather inherited by other classes.

final: This modifier commits you to defining an entity exactly once. You cannot change it or derive from it later. More specifically: a final class cannot be subclassed, a final method cannot be overridden, and a final variable cannot change from its initialized value.

instanceof: A two-argument Java keyword that tests whether the runtime type of its first argument is assignment compatible with its second argument.

new: creates a object, reference, primitive, etc., and adds it to the memory.

static: This keyword can modify methods or classes, and designates them as having only one instance. Static members belong to the class rather than to a specific instance.

this: A keyword that can be used to represent an instance of the class in which it appears; "this" can be used to access class variables and methods.

Variables

Every type of variable possible to use in Java has its own keyword. A local variable is given local scope and is accessible only from the function or block in which it is declared, while a global variable is accessible everywhere in the project. Global variables should be used carefully, because they can lead to shadowing and other confusion, as well as continuously allocating memory, which is wasteful.

Primitive variables, or data types are built in to programming languages, often remaining consistent across many languages. Often, the variable's value is of the appropriate size and format for its described type. Here are the most common ones--all of them exist in Java:

boolean: Booleans can only have two values: true or false. This data type is mostly used to track conditions for logic statements (such as if...then...).

char: Chars each use one character, but you can use an array of chars (char[]) to form a String. Not all languages use char variables, as a String will often suffice. The essential difference is that arrays of chars must be micromanaged and is often used to represent code units, while a String is much easier to work with and frequently used for labeling.

double: Doubles are the usual choice for decimal numbers.

float: Used for non-integer numbers, but its range is less precise than a double's.

int: An integer number value. There are also a few subcategories:

  • byte: The byte data type has the most limited range, with a minimum value of -128 and a maximum value of 127 (inclusive). However, if an integer in your code should always be within that range, then using bytes is a great way to save memory.
  • long: A long integer is at least 32 bits. Predictably, it is the short integer's opposite. It takes up more memory, but accommodates a wider numerical range.
  • short: A short integer is at least 16 bits. It must be kept within a smaller range compared to a standard integer on the same machine, but it takes up less storage, so it's convenient to use if memory capacity is an issue.

String: Strings are used for characters (most often words, phrases, etc.).

Common Data Structures

ArrayList: Implementation of the List interface used to hold data linearly.

Data structures are the main mode of organizing and storing data in Java.

Hash Table A record of key-value pairs.

LinkedList: Implementation of the List interface where each piece within the list recognizes the directly surrounding pieces. The LinkedList is efficiently used with binary algorithms for sets of data that only need to be walked through once.

Node: A record consisting of one or more fields that are links to other nodes; used to build linked, often hierarchical, data structures such as linked lists and trees.

Shutdown Hook: Shutdown hooks may be added to threads. They ensure that certain code is executed even if the user suddenly tries to shut down the program. This is especially useful if you want certain information always to be saved.

Tree: A data structure that emulates a hierarchical tree structure with a set of linked nodes.

Vector: Synchronized implementation of the List interface.

Error Handling

catch: A Java keyword used to declare a block of statements to be executed in the event that a Java exception, or run time error, occurs in a preceding 'try' block.

finally: A Java keyword that executes a block of statements regardless of whether a Java Exception, or run time error, occurred in a block defined previously by the try keyword.

try: A Java keyword that defines a block of statements that may throw a Java language exception. If an exception is thrown, an optional catch block can handle specific exceptions thrown within the try block. Also, an optional finally block will be executed regardless of whether an exception is thrown or not.


Exception: The customary way in Java to indicate to a calling method that an abnormal condition has occurred. In Java, exceptions are objects.

Exception Handler: A block of code that reacts to a specific type of exception. If the exception is for an error that the program can recover from, the program can resume executing after the exception handler has executed.

Exception Hierarchy: Only objects descending from the Throwable class may be thrown. Two direct descendants of this class are Exception and Error.


Global Exception Handling: Rather than sprinkling try/catch blocks throughout your applications they can all be managed at one location. The first step is to define your own UncaughtExceptionHandler implementation class. The second step is to set the default uncaught exception handler.

Controlling Flow

for: A loop that has a set number of iterations set by the programmer.

if-else: An operation used to say if A happens then B happens, else C happens.

loop: Repeats a specified section in the code according to a state or predefined number set by the programmer.

switch: a certain kind of if statement that allows many choices to be chosen from rather than just two (if or else).

while-do: A loop that continues to iterate over a section while a certain state or property exists. So, while A is true, do B.

Equality

compare(): For comparing values.

compareTo(): Compares values returning int less than, equal, or greater than.

equals(): Will return true if two objects have the same value.

Equality: One way for primitives, four for objects

a==b, a!=b: Will only be true if two references point to the same underlying object.


Equivalence: When !(a


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.