Wednesday, September 4, 2019
History and Development of Programming Languages
History and Development of Programming Languages Yash Ojha Introduction Programming languages play the most important role in the creation of variousà Softwareââ¬â¢s. Application, and Webpages etc. Just because of the existence of programming languages today everything related to New Technology is possible. For example the various Social Networking sites that we use is a result of Programming Language, the Mobile phones that we use in our daily life is a brilliant outcome of programming as every IC in the circuit of the mobile phones are programmed due to which it works. The most important outcome of Programming Language is the creation of Operating Systems (OS). OS is something without which we cannot use our PCââ¬â¢s or Laptopââ¬â¢s or even our mobile phones. OS acts as a base for every single function of a device to work in short it provides an important platform for the working. If no programming languages were introduced then today it nearly impossible for the people to use computers, mobile phones, servers, and various other things. But thanks to the developers of the various types of Languages that made peoples life very easy and mobile. 1 All about JAVA! Java was developed by James Gosling at Sun Microsystems in 1992 and was officiallyà released in 1995. JAVA Technology is a programming language that is used for meetingà the objectives of current challenges and opportunities in the present computing realm. Java Virtual Machine (JVM): JVM is an Interpreter for JAVA programming language,à i.e., it is the only way to convert a Byte Code into machine language. The Byte Codeà cannot be converted using any technique other than the JVM. Therefore as I said above Byte Code somehow helps Java in being secure. Java Runtime Environment (JRE): We all know that that the major problem with the programming languages before JAVA was platform dependency i.e., if we want to run the code compiled in Windows Xp in Linux, this was not possible as for that we need a special compiler which works in Linux only. So to solve this problem JRE was launched and became a part of java. Every Operating System have some mandatory files that are needed to run java on that particular OS. So in short JRE in the collection of all those mandatory files needed to run java on various OSââ¬â¢s plus JVM. Due to JRE today it is possible to use the code written in some OS in any other OS. So JRE made JAVA completely PLATFORM INDEPENDENT. The byte code is loaded into JVM using the Class Loader. JIT (Just in Time): JIT works as a verifier. It verifies the Byte Code first whether it is infected or not or whether it is holding some kind of virus in it or not. If found clean it forwards the Byte Code to the JVM for further process. JIT is completely responsible for the SECURITY of JAVA. Letââ¬â¢s see the whole process graphically. A.java A.class 2 Now Iââ¬â¢ll show you a basic program in java with its output. class Sample { public static void main(Strings) { System.out.println(Hello World); } } Letââ¬â¢s talk about the main() function. The main function is made up of 5 things. Access Specifier Function Name public static void main() Parentheses Access Modifier Return Type Java Fundamentals All programming languages have its own syntax and reserved keywords. JAVA alsoà has these kind of language fundamentals.à Basic fundamentals of java includes: Java Keywords Data Types Legal and Illegal Identifiers Operators Letââ¬â¢s see every fundamental in detail. Java Keywords: Keywords are the words that convey special meaning to the language compiler. These are reserved for special purposes and must not be used as normal identifier names. Data Types: Data types are keywords are means to identify the type of data and how much memory a variable needs to carry out a particular operation. Data types are divided into two types: Primitive Data Types (8 types) Non Primitive Data Types (User Defined 3 types) Legal and Illegal Identifiers: Identifiers are building blocks of a program and are used as the general terminology for the names given to different parts of the program viz. variables, objects, classes, function, arrays etc. 3 Operators: The operations being carried out are represented by operators. The operations (specific tasks) are represented by operators and the objects of the operation are referred as operands Classes in JAVA Class is a collection of objects of similar types of objects. Objects are nothing but a buffer or an area and are defined by something which have some property and behaviour. In java objects are created in the HEAP Memory inside the Java Virtual Machine. Syntax for creating an object in java: Class name object name=new class name(); new is a keyword of java which when used creates an object in the HEAP. Now whenever we use the new keyword a space in created in the HEAP memory inside the JVM for the object at runtime. When we print the reference variable of some class then it prints 3 things: Class name ââ¬Å"@â⬠symbol Hash code Graphical representation of HEAP and other memory areas available inside the JVM. 4 Principal of Object Oriented Programming (OOP) The object oriented programming has been developed with a view to overcome the draw backs of conventional programming approaches. The OOP approach is based on certain concepts that helps it to attain its goal of overcoming the drawbacks of conventional programming approaches. There are 4 general concepts of OOP: Polymorphism Inheritance Abstraction Encapsulation (itââ¬â¢s a part of abstraction) Polymorphism: It is the ability for a message or data to be processed in more than one form or it can simply be defined as one name used for many tasks which is used to speed up the compilation time. Inheritance: This is a parent-child relationship between two classes. In this, the child class object inherits some properties of the parent class object. Abstraction Abstraction refers to the act of representing essential features without including the background details or explanations. Abstraction is divided into two parts: Abstract Class: Abstract class is used to define a rule. Rules in abstract class: All the task which we can perform in a normal java class can also be performed in an abstract class. In abstract class we can define normal method as well as abstract methods. It is not compulsory to have at least one abstract method in a class. If a method is abstract then the class should be abstract. We cannot instantiate (cannot create the object) of abstract class. Abstraction is achieved using extends keyword. Interfaces: Interface are pure abstract methods. A class implements an interface, thus inheriting the abstract methods of an interface. An interface contains the behaviour that the class implements. The class that implements interface is abstract. Syntax: interface my; { declaration of methods;} 5 Rules in Interface: We cannot instantiate of an interface. Interface are used to define the rules purely. All the methods of an interface are by default public and abstract. In case of interface we use the keyword implements. If we define any data member inside an interface than by default it becomes static and final. Interface is used to achieve Multiple Inheritance. Packages Packages is a collection of classes and interfaces. No class can exist without a package included in it. This is the rule of OOPââ¬â¢s. But when we open a class we donââ¬â¢t always make a package in that class, so in this case the rule of OOPââ¬â¢s is violated. So to avoid this problem JAVA has given a feature in its compiler due to which when we compile the program, the compiler automatically creates a package of the respective class during the compile time. Command to compile the program with a package: javac ââ¬âd . p.java Name of the project current directory is the same location as the class where the package is to be made. Destination. ââ¬âd . is called the switching tool. Program with a package can be executed by using the Command: Java . Exception Handling When any abnormal condition that comes in a code which can be handled then that situation is known as Exception Handling. For every exception there are exception classes and exception methods to handle that exception in java by default. We can easily handle these unwanted exceptions by using try and catch block. Try is used to detect exceptions in a program and catch is used to handle that The ââ¬Å"finallyâ⬠block: If an exception occurs in a program then the try and catch block will be executed and then the program terminates in normal condition. But in case of finally before the termination of program finally block also executes. Syntax: try{-} catch{-} finally{-} 6 Threads Every process is divided into two categories: Heavy Weight Processes Light Weight Processes Heavy Weight Processes: These processes are those processes which stores a separate area in RAM. Light Weight Processes: These processes are those processes which occupy memory under the heavy weight processes. These light weight processes which occupy memory under the heavy weight processes are known as Threads in JAVA. Basically there are two ways in which we can make a thread: By directly implementing the runnable interface. By internally implementing the thread class in interface runnable and extending thread class. Multithreading Every part of a program is called a thread and every thread defines a separate pathà of execution. Java provides a building support for multithreading program. The multithreadedà program contains two or more parts that execute concurrently. Priority of which thread will start working first is decided by a program named as Threadà Scheduler which is a program of the Operating System. It gives the priority randomly. Synchronization To avoid the corruption of data we use the concept of synchronization in threads. When we share a single object into multiple threads then the chance of dataà Corruption arises and to avoid this we need the concept of synchronization. The keyword synchronized is applied on the function where the variables areà assigned values. Due to the concept of synchronization only one threadà executes at a time. Input/Output Stream Streams are nothing but a special type of buffer. In terms of JAVA streams are flow of bytes. Benefits of I/O Stream: Execution time reduces. Performance Enhances. Network congestion chances reduces. We get bulk data at a time. Streams are divided into two types: High Level Stream Low Level Stream High level stream cannot be used alone, whenever we want to use a high level stream we have to connect it by a low level stream. Stream Byte Stream Character Stream Console Based Unicode Input Output Reader Writer Stream Stream Byte Stream Input Stream Output Stream FileInputStream FileOutputStream BufferedInputStream BufferedOutputStream DataInputStream DataOutputStream ObjectInputStream ObjectOutputStream ByteArrayInputStream ByteArrayOutputStream PipedInputStream PipedOutputStream 8 Character Stream ` Reader Writer File Reader File Writer Buffered Reader Buffered Writer import java.io.*; class Demo0 { public static void main(String args[]) { FileOutputStream fout=new FileOutputStream(ââ¬Å"a.txtâ⬠); PrintStream ps=new PrintStream(fout); ps.println(ââ¬Å"helloâ⬠); ps.println(ââ¬Å"heyâ⬠); System.setOut(ps); System.out.println(ââ¬Å"mâ⬠); } } This is a sample program of how to write a file by coding in JAVA. Serialization Serialization is the process using which we can convert an object into a stream. If we have to use an object only once and then we need to use the same object after a long time then we use the concept of serialization. Features of Serialization: Only the object of that class can persist which implements serializable interface. If the parent class implements serializable interface then there is no need for child class to implement serializable. In case of serialization transient data members cannot persist. In case of serialization static data members cannot persist. Only the non-static data members can persist. If we make any variable transient that means those variables are unwanted now and willà get no memory in the HEAP inside the JVM. Serializable interface is a type of marker interface. Marker interface are those interfaceà which have no methods.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.