Showing posts with label secure. Show all posts
Showing posts with label secure. Show all posts

Thursday, July 17, 2014

Why Java Is Preferred?

The developers preferred java over traditional programming languages like C and C++.Java is preferred due to its unique feature platform independent, robustness and more secure.
·         Simple: Java inherits most of the syntax of C and many of the OOPs features of C++. In addition to this is has its own add in features which are easy for professional programmers to learn.
·         Object Oriented: Java uses OOPs concepts for faster programming. It has most of the packages and interfaces built-in which are easily reused and extended. The class and object structure provides data encapsulation, abstraction, inheritance and polymorphism.
·         Robust:  Java is robust because of two reasons memory management and exception handling. In traditional programming C,C++ dynamic memory management is very difficult as memory allocation and de-allocation must be done by programmer but java does this dynamic memory allocation and de-allocation without any extra efforts. Exceptional conditions may arise in traditional programming which may leads to abnormal termination of programs but java provides exception handling which helps to handle and eliminate these run time errors.
·         Secure: All java programs run over JVM platform and not on Operating system. So any OS related updates or modification does not affect execution of java program. Java also provides packages and access modifiers which in turn provides security. Java applets are executed inside sandbox which creates an environment which provides restricted access to OS resources and allows user to run untrusted code from unknown source safely. Java uses byte code verifier module which checks java code automatically before executing it. Java provides run time array boundary check which is not provided in traditional programming. In traditional programming memory references can be manipulated but in java you cannot manipulate references which interns provides secure memory access.
·         Platform Independent: Traditional languages C, C++ were designed to compile for specific platform (processors, OS). In java executable code runs over JVM platform which is independent of OS. So once we have byte code (.class file) we can execute it on any OS. So java code needs to be compile only once and we can execute it any number of times across different platforms (processors, OS). So it is “write once, run anywhere, anytime”. 
·      Multithreaded: Java provides multithreaded programming which allows doing many things simultaneously. Each thread performs separate task. For example using text editor with spell check feature enabled which allows editing and spelling check simultaneously.

Tuesday, July 15, 2014

Why Java is preferred over C and C++

When it comes on selecting a programming language, we need to consider few parameters like security, robustness, ease in programming and few other parameters, because of below mentioned parameters java is preferred over C++ :

·         Robust:  Java is robust because of two reasons memory management and exception handling. In C,C++ programming dynamic memory management is very difficult as memory allocation and de-allocation must be done by programmer but Java does this dynamic memory allocation and de-allocation without any extra efforts.

·         No Pointers: Use of pointer is avoided in Java. In C++ programming memory references can be manipulated but in Java, you cannot manipulate references which in turn provide secure memory access.

·         Platform Independence and Portability: Traditional languages C, C++ were designed to compile for specific platform (processors, OS). In Java executable code runs over JVM platform which is independent of OS. So once we have byte code (.class file) we can execute it on any OS. So Java code needs to be compiled only once and we can execute it any number of times across different platforms (processors, OS). So Java provides platform independence and portability.

·         Secure: Java provides sandbox security model for applet execution which creates an environment which provides restricted access to OS resources and allows user to run un-trusted code from unknown source safely. All Java programs run over JVM platform and not on Operating system. So any OS related updates or modifications do not affect execution of Java program.  Java uses byte code verifier module which checks Java code automatically before executing it.


·         Multithreading : its support to multithreading made java enabled for multitasking which allows available resources to be used optimally. Java has built in support for multithreading but in C++, multithreading is entirely dependent on Operating System.

Why java is Secure

When it comes across the security issue of programming languages, Java is surplus over traditional programming languages like C and C++. Java is more secure than C and C++ for the following reasons:

·         Its JVM and not OS: All Java programs run over JVM platform and not on Operating system. So any OS related updates or modification does not affect execution of Java program.

·         Sandbox Security Model: Java applets are executed inside sandbox which creates an environment, which provides restricted access to OS resources and allows user to run un-trusted code from unknown source safely.

·         No Pointer Manipulation: In traditional programming memory references can be manipulated but in Java we cannot manipulate references. Thus you cannot cause an object reference to point to an arbitrary memory location, which in turn provides secure memory access.

·         Byte Code Verifier:  Byte code verifier checks correctness of class files and API libraries. Java uses this byte code verifier module which checks Java code automatically before executing it.

·         Array Boundary Check: Java provides run time array boundary check which is not provided in traditional programming.

·         Packages and Access Modifiers: This combination of packages and access modifiers allows your class to have detailed knowledge of each other, but not expose that knowledge outside that package.

·         Run Time Exception Handling: Exceptional conditions may arise in traditional programming which may lead to abnormal termination of programs but Java provides exception handling which helps to handle and eliminate this abnormal termination.

·         Dynamic Memory Allocation and De-allocation: In traditional programming C,C++ dynamic memory management is very difficult as memory allocation and de-allocation must be done by programmer but Java does this dynamic memory allocation and de-allocation without any extra efforts. Java uses new operator to dynamically allocate memory and Garbage Collection technique to handle automatic memory de-allocation.


·         Two Level of Code Checking: Code is checked two times, first at compile time and then at run time which can be considered as more secure than single level of code checking.