Monday, March 31, 2014

Object Oriented Programming ,Part 2- BASIC DEFINITIONS

In OOPS , Part 1, I have explained about the SOFTWARE DEVELOPMENT . In this post i will provide you some basic terms with definitions that is used in software development based on Object-oriented programming. In upcoming posts i will provide detail explanation of every term.

What is object-oriented programming?
  • OOPs had emerged to overcome the flaws of procedural programming language where we write list of instructions in groups inside function and we merely concentrate on data.
  • OOPs is the way of thinking which demonstrates that how we can approach towards problem solving and it guides in inventing a method for software creation and organization.
  • In OOPs data is critical element and it is bound with the function(method) that operates on  it.
  • In OOPs problems are decompose into number of entities called objects and then we build data and function around those entities rather than action and logic.
Apart from these there can be many way we can define OOPs and there are many advantages of OOPs that you will learn gradually while programming practice.

What is Object?
An Object is a "thing" or Anything can be represented as an object. Example : a person, a city or anything that come in your mind can be treated as an object in OOPs.
An object is run-time entities in OOPs which represent an instance of class. It contains data and code to manipulate those data.

What is class?
A class is user-defined data-type in OOPs.class is collection of object of same type. class is a blueprint or template for creating an object. class is used to define variables and methods which is common to all objects of same kind.

what is state?
As using class we create an object and for a particular object we set the values for the attributes and that represents the state of the object.

What is Method?  
The method describes the abilities of objects or in other word we ca say it represents the behavior of an object.

what is Instance?
The actual object created at run-time called as the instance. The actual object created is called as an instance of class.

what is message passing?
Message passing called as the method calling. It is the way to establish communication between two objects.

what are important pillars of Object - Oriented Programming?
  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism
Encapsulation: Encapsulation means binding all data members like variables and behaviors together into single unit. 
 
