Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave

Review of Java Interface

Describe about the Report for A Project on Distributed Systems.

The Application Programming Interface in consideration with Java is nothing but the prewritten classes, packages, interfaces with their respective constructors, fields and methods. Generally the user interface facilitates the interaction between computers and human (Reisinger et al. 2012). In case of the API, software program interfaces facilitates the interactions. The most basic tasks related to programming are performed through the API packages, classes those are helpful for minimizing the number of lines used in a developed ode.

There are several models used in Java programming language. In this report two models related to Java programming language are discussed in details. These are: client server model and multithreading model in Java (Ahrendt et al. 2012).  The model concerned with the Multithreading concept elaborates process of executing number of threads at a time. The client server model elaborates essential mechanism utilized to use the internet in a proper way. This report is elaborating the detailed information about the java interfaces, and serialization of the Java objects (Paterson and Law 2012). In addition to this, two models concerned with the java interfaces are also described in this report to analyze the impacts of Java interfaces on the technological world as well as in the contemporary situations.

Definition of Java Interface

Java comprised of the concept of the interfaces within it. It is almost similar to a class but its not a proper class. The Java interfaces do not contains the implementation of the Methods only considers the signature of the Methods (“name, parameters and exceptions”). The java interfaces are mainly used to achieve a way of Polymorphism (Arend et al. 2012). The interfaces can have the methods and variables just like the classes but the methods are default abstracts, they only consist of the signature of the methods.

Example:  The Java interface can be easily explained by this example:

public interface MyInterface {

public String hi = “Hi”;

public void sayHi();

}

In this example, the Java interface is shown by using the keyword interface. The java interface also can be declared as “public or package scope” (Java Excel 2013). The above example contains one method and one variable. The variable in the interface can be directly accessed as follows:

System.out.println(MyInterface.hi);

This process of accessing the variable is almost similar to the accessing of variable from a class. In addition to this, the Method must be implemented in some class before it is accessed.

Utilizations of Java interface

There are several usages of java interfaces in Java programming. To understand these usages it is important to understand that where the java interfaces should be used first (Platform 2014). The interface defines the rule of functionality in the programming. At the time of the implementation of these interfaces these functionalities should be implemented in the concrete classes. Generally the user interfaces cannot be understood but when the consideration is about the large evolving program then it is important and mandatory to implement the interface within the program (Yu et al. 2014). The most particular advantage of using the interface within the program is that it offers and allows multiple inheritances.

The strength of the interfaces is analyzed when the dependency techniques related to injection is implied for injecting on required implementation (Reisinger et al. 2012). The ripple effects are minimized as the concrete implementation of classes helps in it.

Implementation of Java interfaces introduces the implementation of that interface within some predefined Java class (Ahrendt et al. 2012). This aspect explains that the java interface have to be implemented on the some predetermined and defined classes before it can be accessed or its variables are accessed through the instructions.

Example: The following example can explain the variables and implementation technique of interfaces within Java programming:

public class MyInterfaceImpl implements MyInterrface {

public void sayHi() {

System.out.println(MyInterface.hi);

}

}

The above example shows the implementation technique of Java interface within any Java program. The part “implements MyInterface” is the part of the declaration of the class. This part sends the signal to the Java compiler that the “MyInterfaceImpl” class has implemented the “MyInterface” interface (Paterson and Law 2012). As stated before that the Methods should have to be implemented in some interface before it is used. In addition to this, the Methods must have the similar signature as the interface (Name + parameters). This is done according to the declaration in the interface (Arend et al. 2012). The class does not have to implement the variable that belongs to the interface; it only needs to implement the interface within it.

Definition of Java Object Serialization

It defines that the objects can be identified as the sequence of bytes that provides the information about the type of the object as well as the data stored in the objects (Imre, G., Charaf and Lengyel 2013). The next step of data serialization into the file, the content can be desterilized and read from  that file. The type of the information and the type of the object introduces the techniques of recreating and recovering the data from the format. It is totally related to the memory. The entire process explained in this section is independent of the JVM (Yu et al.  2014). This aspect states that, one object is serialized in one object and can be desterilized from some other objects. The classes ObjectInputStream and ObjectOutputStream are two high level streams that are used in case of the serialization and deserializing an object.

Implementations of Java Interface

Example: the following example is explained is the aspect of serialization in Java programming:

public class Employee implements java.io.Serializable

