Wednesday, May 10, 2017

Maven as a Build Tool

Have you heard "Maven" before..?? I will explain to you it in a  way you can understand what is and why we have Maven.

When you are creating a project normally you need to add necessary supporting libraries. Have you experienced in having difficulties when you were doing this. Hope most of you will say the answer as "yes". 

Can we avoid those issues by having a tool which add all necessary libraries while you are building your project. The answer is obviously "yes". Because here you have Maven for do everything on behalf of you.



Maven makes Java programming easy..Although it referrers to as a build tool, but it is so much more that that.

We can use Maven to manage the entire lifecycle of our project in a way generating reports, and storing documents with its POM ( Project Object Model) repository. 

And it is not just for Java; C/C++, PHP, and Scala programmers can use Maven, too.

What is Maven..??
  • Maven is a "build management tool".
  •  Defines how our "*.java" files get compiled to "*.class" and  packaged into "*.jar" (or "*.war" or "*.ear") files.
  • Manages our CLASSPATH and all other tasks that are required to build our project. 
  • Similar to "Apache Ant" or "Gradle".
  • It attempts to be completely self-contained.
  • We don't need any additional tools for other common tasks like downloading & installing necessary libraries.
What are the main benefits of using maven ..??
  • We can get our package dependencies easily.
  •  Forces us to have a standard directory structure.
What are the Objectives of Maven..??
  • Making the build process easy.
  • Providing a uniform build system.
  • Providing quality project information.
  • Providing guidelines for best practices development.

Tuesday, May 2, 2017

Single-Page Applications (SPA)

You could find hundreds of reading stuffs about the single page application easily from the internet.But for the beginners  who are looking for get a basic idea about what is single page application, I hope you could get an clear idea from this blog. Here I have simply explained the basics of Single Page Application.
  • Let see simply what is SPA is..?
SPAs are web applications that load a single HTML page.
  • What is mean of "load a single HTML page"..?
That means we dynamically update that page when user interacts with the app.
  • How we can dynamically update the page..??
SPAs heavily use AJAX and HTML5 to create responsive Web apps, without constant page reloads. Simlpy it is the way we communicate with back-end servers without doing a full page refresh and get data loaded into our application. That means much of the work (process of rendering pages)  happenns on the client side.
  • Why we need SPA over regular website..??
Because in regular web app, every time when the application needs to display the data or need to submit data back to server it has to request a new page from the server and then render it in the web browser.

So why we cannot use this approach..??


With this approach nothing wrong if our application is a simple application. But when we need to create a rich user interface then our page might become very complex and we need to be loaded with lot of data.

Hence in this approach we need to ,

  • Generate complex pages on a server.
  • Transfer them to the client over internet.
  • Render them into the browser.
Because of these reasons it takes rime and degrade the user experience. So now have moved to SPAs with AJAX.
SPA allows refreshing only parts of the page when needs instead of reloading the whole page each time. It helps to improve the user experience since it is the way of reduced amount of pages refreshes. .

From the image I have put below, you could get a better picture in your mind about how SPA and regular app work.




Here are some advantages and disadvantages of SPA.

SPA advantages
  • Faster page loading time
  • Improved user experience
  • Decoupling front-end and back-end 
  • No need to write the code to render pages on server.
SPA disadvantages
  • Heavy client frameworks which are required to be loaded to the client

I hope you have got a basic understanding about single page application from here.