Abstraction: Abstraction let us focus on "what" instead of "how"  means it lets the user to represent the essential features (means what he can do) by hiding the details running in background(means users don't need to worry about how it is doing).
 
Inheritance: it supports the concepts of hierarchy in OOPs. it is the process by which object of one class acquires the properties of object of another class. it brings the concept of re-usability in object oriented programming.
 
Polymorphism: Poly(many) + morph(forms)= polymorphism(many forms). Its an ability to more than one form.   One method can exhibit different behavior in different instance.
 
Benefits of OOPs: 
  1. Through inheritance, we can eliminate redundant code and extend the use of existing classes means it brings re-usability.
  2. We can build programs from the standard working modules which can communicate with one another, rather than having to start writing the code from scratch. This reduces the development time and leads to higher productivity.
  3. The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
  4. It is easy to partition the work in a project based on objects.
  5. Message passing techniques for communication between objects makes the interface descriptions with external systems much simpler.  
  6. Software complexity can be easily managed. 
Here i have explained some basic definitions, in upcoming post i will explain these all topics in details. 


Friday, March 28, 2014

CODE QUALITY - Code Review.

While working in any company we are not the only one who writes the code. Most of time we need to work on the code written by others or may be possible, some one ,earlier had written the code and you need to enhance them. so in that situation what should we do?  what should be the better approach to write the code?
  • code review is always developer-to-developer work it does not involve testing.
  • As you don't tell tester what to test same way you can't to other what code to review?
  • For enhancement purpose changes are made in code so you should always check the code precisely.
Some points worth to consider :
  • you can't use System.out.println("") as you use in real world, you need to use log4j or slf4j.
  • you can't use public static void main(String[] args) to test your class.
  • You need to use Junit or  Mockito like frameworks to write test cases.
  • While Writing test cases don't write test cases only for positive scenarios, also consider negative scenarios (means constraints that can fail the test cases)
  • some basic mantras from design patterns are: write codes on basis of interface instead of implementing classes , favor composition over inheritance, as these style favors abstraction and abstraction makes the code readable and understandable.
Some important points to consider for code review:
  • First point to consider is, does your code fulfill the functional requirements stated by your client or senior delegate?
  • Most of time changes are made in code then here you have to consider, does the changes made affect other part of code or does it breaks others dependency ?
  • Does the code is readable ? as many developers will come and go and may work on same code. to practice this you can adopt some common approach like write few lines of code and ask your friend to review that and ask him can he understand the code.
  • Focus on naming convention means name of variable and name of method should be self explanatory.
  • Take care of comments in your code like may be there unnecessary comments or may be comments with unused code.
  • Lots of time copy paste is performed so there may be repeated code with same logic or hard coded value. so you should take care of this.
  • In every company or workplace there some standards are being followed so while writing the code we need to care of this because it brings consistency while coding.
  • May be variable scopes is not defined properly for example : in monetary control you need to use BigDecimal but some may use int instead.
  • May have used mutable objects where immutable objects need to use.
  • Have not followed proper language contracts like not implemented equals() and hashcode() properly.
  • We also need to look around thread safety,  look around code for proper synchronization and dead lock because most of time it becomes tough to detect those and it creates problem in production.
  • look around the code for standard exception handling , you should always take care of does your code handle bad input , because if your code fail to handle exception well then your application may crash.
  • Don't try to reinvent the wheel by writing your logic or implementation if it is already well tested and proven , provided with your API and this increases the re-usability of code.
 Some key areas that help to achieve this :
  1. All of first regular practice, learning and off-course Experience.
  2. The fundamentals of language you are learning or using in your work.
  3. Design patterns in terms of Object oriented concept.
  4. Transaction,Concurrency,Memory,Performance issues ==> these are so vital aspects and we learn these all with experience.
  5. Consistent coding , following best practices, look for software development process, Security aspects .
  6. Many more.....that you will learn when you became passionate about your work and you learning.

"KEEP LEARNING, HAPPY CODING, DON'T LEARN ONLY TO FULFILL YOUR NEED, DO SOMETHING FOR YOUR PASSION"
 

Thursday, March 27, 2014

OBJECT ORIENTED PROGRAMMING, Part 1

If you want to be versed java developer then it is very necessary to understand the OOPs concept. You should never ignore this topic, after all it is root of software development built on basis of Object-Oriented Programming language like java, php, C#, ruby and many more....

Here I will explain OOPs concept in context of java. To learn and keep the concepts in mind try to relate these concepts with your day to-day activity (really it will help you) because as the concepts will grow your mind will get mess up with lots of concepts and it become very difficult to combine all those small concepts together at software development level.

In the OOPs series post i will start from very beginning.

What is software development?
Software development is a development process which happens step-by-step,which follows some cycle, involves the process of writing the codes and maintaining the already written code and end result of all these steps is a software product which establish an interface between the user, system(computer) and underlying environment.

What are different phases involved in Software-development life cycle?

It involves following phases :
  1. Planning Phase : when you decide to do something, you plan your activities to achieve what you have decided. Same way when you come to know which software you have to built you have to plan every process involve in building the software. In technical term it is called as Software Project Management Plan(SPMP).
  2. Requirement And Analysis Phase : In this phase concept is explored,refined and client's requirement is understood ,analyzed and presented in the form of specification(document). And at the end of this phase SPMP is finalized. 
  3. Design Phase : This phase involves two design procedure.first called as architectural design in which product as a whole is broken down in component called Module. Second phase is detailed phase in while each module is designed.
  4. Implementation Phase : This phase involves coding and testing phase separately. In this phase different components are integrated after different phase of testing finally it is released after acceptance of prototype by client.
  5. Maintenance Phase : This phase includes all the changes to the product once the product has been delivered and installed on client's computer. It involves software repair , enhancement and version released. 
Depending upon these all phase different methodologies have been named and used like Waterfall mode, Spiral model . Apart from these methodologies these days Agile methodologies are being adopted which involves Extreme programming(xp), Scrum, TDD(test driven development),Kanban.

What is Software Architecture ? 
Software Architecture means architect of a software governed by some rules , previous patters and heuristics. it involves following steps :
  1. Divide the problems into the discrete pieces.
  2. Use technologies or techniques to link these different pieces.
  3. After linking those pieces try to construct a flow and overall structure
  4. Think about the integration of built system with the environment where it will deployed
  5. Appropriate use of development, technology , tools and delivery approach.
Why Architecture is important?  
  • It enforces the developer to adopt best practices.
  • It increases re-usability.
  • It controls the complexity
  • It provides uniformity and consistency in all phase of software development.
  • Somehow it helps in predictability and easier solution.
What is Object Oriented Analysis (OOAs)?
Think it simple way , suppose you have been assign a simple task and you have to complete that, now what you will do at first step?
simple you will think over problem domain and will try to analyses the problem and after that you will extract something from that and move a step ahead.

same way in software development it is informal analysis of the client requirements but it follows object oriented paradigm. it involves extraction of entity(object) means what can be important object or thing for solving the given problem, what functionality that entity will perform, how that entity will interact with other entity. 

What is Object Oriented design(OODs) ?
The aim of Object Oriented Design is to design the product in terms of objects or entities that has been extracted during object-oriented analysis. As a end result of this we get Use-case diagram or an UML diagram.

FIRST JAVA PROGRAM, Part 2 - Common Problems for Beginners (on windows System)

In Part 1 of this series i have explained about the basic class structure, here i will let you know about the common problems that you can face while compiling and running your first java program.

When you attempt to compile your first program and you use javac command from your command prompt, then you can see following message: 
  • prob: 'javac' is not recognized as an internal or external command, operable  program or  batch file.
  • Solution : If you receive this error, Windows cannot find the compiler (javac).Here's one way to tell Windows where to find javac. Suppose you installed the JDK in C:\jdk1.7.0. At the prompt you would type the following command and press Enter:C:\jdk1.7.0\bin\javac Abc.java  If you choose this option, you'll have to precede your javac and java commands with C:\jdk1.7.0\bin\ each time you compile or run a program. To avoid this extra typing,follow my post here.
  • Prob : Class names, 'Abc', are only accepted if annotation processing is explicitly requested.
  • Solution : If you receive this error, you forgot to include the .java suffix when compiling the program. Remember, the command is javac Abc.java not javac Abc.  
While compiling your compiler can complain about wrong syntax and if your code does not follow correct syntax, you can get following message
  • Prob : The message usually displays the type of the error, the line number where the error was detected, the code on that line, and the position of the error within the code. Here's an error caused by omitting a semicolon (;) at the end of a statement.
        Abc.java: 3: `;' expected. System.out.println("Hello java") 
  • Solution : Follow the error message generated by compiler and check your code for syntax. 
After compilation you try to run the program and may be situation you will have a class without "main" method and you try to run it, then you will get following message.
  • Prob: java.lang.NoSuchMethodError : main Exception in thread "main".
  • Solution: to run our compiled java program our class need to have main method having signature as public static void main(String[] args){ } 
While trying to run your program there can be situation where java run-time system could not find .class file then, you will get following message
  • Prob : Exception in thread "main" java.lang.NoClassDefFoundError: Abc
  • Solution : If you receive this error, java cannot find your bytecode file, Abc.class. One of the places java tries to find your .class file is your current directory. So if your .class file is in C:\java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter: cd c:\java 
    The prompt should change to C:\java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java Abc again.

    If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try to set the classpath with the following command.
    set CLASSPATH=
    
    Now enter java Abc again. If the program works now, you'll have to change your CLASSPATH variable. To set this variable, click  here. The CLASSPATH variable is set in the same manner. 
     
  • Prob: could not find and load main class in Abc.class
  • Solution : A common mistake made by beginner programmers is to try and run the java launcher on the .class file that was created by the compiler. For example, you'll get this error if you try to run your program with java Abc.class instead of java Abc. Remember, the argument is the name of the class that you want to use, not the filename.

EXPANDING JAVA CONCEPTS , part 4 - Package and classpath continued..

In Expanding Java Concept series,Part 3 ,Package And Classpath  I have explained this with few examples. Here also i will present few examples.
  
Another Example
In this example, we have more than one classes in the package and the classes reference each others. For example, the package in.technoscience.project1.subproject2 has two classes: MyClass3 and MyClass4, defined as follows:
package in.technoscience.project1.subproject2;
public class MyClass4 {   // constructor
   public MyClass4() {
      System.out.println("MyClass4 constructed");
   }
}

package in.technoscience.project1.subproject2;
public class MyClass3 {
   private MyClass4 myClass4;
   public MyClass3 () {   // constructor
      System.out.println("MyClass3 constructed");
      myClass4 = new MyClass4();   // use MyClass4 in the same package
   }
   // main() included here for testing
   public static void main(String[] args) {
      new MyClass3();
   }
}

Wednesday, March 26, 2014

Microsoft Released the source code for MS-DOS and MS-Word

Microsoft has released a source code for MS-DOS V1.1 and V 2.0 and Microsoft Word for windows 1.1 by the help of Computer History Museum , They had made the source code available to public for download.
If you don’t know the history of MS-DOS, A Software 86-DOS was developed by Tim Paterson in 1980. Micosoft hired Paterson and bought 86-DOS at $75000. Then the 86-DOS was renamed to MS-DOS and released by Microsoft in 1981.First MS-DOS version of Word was released in 1983.In 1989, the word for windows has been arrived which was the huge success for  Microsoft.And today’s word and Windows have some roots in both of these releases.Hence Microsoft released the Code for these two most successful and initial products for public to help future generations of technologists better understand the roots of personal computing by the help of Computer History museum.

To download follow this link :DOWNLOAD SOURCE CODE ,
to download source code of microsoft word : Download source code 

EXPANDING JAVA CONCEPT Part 3 - Package And Classpath

In EXPANDING JAVA CONCEPT series,I have explained about the Packages Strategy . Here I will discuss how to create package and how it relates with the classpath.

Creating Package  
If you are using any IDE like Eclipse,its very easy step and to create package in eclipse you can follow my post First Java Program In Eclipse . If you want to write in Text editor then you must create directory same as specified in the package statement of java source file.
example : if you write a class like below, then you must create directory in/technoscience/first in you local directory. like d:\javaproject\src\in\technoscience\first\Abc.java

package in.technoscience.first;

public class Abc {
 public Abc(){
  
 }
 public static void main(String[] args) {
  System.out.println("hello java");
 }

}
Consider following points while using package:
  • While writing Java program, you must place every class you define into a package, and give each package a unique name.
  • You place a class into a package by including a package declaration at the top of the source file. 
  • A package declaration is just the keyword package followed by the package name and a semicolon. 
  • The package declaration must appear in the source file before any class or interface declaration, and each source file can contain only one package declaration.
  • Example as i have written in above code : package in.technoscience.first
Now consider some examples:
Theses examples will illustrate the concept of classpath , initially try to follow this practicals and at the end you will come to know exactly in which situation classpath plays a big role.

EXPANDING JAVA CONCEPTS, Part 2- Packages Strategy

In EXPANDING JAVA CONCEPTS series PART1 i have explained some basic and advantages of using packages in Java.

In this post i will explain what packaging strategy you should choose because when you start building your application first question that will come in mind is how you should divide into packages?

While working in real world two strategy has been adopted:
Package By Layer and Package By Feature

Package By Layer: 

This strategy reflects various application layers that has been used in building application.Example :
  • in.technoscience.action
  • in.technoscience.model
  • in.technoscience.dao
  • in .technoscience.model
Each directory contains items that usually aren't closely related to each other. This results in packages with low cohesion and low modularity, with high coupling between packages. As a result, editing a feature involves editing files across different directories.

Package By Feature:

This strategy uses packages to reflect the feature set. It tries to place all items related to a single feature into a single directory/package. This results in packages with high cohesion and high modularity, and with minimal coupling between packages. Items that work closely together are placed next to each other. They aren't spread out all over the application.
Example: if you are building an application for education domain like for any college or any university, you will have following package structure
  • in.india.university
  • in.india.colleges
  • in.india.students
  • in.india.reports
  • in.india.util and so on....
Each package usually contains only the items related to that particular feature, and no other feature. For example, the in.india.university package might contain these items :
  • University.java
  • UniversityAction.java
  • UniversityDao.java
  • Db items and user interface file(like jsp,html)
It's important to note that a package can contain not just Java code, but other files as well. Indeed, in order for package-by-feature to really work as desired, all items related to a given feature - from user interface, to Java code, to database items - must be placed in a single directory dedicated to that feature (and only that feature)
Out of two strategy, for business application Package By Feature is recommended.
  • Package-by-feature has packages with high cohesion, high modularity, and low coupling between packages.
  • Package-by-feature provides easier code navigation and that becomes easy during maintenance.
  • Package-by-feature provides high level of abstraction and benefit of being at a high level of abstraction, the application becomes more self-documenting: the overall size of the application is communicated by the number of packages, and the basic features are communicated by the package names. The fundamental flaw with package-by-layer style, on the other hand, is that it puts implementation details ahead of high level abstractions - which is drawback.
  • Package-by-feature separates both features and layers.The package-by-feature style honors the idea of separating layers, but that separation is implemented using separate classes. The package-by-layer style, on the other hand, implements that separation using both separate classes and separate packages, which doesn't seem necessary or desirable.
  • In the package-by-feature style, the number of classes within each package remains limited according to the items related to a specific feature. If a package becomes too large, it may be refactored into two or more packages. In package-by-layer style,an application grows in size, the number of packages remains roughly the same, while the number of classes in each package will increase without bound.  

Tuesday, March 25, 2014

EXPANDING JAVA CONCEPTS , Part1 - Packages

Packages
Instead of thinking it at java level,consider it as simple English word and understand its meaning.

Consider a situation from your daily life, Whenever we have to relocate somewhere, we take cartons and pack our related stuffs in different cartons, we call it  "packaging" and this combination of related stuff in one carton make it a "package". 
Now,consider why we package different related stuffs in different cartons?
Answer is simple,it is just process of organizing the stuff.And more whenever we need to use it or unpack it, we should not confuse or conflicted and can access those packed stuffs in easy way.

Same way in Java,  
  • A Package is a grouping of related types.Here type refers to classes, interfaces, enumerations, and annotation types. 
  • The types that are part of the Java platform are members of various packages that bundle classes by function. for example :fundamental classes are in java.lang , classes for reading and writing (input and output) are in java.io, so on...many different packages are available in java, based on functions they perform.
  • When we create an application in java, then writing the classes in proper packages is considered important factor
  • When we use package in our .java file then package should be first statement in your java source file
  • Specifying class name with package name called as full-qualified name for the class. 
Advantage of packages

Packages avoids name conflicts It resolves naming conflict of classes by prefixing the class name with a package name. For example,in.technoscience.Abc and in.science.Abc are two distinct classes. Although they share the same class name Abc, but they belong to two different packages: in.technoscience and in.tscience. These two classes can be used in the same program and distinguished using the fully-qualified class name. This mechanism is called Namespace Management.

Packages provides hierarchical organization
With packages, you can organize a program into logically related groups of types, and organize the groups hierarchically. For example, all the types in a particular family of types could belong to the same package, or be spread out across several packages.
A class in one package can subclass a class in another package. The only requirement is that the subclass must specify the name of the package containing its superclass as well as the superclass's simple name. When you organize your types into packages, what you are actually organizing is type names.(i will explain in upcoming post).

Packages helps in Access Control 
Java has access control modifiers public,private,protected and default,out of which protected and default are related to package. A protected entity is accessible by classes in the same package and its subclasses. An entity without access control modifier (i.e., default) is accessible by classes in the same package only.(i will explain these all in upcoming posts)

Packages helps in building Libraries for distribution 
Any Java program you write will make use of libraries developed by others and made available to your program as packages. Any program will at least use the run-time libraries of the Java API, some of which are java.lang,java.io,java.util java.applet and many more. If, rather than developing a complete program, you wish to develop class library that other developers can use in their programs, your end-product will be a package.  

Package Naming Conventions 

Package names are written in all lower case to avoid conflict with the names of classes or interfaces.
A package name is made up of the reverse of the Internet Domain Name (to ensure uniqueness) plus your own organization's internal project name, separated by dots '.'
Packages in the Java language itself begin with java or javax

Package Name and Directory Structure 

The package name is  associated with the directory structure used to store the classes. The classes (and other entities) belonging to a specific package are stored together in the same directory. Furthermore, they are stored in a sub-directory structure specified by its package name. 
For example, the class Abc of package in.technoscience.first.subproject2 is stored as "$BASE_DIR\in\technoscience\project1\subproject2\Abc.class", where $BASE_DIR denotes the base directory of the package. The "dot" in the package name corresponds to a sub-directory of the file system.

The base directory ($BASE_DIR) could be located anywhere in the file system. Hence, the Java compiler and runtime must be informed about the location of the $BASE_DIR so as to locate the classes. This is accomplished by an environment variable called CLASSPATH. CLASSPATH is similar to another environment variable PATH, which is used by the command shell to search for the executable programs.


Monday, March 24, 2014

FIRST PROGRAM , Part 4 - Some Rules To Consider For Writting Java Source(.java) File.

In First Program series, till now i have explained how to write , compile and run .java file. Here i will tell about some rules which we should consider before writing and saving the Java source file. (just consider these rules , in later posts i will explain about public, private, protected, default).
  1. There can be only one top level public either class or interface in any java compilation unit ( .java source file ).
  2. If there is a public class in a file, the name of the file must match the name of the public class.
  3. There can be any number of default classes/interfaces per src file.
  4. A file can have more than one nonpublic class
  5. A file can be without public class ( but top level class can't be private or protected)
  6. Files with no public classes can have a name that does not match any of the classes in the file.
  7. Comments can appear at the beginning or end of any line in the source code file; they are independent of any of the position rules.
  8. If there is main method and public class then main method should be in that public class.
  9. If there is no public class and no main method then any valid name which may or may not be matching with the class/interface names in the file will be allowed.
  10. If the class is part of a package, the package statement must be the first line in the source code file, before any import statements that may be present.
  11. If there are import statements, they must go between the package statement (if there is one) and the class declaration. If there isn't a package statement, then the import statement(s) must be the first line(s) in the source code file. If there are no package or import statements, the class declaration must be the first line in the source code file.
  12. Import and package statements apply to all classes within a source code file.In other words, there's no way to declare multiple classes in a file and have them in different packages, or use different imports.
Some curious mind may be thinking on why Java source file can have one only public class? (for better learning we should avoid such questions at this stage)

Here, first i would like to share the approach to answer these kind of questions. 
To answer these questions , try to write what has been asked ,i mean, if it has been asked can we have more than one public class in single src file then to answer this do practicals and write a src file with two public classes and see yourself what the problems you will be facing ( this approach has always helped me to learn in better way). 
Anyway, here is my simple answer(may not be at technical advance level):
  • If two public classes were allowed, we should give the file two names which is terribly meaningless to file system.
  • If two public classes allowed, we should have two main methods which is terribly meaningless to java.
  • I think the above points are forced by compiler to make the job of both compiler and jvm to find particular java source file or class file easy and quick for the compilation/loading/linking. Java has such built in restrictions which developers should follow to have better programming.

FIRST PROGRAM, Part 3 - compilers's magic.

In the FIRST PROGRAM series, Part 1 , i have explained how to write , compile and run your java program using command prompt. Even you can write it in Eclipse IDE that i have explained here.

In both the case after compiling we get the .class file and in the Tools Series Part1 , i have explained decompling .class file.

After following above post, when you will open .class file with Cavaj decompiler you will find something that was not written by you.

This is the code that you had written:
public class Abc {
 public static void main(String[] args) {
  System.out.println("hello java");
 }

}

Now When you will open .class file in decompiler you will find following code:
Now you can differentiate both code ( the code written by you and code that you get after decompilation). This code contains lots of extra code that you have not written in your .java file.

1st extra line of code :import statement==>import java.io.PrintStream ; 
2nd extra line of code : default constructor
public Abc(){
  
 }
I will explain about these line of codes in upcoming code, here i want you to focus on some extra work done by compiler beside just converting .java file into .class.

As a summary we can conclude compiler does following, step by step 
  • compiler optimizes your code ( i will explain this in variable section)
  • compiler puts extra lines of code for compilation (don't rely on compiler for lots of codes)
  • then it performs the syntax checking.
  • and if compiler finds all syntax correct then it generates .class file
This is just overview of what the compiler did for complete compilation. In coming post i will be explaining detail of it with sequence of questions and answers.

Sunday, March 23, 2014

Eclipse , Part 4 - First Java Program In Eclipse

In Eclipse Series, Part 3 , I have explained about Eclipse User Interface Used For Java Development. 
Here, I will explain how to create first new java program in eclipse

Create Project
Select FileNewJava project from the menu. Enter  as the project name. Select the Create separate folders for sources and class files flag.
Following this interface you will get new window as follow :

Project name : here we write the relevant name of project we want to create.

checking the default location point to the workspace we have chosen in eclipse startup.

JRE : this blocks point to the jre installed in our system, we can change it using drop down but the chosen jre should be available in our local machine.

A radio button to choose folders for .java file and generated .class file.

                                                           




Press the Finish button to create the project. A new project is created and displayed as a folder. Open the in.technoscience.first folder in specified workspace and explore the content of this folder. 

Saturday, March 22, 2014

Eclipse, Part 3 - Java Development User Interface

In Eclipse series, Part2  i have explained how to start working with Eclipse. here i will explain what user interface you need to understand for Java development with eclipse.

Perspectives in Eclipse 

For Java development you usually use the Java Perspective, but Eclipse has much more predefined perspectives, e.g., the Debug perspective and for web development Java EE perspective
Eclipse allows you to switch to another perspective via the WindowOpen PerspectiveOther... menu entry

Sometime you changed the arrangement of views and editors in your perspective and you want to restore Eclipse to its original state. For example, you might have closed a view .
You can reset a perspective to its original state via the WindowReset Perspective menu entry.
  
Java perspective and Package Explorer 

The default perspective for Java development can be opened via WindowOpen PerspectiveJava.
On the left hand side, this perspective shows the Package Explorer view, which allows you to browse your projects and to select the components you want to open in an editor via a double-click. 
For example, to open a Java source file, open the tree under src, select the corresponding .java file and double-click it. This will open the file in the default Java editor.
In the middle you see the open editors. Several editors are stacked in the same container and you can switch between them by clicking on the corresponding tab. Via drag and drop you can move an editor to a new position in the Eclipse IDE.

To the right and below the editor area you find more views which were considered useful by the developer of the perspective. For example, the Javadoc view shows the Javadoc of the selected class or method.


Friday, March 21, 2014

Eclipse , Part 2 - Getting Started

In last Post ,i have explained how to install and configure Eclipse in local system.
Now i will explain how to start working with eclipse.

To start Eclipse, double-click on the eclipse.exe (Microsoft Windows)  file in the directory where you unpacked Eclipse.
The system will prompt you for a workspace. The workspace is the place in which you work.
Select an empty directory and click the OK button
Eclipse starts and shows the Welcome page. Close this page by clicking the x beside Welcome
After closing the welcome screen, the application should look similar to the following screenshot. 

Some Eclipse Terminology, Good to know 

Workspace

The workspace is the physical location you are working in. Your projects, source files, images and other important aspects can be stored and saved in your workspace. The workspace also contains preferences settings, plug-in specific meta data, logs etc.
You typically use different workspaces if you require different settings for your project or if you want to divide your projects into separate directories.
You can choose the workspace during startup of Eclipse or via the menu (FileSwitch WorkspaceOthers) . 
Eclipse Projects
An Eclipse project contains source, configuration and binary files related to a certain task and groups them into buildable and reusable units. An Eclipse project can have some specific natures assigned to it which describe the purpose of this project. For example, the Java nature defines a project as Java project. Projects can have multiple natures combined to model different technical aspects.
Natures for a project are defined via the .project file in the project directory.

 

ECLIPSE ,Part 1- Installation & Configuration

What is IDE ?
IDE means integrated development environment which is a programming environment that has been packaged as an application program, typically consisting of a code editor, a Compiler a debugger, and a graphical user interface builder.

What is Eclipse ? 
Eclipse is a famous Java development IDE, which helps to provide customize environment and helps in fast development process. 

How to get an Eclipse for Java Development ?
At the time of this post, the latest Eclipse package version available to download is Eclipse 4.3.2. Eclipse releases are named after the moons of Jupiter, and each denotes a successive release.
Eclipse is free for downloading. All you have to do is navigate to http://www.eclipse.org/downloads , chose and download the Eclipse package suitable for your requirements from one of the download mirrors available.
like :

What are per-requisite for running Eclipse in our system ?
Since Eclipse is a Java program, you will need to have Java installed on your computer to run Eclipse [Refer to Installation and configuration post ].

Java is available in two main distributions: the Java Runtime Engine (JRE) and the Java Development Kit (JDK). If you are using Eclipse for Java development, the JDK offers several advantages, including the availability of source code for the Java classes. If you are using Eclipse for something other than Java development, the JRE is all you need. Once you have a Java VM installed, you’re ready to work with Eclipse.