Saturday, November 9, 2019

Benefits of Spring Framework

Benefits of Spring Framework in Java

Spring Framework's fundamental mission is to simplify Java development. 

Four key strategies which Spring  uses for simplifying java development are :

1. Lightweight nature of Spring and non invasive POJO development.
2. Using Dependency Injection for Loose coupling.
3. Declarative programming through aspects.
4. Boilerplate code is eliminated with aspects and templates 


Spring is Light weight .Spring provides different modules and allow us to use any one based on the requirement, Ideally the spring jar is just 2-3 MB. 

Increasing the power of Non Invasive Pojos.
While using most of the frameworks during java development like Struts 1  and Ejb 2, we have to extend framework related classes or implement interfaces. This makes our Java beans coupled up with the framework decreasing its re-usability. Spring avoids (as much as possible) littering your application code with its API

While using Spring we are not forced to implement a Spring-specific interface or extend a Spring-specific class. Although these Spring POJOs are very simple but can be powerful through the use of Dependenct Injection and AOP. 



For Training Check my Website Online Spring Framework Training From India 











Tuesday, November 5, 2019

Rock Paper Scissors Java Program Code

Developing Rock Paper Scissors Game using Java

In this example we are going to develop a Rock Paper Scissors Game using Java. Developing games while learning java enhances our programming skills.

The Rule of the Game are as follows:

  1. Rock beats Scissors.
  2. Scissors beats Paper.
  3. Paper beats Rock.
  4. Who ever wins 5 times first is the Winner.
  5. In this example the game will be between a user and the computer.





Learn Core Java Properly through my Private Core Java Online Training to be able to write games in java easily.

Rock paper Scissors Java Program Video Tutorial


Steps of the Rock Paper Scissors Java Program

  1. We will create a class Player.java that represents the user who is going to play the game with the computer.
  2. The class Computer.java represents the Computer that is playing with the user.
  3. Driver.java is a helper class containing the Rock Paper Scissor constant variables and the business logic code.
  4. RPS.java is the class containing the main function where the program execution will begin.
  5. We will ask the user to enter his name. Then select one among ROCK PAPER SCISSORS.
  6. Then we will let the computer randomly select ROCK PAPER SCISSORS.
  7. We will use the business logic function to find out who wins. And every time we will display the selections made and who won.
  8. The user can decide to end the game any time.
  9. We will keep a track of who wins 5 times first. And then display the winner.

Player.java will represent the User playing with the computer.