{

public String name;

public String address;

public transient int SSN;

public int number;

public void mailCheck()

{

System.out.priintln(“Mailing a check to” +name + “” + address);

}

}

There are several usages of serialization these usages are described as follows:

Communication: Two machines those are running the same code needs to be communicated. An easy way to make the communication possible is that these two machines should build one object with the information to be transmitted through serializing their codes (Imre et al. 2013). This aspect makes the communication possible.

Persistence: The state of any operation in a database is stored. This aspect makes the object serializable to a byte array. This information is stored in the array to be retrieved later.

Deep copy: The replication of a concerned object can easily be done by avoiding the conceptual method of writing the same specialized class again (Tauro et al. 2012). Serialization of any object to a byte array and then deserialization of the same object makes the fact possible.

Caching: There are certain processes that need 10 minutes to build an object, whereas, it only takes 10 seconds to desterilize an object. Therefore, it is not necessary to store a giant object in memory (Pratt-Szeliga et al. 2012). This can be cached though the process of serialization. In addition to this it can be retrieved any time after the serialization.

The object serialization can be easily explained with respect to the following example:

Any object which have the java.io.Serializable interface within its class can only implemented within the class within a few line of code (Imre, G., Charaf and Lengyel 2013). This interface identifies the classes that can be easily serialized at the run time. Serializable classes are identified as:

public class UserData implements

java.io.Serializable

Example:

FileOutputStream f_out = new

FileOutputStream(“myobject.data”);

ObjectOutputStream obj_out = new

ObjectOutputStream (f_out);

obj_out.writeObject (myObject);

In this example, it is shown that any serializable object can be implemented within any serializable interface. This is core part of the Java API. Any object refereed by the serializable object can be also be stored in the interface (Imre et al. 2013).. This implies that the collections, lists, vectors and other many elements can be stored accordingly in a same manner. There is no need to save each one individually. This aspect helps to develop a code that is time efficient and is of short length.

Review of Java Object Serialization

Definition of Multithreading

Multithreading is the concept in Java programming that defines the process of handling several threads at a time. The concept of thread can be easily understood if the concept of thread is made clear. A thread is the light weighted and smallest part of a process that can run at a time with any other part of the program (Roland et al. 2013). Threads are the processes that are totally independent of any other process. It is independent as there are totally separate execution path for the each thread. If there is any exception in between the execution of one thread then this will not affect the execution of the other thread. The process of executing more than one thread at a time is called the process of multithreading.

Example: The following example shows the multithreading process:

}  

public class Worker implements Runnable   

{  

  public static void main (String[] args)  

  {  

    System.out.println("This is currently running on the main thread, " +  

    "the id is: " + Thread.currentThread().getId());  

    Worker worker new Worker();   

    Thread thread = new Thread(worker);  

    thread.start();  

  }  

   public void run()   

  {  

  System.out.println("This is currently running on a separate thread, " +  

  "the id is: " + Thread.currentThread().getId());       

  }  

Thread

Process

Threads are easier to be created.

Processes are hard to be created than the threads.

The process of multithreading requires comparative careful programming as threads share a data structure that can be modified by one thread at a time (Maeda 2012).

the process do not share the same slot of address for the modifying data structures.

A thread uses less number of resources within it.

A process uses comparatively more resources than a thread.

A thread shares the same address so they are interdependent.

Processes are not dependent (Mastrangelo et al. 2015).

A thread consists do not consists of multiple process.

A Process consists of several threads.

There are specifically two way by which provides scope of creating the threads. These are: though the implementation of Runnable interfaces and though the extension f the Thread class.

Runnable interface:

The easiest way to implement a thread is to create a class that implements runnable interface (Panwa and Sharma 2014). After the implementation of the runnable interface the run() method is implemented within it to introduce a concurrent thread into the program.

class MyThread implements Runnable

{

public void run()

 {

System.out.println("concurrent thread started running..");

}

}

class MyThreadDemo

{

 public static void main( String args[] )

 {

 MyThread mt = new MyThread();

 Thread t = new Thread(mt);

 t.start();

 }

}

Output: Concurrent thread started running

Extending Thread class:

This is the way of creating the thread within the Java program. This aspect makes a new class which extends the Thread class while making a instance of that class (Reisinger et al. 2012). The extending class should override the run() Method that is concerned as the entry point of the new threads.

class MyThread extends Thread

{

