Sunday, December 9, 2018

Java Interview Preparation article :1

Time and again I get requests to write on preparation for interviews in Java. So I am planning to write series of post targeting interview preparation.
To start if the interview is for service based company the key is breadth. And for product based company its the depth. The exception for (breadth/depth) is directly proportional to years of experience.
Another point I want to make entry level roles (0 years to 5 years) you need to do well in java interview rounds to get selected. For more experience this round is kind of elimination round.

Topics in core Java

  1. OOPs concept
  2. Java key word, more priority to the latest released key words.
  3. Inheritance, interface, marker interface, abstract class and is a has a relationship  
  4. Enums
  5. The details about java.lang.Object 
  6. Strings 
  7. Exception handling
  8. Collections 
  9. Threads and Concurrent Package
  10. Design Pattern
All these topics will cover good amount of ground. There might be some here and there question about garbage collection, jvm architecture, java memory management etc. Those questions were more relevant when java was dominant. Now we see the increase popularity of python, Scala so its kind of ok to focus energy in understanding other topics.

Once you get thorough these topic next stage is Java in web development, which we will see in another post. 

Tuesday, August 7, 2018

BlockingQueue

Producer - consumer problem arises in multi thread environment. This can be defined when there are one or more threads generate data independently and same time one or many threads read those data to process independently.

To solve this we can have an array and there would be synchronized method to access. So when one thread only can either read/write at same time. If the array is full, producer threads need to wait. And if the array is empty consumer threads need to wait.

java.util.concurrent package comes with Blocking queue which is very handy to solve this problem.
Blocking queue is an interface. ArrayBlockingQueue  is an concrete implementation of interface. It allow both wait or fail for producer if the queue is full, same way for consumer it fails or waits if the queue is empty.

Some sample codes can be foundin https://github.com/pallabrath/myexpjava/tree/master/myexpjava/src/demo/blockingQueue

What we discussed here is in the scope of single instance. If we want scale then there would be more than one instance. In that case of distributed environment we need different kind of solution. Java message queue fit into this situation.

Again if we scale further and we want to process data in large volume, Kafka goes well in the distributed environment. Kafka itself run on one or many node to scale.

We will discuss Kafka in a separate thread.

Saturday, June 10, 2017

I too want to be cloud developer

In last few years cloud was one of those word which we developer hardly spend a day with out listening. In fact its becoming quite louder and in future we will see more software run in cloud. As a developer I always wonder cloud means what change in my design and coding. Any way my java program need a JVM whether its on premise or in cloud how does it change. Users will see my web app through a browser what changes if it served from a on premise web server or a cloud web server at the end we need a Java servlet container to run our server side code. So how will I adapt to this cloud computing ?

As I started seeing cloud from more close quarter, I can say with some minor tweaks we can leverage the power of cloud computing. While talking about the cloud the next word come to my mind is "elasticity". It means our IT resources like computing storage etc can seamlessly expand and contract based on the need. With out upfront H/W cost we will pay as we use and we will use as we need. This particular things bring down the cost of IT. So for a developer like us increase the scope of further imagination. We can have more storage and compute as we need.

To appreciate the elasticity nature of the cloud our software design should be truly distributed and loosely coupled. If the software is segregated in different independent component then its very easy for a particular component can scale to meet demand, which will be the most efficient use of resource. All these things are also popularly known as micro service architecture.

Another good thing is cloud vendors provide a lots of standard software building blocks and technique. So we can quickly turn around new features and software.

I believe that cloud will make software more affordable so that more people can use the power computing.