Tuesday, August 20, 2019

The History Of Java Philosophy Essay

The History Of Java Philosophy Essay Java is an object-oriented programming language developed by Sun Microsystems in 1991 and first released in 1995. Its development was led by the Green Team, managed by the flagship programmer James Gosling. In the beginning was to be called Oak, and there are many theories of why this name, being the most accepted the fact that there was an oak tree (Oak in English) against the Green Team office. That name turned out to be little commercial locations, apart from already having been registered. Finally, at the offices of Sun, it was decided to call it Java. In the beginning was conceived as a programming language oriented to system fixed and domestic appliances. This did not have the awaited success and under the expectations. The Web was the lever that drives this language with a technology called applets that were desktop applications that could develop into a web environment, through a plugin in any browser. This created a business strategy between Sun Microsystems and Netscape, creators of JavaScript. Java does not take long to reach the hearts of desktop programmers, providing a platform multiplatform and robust for developers. In its beginnings left much to be desired in the graphical interface, because the original graphics library, AWT (Abstract Window Toolkit), was much attached to the operating system and engaged in targeted bugs, that is to say, bugs specific to each operating system. This is a nightmare for any developer, since it is forced to test their application on each operating system. But with the appearance of Swing, the current library of graphical user interface, all these problems were solved. However, the biggest market of Java now is aimed at server applications, offering in the platform J2EE a wide range of tools to develop secure systems, scalable and robust. Java, rather than a programming language, was developed considering a technology or framework. Three different flavors are distinguished, each focused on a specific need: J2ME: Java Micro Edition, destined for develop mobile applications. It is developed considering the limited resources that have a mobile device. J2SE: Java Standard Edition, for the world of desktop applications. It is the core of the language; containing the base of the API (Application Programming Interface) this offers us. J2EE: Java Enterprise Edition, for the systems business. It is built on J2SE, but with the addition of a large security API, giving the developer all the tools necessary. Today Java is present in every field of modern programming, from phones to biggest servers, but the secret of its success, beyond the great API that offers and its syntax, has been the JVM (Java Virtual Machine), the key piece in this masterpiece. It is responsible for interpreting the bytecode and executes the statements. It also contains the Garbage Collector, a collection of resources unattainable in the application, which allows the developer to concentrate on the logic, and worry less about the memory leaks. What is Java? Ok, we saw the history of Java, but what is Java? In theory is defined as a multiplatform language and object-oriented, but these are terms that only a technical person can understand. In plain and simple terms, Java is a programming language able to run on any operative system and implements a paradigm that facilitates the maintenance of the application. Java, like any programming language object-oriented, depends on Classes and Objects. A class is nothing more than a template from which an object is created. But once again, this can only be understood by a technical user. In plain words, a class is a blueprint from which it is possible to construct a building. We know that from a class we can construct an object, but what is an object? Simple, an object is an instance of a class. Following our previous example, a building would be an object (since it was built from a plane). The objects in the real world have attributes and functions. For example a human being is an object with several attributes: color, weight, height, attitude, and also has several functions: eating, walking, talking, etc. The same concept applies to objects in Java; an object has attributes and functions. Attributes describe the object and functions are the actions that objects can execute. For example, the object calculator may have the attribute buttons and the function add. We have already seen part of object-orientation, but what can be a multiplatform? To explain this concept we have to introduce another: machine code. For machine code we refer to instructions a computer can understand. The disadvantage is that code should be written individually for each operative system; so for example if we develop an application in machine code, we have to write that code different ways according to the operative system. Here comes into play our friend multiplatform. When we say that a language is multiplatform, refers to the fact that the same code runs on any operative system. Yes, only be developed once and our application will be able to run on any platform. Java: Syntax We already know the story and what is Java, but how to use Java? Before this, we should know talk java; we must know its syntax. Syntax is the set of laws and regulations must be followed when we are developing in Java. It is a lot like the spelling rules which exist in all human language. In all syntax of any programming language there are keywords or reserved words. What is this? Nothing more than words reserved by Java for personal use and therefore the programmer can not use it in his code. These keywords are: abstract continue for new switch assert default goto package synchronized boolean do double private this break double implements protected throw byte else import public throws case enum instance of return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while Each of these keywords serve a function in Java, but we will them see later. As we saw previously, Java is object oriented, so has attributes and functions. In the world of Java these are called variables and methods. A variable is a reserved space of memory, that means a data container. Each variable must have a data type. A what? A data type is what kind of values à ¢Ã¢â€š ¬Ã¢â‚¬ ¹Ãƒ ¢Ã¢â€š ¬Ã¢â‚¬ ¹this variable can hold: numbers, characters, Boolean, dogs, cats, etc. The syntax for declaring a variable in Java is: [access modifier] [behavior modifier] [datatype] [name] Later we will see what each one of them is about. We saw the variables or attributes, but what about functions? From now on we will call them methods. One method is a block of code to be executed in an orderly and sequential way. The syntax for declaring a method in Java is: [access modifier] [behavior modifier] [return type] [name] [parameters] [exceptions] [body of the method] Again, do not worry about knowing what that means for now. We have seen the objects, but it is time to see the classes. As noted above, a class is a template from which an object is created, therefore, the class must contain all the information that describes the object. The syntax for declaring a class in Java is: [access modifier] [behavior modifier] [name] [body] Java: Access Modifiers Previously we saw these words repeated several times, access modifier, but what is this? From a technical point of view, these are restrictions that attach to members of a class, access restrictions, meaning, who can and who cannot access them. In Java there are four access modifiers, and three of them are keywords of the language: public, protected, private and default. default modifier: This is the modifier that assigns the virtual machine to any member if no one has been told directly. This modifier restricts use of the member only classes that are declared inside the same package as this one. public: Is the modifier most permissive of all, because gives to the member access to any class declared with this switch. protected: Is the second most permissive. It is identical to the modifier by default, only extending access to any class that inherits from the class containing the member. Inherit? Yes, classes can be inherited, but we will see later. private: Is the modifier most restrictive of all. A member declared with this modifier can only be accessed from within the class. As mentioned above, public, protected and private are keywords in Java and can not be used as identifiers, that is, as class names, variables or methods. Java: Behavior Modifiers I assume the name is very intuitive, these modifiers act on how in which a member behaves. In total, they are seven and are also keywords of Java. These are: static: When a member is declared as static, ceases to belong to an instance of an object and becomes part of a class. abstract: When a member is declared as abstract, this member will lack of implementation and will take only a signature. synchronized: When a member is declared synchronized, this member will restrict his access to only one thread at a time. strictfp: When a member is declared with this modifier, floating point values à ¢Ã¢â€š ¬Ã¢â‚¬ ¹Ãƒ ¢Ã¢â€š ¬Ã¢â‚¬ ¹shall be governed by a set of special rules and will depend on the implementation of each Virtual Machine. volatile: Changes made à ¢Ã¢â€š ¬Ã¢â‚¬ ¹Ãƒ ¢Ã¢â€š ¬Ã¢â‚¬ ¹to a volatile member is effective only if each of them go into effect, that means, if the value is changed three times, these three changes come into effect only if the three changes go into effect. native: A member declared as native will possess the body of its definition in machine code. final: This indicates what value of a member can not be changed. Java: Data types We mentioned previously a data type refers to what types of values may contain a variable. In Java there are primitive data and reference data. Primitives are those that are not defined in a class; and reference is the contrary, are those that are defined by a class. All primitives are keywords in the language and are the following: byte: Refers to a whole numeric value with a limit of 8 a short: refers to a whole numeric value with a limit of 16 bits int: refers to a whole numeric value with a limit of 32 bits long: refers to a whole numeric value with a limit of 64 bits float: refers to a decimal value with a limit of 32 bits double: refers to a decimal value of 64 bits char: refers to a character and has a limit of 32 bits boolean: refers to a Boolean value, that is two states. Reference types can be any existing class in the Java API or defined by the user. Java: Our First Steps We have mastered the theory, but go to practice. We know the syntax to declare a class and its members so here we go: public class HelloWorld { private final int number = 5; public static void main (String [] args) { System.out.println (number); } } All this should go in a document with the same name of the class and end in (. java), in our case would be a document HelloWorld.java We have just seen the most basic example, a class declared public with the name HelloWorld. It contains a private variable and constant, a public and static method, which sends to print on console the value of the variable number. But writing this code is not enough, we must now compile. Java offers a set of tools for developers called JDK (Java Development Kit) and these include a compiler. To compile this code we go to a console and type: javac HelloWorld.java To run our code we must use another tool found in the JDK: java

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.