 public void run() {

  System.out.println("Concurrent thread started running..");

 }

}

classMyThreadDemo

{

 public static void main( String args[] )

{

 MyThread mt = new  MyThread();

  mt.start();

 }

}

It is possible to make the thread runnable by two processes (Saternos 2014). These are: by providing a runnable object and creating a subclass thread.

Runnable object:

In this process the Runnable interface mainly defines a single method run(). This explains code executed in the thread (Ahrendt et al. 2012). The Runnable object is passed through the Thread constructor.

Use of Object Serialization in Java

public class HelloRunnable implements Runnable {

public void run() {

System.out.println("Hello from a thread!");

  }

public static void main(String args[]) {

(new Thread(new HelloRunnable())).start();

}

}

Subclass thread:

The following example shows the example of subclass thread:

public class HelloThread extends Thread {

 public void run() {

System.out.println("Hello from a thread!");

}

public static void main(String args[]) {

(new HelloThread()).start();

 }

}

Definition of Client Server Model

The client server model is most effective model for analyzing the distributed computing protocols. Any client- server application is typically stores the huge amount of data with costly and expensive server. in addition to this, most of the user interface and program logic is handled by the software running on the relatively cheap PC (Goel et al. 2015). There are several cases in which the server generally sends the data and the client receives the data at the same time. One of the most reliable distinctions is that the clients can initiate the conversations while the server can wait until the client start the conversation (Matos and Grasser 2014). The following figure explains the clients-server relationship.

Client- Server Model

Figure : Client- Server Model

(Source: Carr et al. 2016, pp- 60)

Multithreading is nothing but a certain condition where several threads can be operated at a time in the interface or program. There are several importance of multithreading of servers. These important aspects are described as follows:

Time efficiency: The conventional way of running a program was very lengthy and time taking as well, this aspect was recovered through using the multithreading concept (Kremic 2012). In the contemporary time the aspect called thread have solved this problem, as more than one thread can be operated at a time. The multithreading concept spent less time outside the accept() call.

Requests of clients: There are several kind of requests raise from the side of the client, that may affect the total system of the server (Harold 2013). Multithreading saves the server from blocking.

Conclusion

The application programming interface is a set of predefined and prewritten classes, packages and methods those are almost same as the classes used in java programming language. The main aims of Java API are to minimize the line of codes and make it easier than the conceptual heavy codes. The interface provides the facilitation for enabling the interaction between two machines. The JDK setup provided by the Java platform helps make this interaction possible. The Java Development Kit (JDK) is the base of the developing a program in Java. These parts of the Java programming is comprised of three elements: compiler in Java, Virtual Machine in Java, Application programming Interface in Java. In addition to this, serialization of objects, multithreading model and client server model are three core aspects of Java. These three concepts related to Java are discussed in this report. This report has elaborated the concepts and importance of serialization, multithreading and client server model. Serialization is nothing but transformation of objects into a set of byte codes. Several importance of the serialization is discussed in this report. Secondly, the concept of multithreading helps to operate a set to threads at a time that makes the execution of program easier. Thirdly the concept of client- server model explained in this report elaborated that this model helps in describing the distributed computing protocols.

References

Ahrendt, W., Mostowski, W. and Paganelli, G., 2012, October. Real-time Java API specifications for high coverage test generation. In Proceedings of the 10th International Workshop on Java Technologies for Real-time and Embedded Systems (pp. 145-154). ACM.

Arend, D., Lange, M., Colmsee, C., Flemming, S., Chen, J. and Scholz, U., 2012, October. The e! DAL JAVA-API: store, share and cite primary data in life sciences. In Bioinformatics and Biomedicine (BIBM), 2012 IEEE International Conference on (pp. 1-5). IEEE.

Carr, D.W., Jones, C.A., Wesley, A.A. and Wong, C.A., International Business Machines Corporation, 2016. Interleaving the XForms processing model with java server faces request processing. U.S. Patent 9,256,407.

Goel, N., Laxmi, V. and Saxena, A., 2015. Handling Multithreading Approach Using Java. International Journal of Computer Science Trends and Technology, 3(2), pp.24-30.

Harold, E.R., 2013. Java network programming. " O'Reilly Media, Inc.".

Imre, G., Charaf, H. and Lengyel, L., 2013, August. Estimating the Cost of XML Serialization of Java Objects. In Engineering of Computer Based Systems (ECBS-EERC), 2013 3rd Eastern European Regional Conference on the (pp. 33-40). IEEE.

Java Excel, A.P.I., 2013. A Java API to read, write, and modify Excel spreadsheets. 2009-03-16]. https://www. andykhan, com/jexcelapi.

Kremic, E., Subasi, A. and Hajdarevic, K., 2012, June. Face recognition implementation for client server mobile application using PCA. In Information Technology Interfaces (ITI), Proceedings of the ITI 2012 34th International Conference on (pp. 435-440). IEEE.

Maeda, K., 2012. Comparative Survey of Object Serialization Techniques and the Programming Supports. Journal of Communication and Computer,9(8), pp.920-928.

Mastrangelo, L., Ponzanelli, L., Mocci, A., Lanza, M., Hauswirth, M. and Nystrom, N., 2015. Use at your own risk: The Java Unsafe API in the wild.ACM SIGPLAN Notices, 50(10), pp.695-710.

Matos, V. and Grasser, R., 2014. An experience on multithreading using Android's handler class. Journal of Computing Sciences in Colleges, 30(1), pp.80-86.

Panwar, K. and Sharma, D., 2014. Multithreading In Java. International Journal of Research, 1(10), pp.1595-1598.

Paterson, T. and Law, A., 2012. JEnsembl: a version-aware Java API to Ensembl data systems. Bioinformatics, 28(21), pp.2724-2731.

Platform, J., 2014. Standard Edition 6 API Specification. Last accessed May.

Pratt-Szeliga, P.C., Fawcett, J.W. and Welch, R.D., 2012, June. Rootbeer: Seamlessly using gpus from java. In High Performance Computing and Communication & 2012 IEEE 9th International Conference on Embedded Software and Systems (HPCC-ICESS), 2012 IEEE 14th International Conference on (pp. 375-380). IEEE.

Reisinger, F., Krishna, R., Ghali, F., Ríos, D., Hermjakob, H., Antonio Vizcaíno, J. and Jones, A.R., 2012. jmzIdentML API: a Java interface to the mzIdentML standard for peptide and protein identification data. Proteomics,12(6), pp.790-794.

Roland, M., Langer, J. and Mayrhofer, R., 2013, December. (Ab) using foreign VMs: Running Java Card Applets in non-Java Card Virtual Machines. In Proceedings of International Conference on Advances in Mobile Computing & Multimedia (p. 286). ACM.

Saternos, C., 2014. Client-Server Web Apps with JavaScript and Java. " O'Reilly Media, Inc.".

Tauro, C.J., Ganesan, N., Mishra, S. and Bhagwat, A., 2012. Object Serialization: A Study of Techniques of Implementing Binary Serialization in C++, Java and .NET. International Journal of Computer Applications, 6(45).

Yu, A.R., Wang, J., Ye, X.G. and Chen, G.Y., 2014. Application and research of instruction serialization technology in the simulation test system. InAdvanced Materials Research (Vol. 1049, pp. 2049-2053). Trans Tech Publications.

Cite This Work

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2017). Essay: Report On A Project On Distributed Systems: Java Interfaces And Object Serialization.. Retrieved from https://myassignmenthelp.com/free-samples/a-project-on-distributed-systems.

"Essay: Report On A Project On Distributed Systems: Java Interfaces And Object Serialization.." My Assignment Help, 2017, https://myassignmenthelp.com/free-samples/a-project-on-distributed-systems.

My Assignment Help (2017) Essay: Report On A Project On Distributed Systems: Java Interfaces And Object Serialization. [Online]. Available from: https://myassignmenthelp.com/free-samples/a-project-on-distributed-systems
[Accessed 23 February 2024].

My Assignment Help. 'Essay: Report On A Project On Distributed Systems: Java Interfaces And Object Serialization.' (My Assignment Help, 2017) <https://myassignmenthelp.com/free-samples/a-project-on-distributed-systems> accessed 23 February 2024.

My Assignment Help. Essay: Report On A Project On Distributed Systems: Java Interfaces And Object Serialization. [Internet]. My Assignment Help. 2017 [cited 23 February 2024]. Available from: https://myassignmenthelp.com/free-samples/a-project-on-distributed-systems.

Get instant help from 5000+ experts for
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing: Proofread your work by experts and improve grade at Lowest cost

loader
250 words
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Other Similar Samples

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close