Java-J2EE Technical Architect Interview Questions and Answers


Java/J2EE Technical Architect Interview Questions and Answers

Q: Explain J2EE architecture.
A: The JEE platform provides the environment to develop enterprise applications / services using multitier architecture. The highly intensified technology made the need for scalable, efficient, faster solutions for information management. The JEE technology is rightly apt for meeting these requirements. JEE provides a programming development environment which improves the productivity of development, standards for hosting / deploying enterprise applications.
The following are the tiers in JEE application
Client Tier: The client tier includes the web components such as Servlets, JSP or standalone Java Desktop applications. This tier provides dynamic interfaces to the middle tier.
•             Middle Tier: This also called as the server tier. In the middle tier enterprise beans and web services encapsulate distributable business logic for the applications which are reusable. The JEE application server contains the server-tier components which provides the platform for these web components for actions to be performed and data to be stored / persisted.
•             Enterprise data tier: The enterprise level data is stored / persisted preferably or typically in a relational database, in this tier.
The JEE applications comprises of components, containers and services. All the web components (Servlets, JSP) provide dynamic requests and responses from a web page. The EJB components contain the server-side business logic for enterprise applications.

Q: J2EE is a container centric architecture. Explain.
A: A container acts as an interface between a platform-specific functionality and a component. The component must be assembled before a web or enterprise bean or application client component execution, into a JEE application and deployed into its container.
The settings of a container can be customized for underlying support provided by the JEE server. These include security, transaction management, and Java Naming and Directory Interface lookups.
The management of non-configurable services such as servlet life cycle, enterprise bean life cycle, database connection, data persistence, database connection pooling also can be done by the container.

Q: Explain the four types of container that the J2EE specification defines.
A: A container is a runtime support of a system level entity [Applet, Servlet/JSP, EJB]
The four types of container that the J2EE specification defines are applet container, application-client container, web container and EJB container.
Applet Container : An applet is a java program that can be embedded into a web page.
Most of the web pages are authored in HTML. To use an applet in HTML document , the tags <APPLET> and </APPLET> are used. They are used to indicate to the browser that a java applet should be loaded. “These tags act as a container for the java applet definition. “ Applet container manages the execution of applet, and contains the web browser.
Application-client Container : The Application Client Container (ACC) is a combination of Java classes, libraries, and other files. They are used to distribute along with Java client programs that execute on their own JVM. The execution of the application client components is managed by the application-client container. The ACC can take the responsibility to collect user name and password which is treated as authentication data.
Web Container : A web container is a part of web server. It provides the run time environment to execute a web application such as a servlet, JSP. A servlet container translates the URL requests into servlet requests. The JSP implicit objects such as request, response, out, page, pageContext etc., are exposed by JSP container.
EJB Container : The EJB container, like other containers provides run-time environment to execute EJB components such as enterprise beA: An EJB Container manages transactions, state management details, multi threading, connection pooling. The applications are provided with security using EJB container. All database access required by the entity bean will be handled by the EJB container.

Q: Explain the J2EE container architecture.
A: J2EE Container Architecture:
The J2EE application components needs support at runtime. This support is provided by J2EE containers. They use protocols, methods of the containers to access other application components. The containers of J2EE are 1) Web container 2) EJB container.
1) The web container is used to host web applications. It provides the run time environment to execute Servlet and JSP component types.
2) The business logic is dealt by the server components called EJB components. The access to local and remote enterprise beans is provided by the EJB container. The operations of the three beans namely Entity Bean, Session Bean and Message-driven bean are handled by the EJB Container.

Q: Explain the technologies that J2EE platform provides for developing components.
A: 1) Servlet Technology: It is considered as the foundation of web technologies. It overcomes the limitations of CGI technology. It is a server side component to serve the clients and to generate dynamic content. Servlets interacts with web clients using the paradigm ‘request-response’. All client requests are sent through web servers to the servlet container. The servelt then process the request and sends the response back to the client. Servlets are reliable, scalable, efficient and reusable server side components.
2) JSP Technology: It is the extension of servlet technology. It is easy to author JSP without much knowledge of the supporting API. JSP can be used to work with HTTP requests and HTTP responses, session management and so on. It is easy to combine both static and dynamic content with JSP. The factor to develop JSP technology is to use regular HTML tags. The JSP author can place servlet or simple java code in the page by using special designated tags. The entire JSP will be translated into Servlet and the servlet related code is communicated to container to run.
3) EJB Technology: EJB is a server-side web component. It depends on other Java technologies for proper functionality such as Remote Method Invocation. RMI is used as a protocol between 2 enterprise beans and between an enterprise bean and its client. EJB encapsulates the business logic. All EJBs are developed, deployed and run only in an EJB container. This is similar to servlets and JSP run in a web container.
EJB applications are easy to develop because the applications developer can concentrate on business logic. The developer can utilize the services provided by the EJB container, like connection pooling and transactions.

Q: Explain the J2EE APIs, i.e. RMI/IIOP, JNDI, JDBC, Java Mail and JMS.
A: RMI/IIOP: RMI stands for Remote Method Invocation. IIOP stands for Inter Internet-ORB Protocol. ORB
RMI/IIOP API is used to write distributed objects using Java technology, which enables communication between objects in the memory, across JVM and also physical devices.
RMI/IIOP yields the benefits of OOP such as inheritance, polymorphism and encapsulation and is platform independent. In RMI/IIOP, the code related to network is written by applying the interface but not the implementations. The operation can solely on the interface that object’s class.
RMI-IIOP relies on object serialization for passing parameters via remote method invocations.
JNDI ( Java Naming and Directory Interface) API : To enable java programs to access the naming and directory services, the JNDI API is utilized. Naming services emphasizes on the services that are to associate names with objects.
We are familiar with naming systems such as the file system which has a directory or path associated it. Surfing web is associated a name that is the URL called Domain Naming System. EJB components of a J2EE application server , user profiles are associated in LDAP(Lightweight Directory Access Protocol) directory.
For example , JNDI is the best API to write a java application that is used for search utility over network-enabled desktop, class-browser or an address book search utility.
JDBC(Java Database Connectivity) API : Many java applications use a database and database accessing and programming is a significant role in web application development. JDBC is an API that enables the accessibility to a database in order to manipulate the database.
The JDBC API supports both two-tier and three-tier models for database access.
Two-tier model -- a Java application interacts directly with the database.
Three-tier model -- introduces a middle-level server for execution of business logic: the middle tier to maintain control over data access.

The application that uses the JDBC implements the following sequence.
1. Importing Packages
2. Registering the JDBC Drivers
3. Opening a Connection to a Database
4. Creating a Statement Object
5. Executing a query and Returning a Result Set Object
6. Processing the Result Set
7. Closing the Result Set and Statement Objects
8. Closing the Connection

Java Mail API: Mailing and Messaging applications can be modelled or developed using Java Mail. The e-mail messaging applications can be developed for both high-level implementation and low-level implementation. That is, a small company which is heading towards growth can develop solutions which ensures the accessing to their mail server in an efficient manner. A blue-chip company can focus on providing the access to industry-level access which is a wider reach and provides vast support.
JMS: Java Message Services is an API that enables the components of an application, could it be JSE or JEE component to provide messaging services such as create, send, receive and read messages. Using the loosely coupled, reliable and asynchronous communications are enabled by JMS.
The JMS application contains the following parts :
1.JMS Provider : It implements the JMS interface and provides the administration and control services for the messages. J2EE 1.3 includes the JMS Provider service.
2.JMS Clients : These are the java applications that produces or consumes the messages.
3. Messages : These are the objects that communicate the messages between clients.
4. Administered Objects : They are the JMS objects created by the administrator that can be used by the clients. They are namely destinations and connection factories.
5. Native Clients :These are the applications that use message client’s native client API instead of JMS API.

Q: What are the 3 different Java platform editions? Explain them.
A: Java 2 Platform, Standard Edition (J2SE)
Java 2 Platform, Enterprise Edition (J2EE)
Java 2 Platform, MicroEdition (J2ME)
Java 2 Platform, Standard Edition (JSE): J2SE is used to develop stand alone / desktop portable java applications. J2SE consists of two components. Core component and desktop component. Core component provides back end functionality. Desktop component provides GUI functionality. J2SE consists of Java Development Kit and Java Runtime Environment. JDK consists of java compiler and other related tools to enable the users to create Java Applications. Java Runtime Environment consists of java virtual machine, libraries and all other components that are necessary to run a java application.
Java 2 Platform, Enterprise Edition (JEE): J2EE is a platform to develop multi-tier enterprise applications. JEE includes Servlets API, Java Server Pages and Enterprise Java BeA: It was built on J2SE technology.
Java 2 Platform, Micro Edition (JME): JME is the technology for micro electronic devices like PDAs, Mobile phones etc. JME supports the flexibility for user interfaces, provides the security and uses the built-in network protocols for networked applications.JME applications can be ported across different devices.

Q: Provide an overview of web container.
A: The web container is used to implement the web components functionality. The functionality specifies an environment, called as runtime environment which the web components security, deployment, life-cycle management transaction management, request-response services. A container manages the servlet / JSP/ EJB functionality. J2EE server runs the components and the containers. A web container will also manage the database connection pooling, data persistence and access to the J2EE API.
Explain the Java Servlet programming model.
The servlets are server side components in a web application. These components platform independent and on any server as the java technology is platform independence. The servlets are dynamically loaded by the JRE of servlets. When a request is received from a client the web container / web server will ignite the servlet. The servlet processes the request the sends the response back to the container / web server which in turn sends the response back to the client.
Describe in brief about deployment descriptors.
A deployment descriptor describes the configuration information to deploy a web application. For a web application, it directs the deployment tool that is to deploy a module for a specific container such as ejb container / servlet/jsp container. For web applications the deployment descriptor is web.xml and must be placed in a WEB-INF directory of a web application root directory. For EE deployment descriptor the name should be application.xml and must be placed in a META-INF directory at the top level of the application .ear file.

Q: Explain the J2EE container architecture.
A: J2EE Container Architecture:
The J2EE application components needs support at runtime. This support is provided by J2EE containers. They use protocols, methods of the containers to access other application components. The containers of J2EE are 1) Web container 2) EJB container.
1) The web container is used to host web applications. It provides the run time environment to execute Servlet and JSP component types.
2) The business logic is dealt by the server components called EJB components. The access to local and remote enterprise beans is provided by the EJB container. The operations of the three beans namely Entity Bean, Session Bean and Message-driven bean are handled by the EJB Container.
J2EE Components:
Application components:
Every JEE application is made up of different components. A component can be defined as software that is self-contained functionality that is a part of JEE application related in terms of classes, files and perform communication with other components. The JEE components are
•             Applets, Application clients are client components
•             Servlets and JSP technologies are referred as web components
•             The EJB components that comprise enterprise beans are referred as business components.
JEE components are authored using java programming language and compiled just like a simple java desktop applications. JEE components are deployed according to the production requirement and managed by the JEE server.
JEE containers:
All JEE components are installed in the respective containers while deploying the web applications. All the components are supposed to be assembled into a JEE application and then deployed in the respective container, before the execution of a web, an enterprise bean or even application client component execution.
Container Types
The deployment process is container specific.
•             An EJB container manages the execution of all enterprise beans for a specific JEE application. The enterprise beans and their container will be run on JEE server.
•             A web container is responsible for the execution of all servlets components and JSP for a specific JEE web application. These web components and the corresponding container will be run on JEE server.
•             The execution of all application client components for a JEE applications is managed / executed by an application client container. The application clients and their applications run on the client machines.
•             A container by name applet container is a web browser. The applet container along with Java plug-in combination runs on the client machine.
JEE API:
In order to run all the JEE SDK for web applications, the JSE SDK is needed. The JSE SDK provides the entire required core API for writing JEE components and the JVM. The following are the JEE APIs that are to be used in JEE applications.
•             EJB API - This API enables the fast, simplified distributed application development at enterprise level.
•             JDBC API – Enables the relational database accessibility for java applications
•             Servlet API – Provides simple consistent mechanism to manage the application at web server level.
•             JSP API - Provides simple and fastest dynamic web page development
•             JMS API – Provides the mechanism for simple messaging services
•             Java Transaction API – An interface between transaction manager and the others involved in distributed transaction system.
•             Java Mail API – Provides platform and protocol independent mailing services

Q: Explain the Java Servlets. Explain its lifecycle.
A: A servlet is a java class that provides a powerful mechanism for developing server side application programs. It provides the component-based, platform-independent methods for building any web based applications by overcoming the performance limitations of CGI programs. A servlet application can run on any servlet enabled web container. It runs completely in a JVM. Browser compatibility is not an issue as the servlet run at the server side. The set of HTML-based calls can also be accessed by the servlets. For interactive web applications, servlets is the right choice.
Servlet life cycle:
The servlet life cycle includes four stages:
•             Loading and Instantiation : The servlet container loads the servlet during and startup of a web application and or when the first request is made. The container creates the servlet instances after loading the servlet .
•             Initialization: Soon after the creation of the instance of a servlet, the container invokes the init() method and passes the servelt’s the initialization information to the init() method. The init() must be called by the servelt container before performing any requests by the servlet.
•             Responding for the requests: Once the initialization is properly done, the servlet is ready to service the requests. The servlet creates separate threads for each and every request. The servlet container invokes the service() method which in turn invokes the appropriate doGet() or doPost() methods for handling the requests and sending responses to the client using response objects.
•             Destroying the servlet: If the servlet is not needed for processing the requests, the destroy() method will be invoked by the container. This method also invoked only once through out the life cycle of a servlet. Invoking the destroy() method indicates the servlet container not to send any requests for the service and the servlet will release the resources that are associated with it. JVM will claim the memory with the resources for garbage collections.

Q: Explain JSP. Describe JSP lifecycle.
A: Java Server Pages (JSP): A JSP is used for the development of dynamic web pages. JSP provides the server side scripting support for creating web applications that uses database. JSP encourages the developers to directly insert the java code into .jsp file. This process is very simple to develop and maintain.
JSP are loaded into the web servers’ memory as soon as receiving the request in the very first time. The subsequent calls are served within a very short span of time. The usage of JSP in combination with JDBC is very easy to efficient to develop the database specific applications. JSP are platform independence as java is and any JSPage can be ported to any platform.
JSP Life Cycle:
JSP services the requests from clients as that of a servlet. At the time of the JSP request mapping, the request is handled by a special servlet. This servlet first checks whether the first JSP servlet is older than the JSP. If it is so, the translation of JSP into servlet class and compilation of this class is done. And then the request is handled by the servlet like an ordinary servlet.

Q: Explain the following java graphical interface framework.
A: Abstract windows toolkit (AWT)
Swing
Standard widget toolkit (SWT)
Abstract Windows Toolkit (AWT):
AWT provides the interface between the user and different windowing toolkits, such as buttons, checkboxes, radio buttons and menus etc. AWT establishes the connection between java applications and the Graphical User Interface. It is adequate to develop many applications. For example, the menus on the TV sets and other remote controls were developed using AWT (may be with Swings). AWT uses the basic GUI operating systems controls. AWT is a part of Java Foundation Classes(JFC).
Swing:
A Swing toolkit includes much more rich set of GUI tools compared to AWT. Few more high-level component sets are available in Swing such as (tree view, list boxes, tabbed panes, pop up windows, tooltips, icons). To leverage cross-platform capabilities, Swing supports more similar look and feel of the components. Swing is more flexible the all swing components are light weight, thereby reduces the loading time.
Standard Widget Toolkit (SWT):
SWT is an open source widget tool kit for developing rich, efficient and portable GUI applications. It was originally developed by IBM and being maintained by Eclipse Foundation along with Eclipse IDE. It is an alternative to AWT and Swing. To display the elements, it implements the operating system GUI libraries by using Java Native Interface. The SWT applications are portable and unique for each platform.
The need of SWT is to provide a common API for accessing different operating system / platform specific widgets. The goal for designing of SWT is high performance, native OS look and feel, and platform integration. Swing on the other hand, designed to allow for a highly customizable look and feel that is common across different platforms.
List out components by AWT? Explain each in brief.
•Button
•Canvas
•Choice
•Checkbox
•Container
         -Panel
         -Scrollpane
         -Windows
•Label
•List
•Scrollbar
•TextComponent
        -TextArea
        -TextField
Button: A component that is used to display the command button on the canvas. By clicking on the button, an action is performed
Canvas: A blank rectangular area on the screen on which an application can draw other components or on which an action can be trapped.
Choice: A component that pop ups a menu of choices and the current choice is displayed as the title of the menu.
Checkbox: A component that represents a check box that represents either true or false state. If the option is true, then a tick mark appears in the box.
Container: A component that can contain another set of components. All these components are tracked in a list.
•             Panel: It is one of the simplest container classes. A panel provides space to place other components including other panels.
•             Scrollpane: A container which implements the scrolling that can be horizontal or vertical for a child component.
•             Windows: Represents a top level window that has no borders and no menubar. A window must have a frame, a dialog box or another window as its owner window.
Label: A component to place text in a container that is displayed as read only text containing a single line
List: A component that specifies a list of items of text with a provision for the user to select a single or multiple items.
Scrollbar: A component that is used basically for moving the visible area, where the components / contents are not enough to appear in a single screen page.
Text Components:
•             TextArea: A component where multiple lines of text can be typed / visible. It can make to appear as read-only area or to appear for editing.
•             TextField: A component where a single line of text can be typed / visible.

Q: Tell us about yourself.
A: Told about me...

Q: What are your responsibilities as an Java Architect?
A: As an architect,i had to involve myself from project initiation till delivery and initial support. Some of the responsibilities are:
* Technical inputs during business analysis.
* Coming up with use cases and validating the same with business analysts and end users.
* Identifying the technology that will be used in the project .
* Recommending the development methodologies and frameworks.
* Defining the architecture and the infrastructure requirements.
* Providing the high level design and helping the designers in low level design.
* Defining and enforcing the coding standards.
* Conducting design audit.
* Guiding developers to accomplish difficult tasks.
* Helping to recruit technical people.
* Defining and achieving performance targets.
* Helping the project manager in planning and execution.

Q: What are the different types of project development methodologies that are available? Which one do you prefer or which one do you consider the best?
Waterfall model, Iterative model like the XP and RUP are widely used ones. For big projects, Waterfall model is mostly used. And of-late XP is also widely used. But in practice, all of them are tailored to suit the requirements of the project and are used exactly as specified.
And which one do you prefer?
A: Explain with adaptations.

Q: What is an use case?
A: An use-case is actually a requirement from the user of the system. An use-case is a statement of what the system will do at the request by one of the actors of the system.

Q: What do you mean by an actor?
A: An actor could be an end user or an external system who is serviced by the system.

Q: What are all the things you will consider when your application is required to communicate to an external system.
A: There could be many factors but primarily i will consider and finalise communication mechanism, data exchange format, error handling and the initiating events.

Q: What are exactly meaning by communication mechanism?
A: By communication mechanism, i mean synchronous or asynchronous communication. If the application requires immediate response, i will use synchronous communication methods or else asynchronous communication methods.

Q: Can you give examples synchronous communication methods? And which one do you prefer?
A: Sockets,HTTP,RMI,EJB,CORBA and web-services are all ways for synchronous communication. I would prefer web-services.

Q: Why web-services?
A: Web-services are based on service oriented architecture. They are platform independent. Web-services make the application highly loose coupled - for example a J2EE application can communicate with a .NET application with little effort and without any great hiccups.

Q: What data exchange formats do you prefer for inter-application communication?
A: XML is the preferred choice because of its simplicity and self-descriptive syntax. But sometimes you might really need an XML.

Q: Can you explain under what circumstances you avoided using XML for data exchange?
A: I worked on a banking application which had a suite of in-built applications which were built on the J2EE architecture platform. And we had general wrapper value objects which could be used across applications. There it did not make sense to convert the value object to XML just for the sake of using XML.

Q: When you pass Java value objects across applications, will it not lead to tight coupling of the applications?
A: As I told you earlier, these 7 applications were built using the same J2EE architecture, hence these inter-application data transfer objects were grouped as part of the architectural common components.

Q: Have you ever used any mechanism other than JMS for asynchronous messaging?
A: No. I havent come across any other J2EE framework for asynchronous communication. Moreover JMS is simple and highly stable for asynchronous communication.

Q: You have variety of options for persistence in J2EE. Which one do you prefer?
A: As you said, We have JDBC, Bean managed entity beans, container managed entity beans, hibernate, JDO, toplink, etc. Some are specifications from sun and others are open source frameworks. Each have their pros and cons. My first choice would be hibernate, if i had to tweak for performance and require control - i would go with JDBC.

Q: Why are you entirely avoiding entity beans?
A: First of all, entity beans havent evolved at the speed of market requirements. Its too heavy for database operations. Even with BMPs you dont really get the control you wanted. Entity beans are highly unsuitable for batch operations. And it also has a steep learning curve for junior developers. I have seen many architects who have stayed clear of entity beans for these obvious reasons.

Q: Will you prefer writing common components on your own for the application or will you prefer open-sourced components?
A: It depends on the project timelines, availability and quality of open-source components and the real value add.

Q: What is a value object?
A: Value object is a set of related data grouped together for purpose of communicating within the application. Value objects are simple objects with setter and getter methods and without any processing logic. They should be serializable because of their network transfer capability.

Q: Is there a difference between value object and data transfer object?
A: No. Both are one and the same.

Q: What is content negotiation?
A: Suppose we want to visit a site for any information, information can be represented in different languages like English,German or may be other and their format for presentation can also differ from HTML to PDF or may be Plain text. In this case when an client makes an HTTP request to a server, client can also specify the media types here. Client can specify what it can accept back from host and on the basis of availability the host will return to the client. This is called content negotiation because client and server negotiated on the language and format of the content to be shared.

Q: What are the different types of memory used by JVM ?
A: Class , Heap , Stack , Register , Native Method Stack.

Q: What are the benefits of using Spring Framework ?
A: Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product.

Spring is organized in a modular fashion. Even though the number of packages and classes are substantial, you have to worry only about ones you need and ignore the rest.

Spring does not reinvent the wheel instead, it truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, other view technologies.

Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Furthermore, by using JavaBean-style POJOs, it becomes easier to use dependency injection for injecting test data.

Spring’s web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks.

Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for example) into consistent, unchecked exceptions.

Lightweight IoC containers tend to be lightweight, especially when compared to EJB containers, for example. This is beneficial for developing and deploying applications on computers with limited memory and CPU resources.

Spring provides a consistent transaction management interface that can scale down to a local transaction

Q: What are various types of Class loaders used by JVM ?
A: Bootstrap - Loads JDK internal classes, java.* packages.
Extensions - Loads jar files from JDK extensions directory - usually lib/ext directory of the JRE
System  - Loads classes from system classpath.

Q: What is PermGen or Permanent Generation ?
A: The memory pool containing all the reflective data of the java virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. The Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application. The permanent generation is populated by the JVM at runtime based on classes in use by the application. In addition, Java SE library classes and methods may be stored here.

Q: What is metaspace ?
A: The Permanent Generation (PermGen) space has completely been removed and is kind of replaced by a new space called Metaspace. The consequences of the PermGen removal is that obviously the PermSize and MaxPermSize JVM arguments are ignored and you will never get a java.lang.OutOfMemoryError: PermGen error.

Q: How does volatile affect code optimization by compiler?
A: Volatile is an instruction that the variables can be accessed by multiple threads and hence shouldn't be cached. As volatile variables are never cached and hence their retrieval cannot be optimized.

Q: What things should be kept in mind while creating your own exceptions in Java?
A: All exceptions must be a child of Throwable.

If you want to write a checked exception that is automatically enforced by the Handle or Declare Rule, you need to extend the Exception class.

You want to write a runtime exception, you need to extend the RuntimeException class.

Q: What is the best practice configuration usage for files - pom.xml or settings.xml ?
A: The best practice guideline between settings.xml and pom.xml is that configurations in settings.xml must be specific to the current user and that pom.xml configurations are specific to the project.

Q: Can you provide some implementation of a Dictionary having large number of words ?
A: Simplest implementation we can have is a List wherein we can place ordered words and hence can perform Binary Search.

Other implementation with better search performance is to use HashMap with key as first character of the word and value as a LinkedList.

Further level up, we can have linked Hashmaps like ,

hashmap {
                a ( key ) -> hashmap (key-aa , value (hashmap(key-aaa,value)
                b ( key ) -> hashmap (key-ba , value (hashmap(key-baa,value)
                ............................................................
                z( key ) -> hashmap (key-za , value (hashmap(key-zaa,value)
}

upto n levels ( where n is the average size of the word in dictionary.

Q: What is database deadlock ? How can we avoid them?
A: When multiple external resources are trying to access the DB locks and runs into cyclic wait, it may makes the DB unresponsive.

Deadlock can be avoided using variety of measures, Few listed below -

Can make a queue wherein we can verify and order the request to DB.

Less use of cursors as they lock the tables for long time.

Keeping the transaction smaller.

Q: Why Web services use HTTP as the communication protocol ?
A: With the advent of Internet, HTTP is the most preferred way of communication. Most of the clients ( web thin client , web thick clients , mobile apps )  are designed to communicate using http only. Web Services using http makes them accessible from vast variety of client applications.

Q: Why using cookie to store session info is a better idea than just using session info in the request ?
A: Session info in the request can be intercepted and hence a vulnerability. Cookie can be read and write  by respective domain only and make sure that right session information is being passed by the client.

Q: Difference between first level and second level cache in hibernate ?
A: 1. First level cache is enabled by default whereas Second level cache needs to be enabled explicitly.

2. First level Cache came with Hibernate 1.0 whereas Second level cache came with Hibernate 3.0.

3. First level Cache is Session specific whereas Second level cache is shared by sessions that is why First level cache is considered local and second level cache is considered global.

Q: What are the ways to avoid LazyInitializationException ?
A: 1. Set lazy=false in the hibernate config file.
2. Set @Basic(fetch=FetchType.EAGER) at the mapping.
3. Make sure that we are accessing the dependent objects before closing the session.
4. Using Fetch Join in HQL.

Q: What are new features introduced with Java 8 ?
A: Lambda Expressions , Interface Default and Static Methods , Method Reference , Parameters Name , Optional , Streams, Concurrency.

Q: What things you would care about to improve the performance of Application if its identified that its DB communication that needs to be improved ?
A: 1. Query Optimization ( Query Rewriting , Prepared Statements )
2. Restructuring Indexes.
3. DB Caching Tuning ( if using ORM )
4. Identifying the problems ( if any ) with the ORM Strategy ( If using ORM )

Q: If you are given a choice to implement the code to either Insert a Record or Update if already exist, Which approach will you follow ?
A: 1. Insert into the DB Table. If exception occurs, update the existing record.
2. Check if the record exists and update it if it exists, If not insert a new record.
In first case, there would be 2 DB calls in worst case and 1 in best case. In 2nd approach there will be always 2 DB calls.
Decision on the approach should depend on the following considerations -
1. How costly is the call to DB ? Are we using indices , hibernate etc
If calls to DB are costly , 1st approach should be the choice.
2. Exception Book keeping load upon exception.
The benefit of saving 1st call in approach 1 should be bigger than the Book keeping for the exception.
3. Probability of the exception in first apparoach. 
If the DB Table is almost empty, it makes sense to follow Approach 1 as majority of the 1st calls will pass through without exception.

Q: What would you do if you have to add a jar to the project using Maven ?
A: If its already there in Maven local repository, We can add that as a dependency in the project pom file with its Group Id, Artifact Id and version.

We can provide additional attribute SystemPath if its unable to locate the jar in the local repository.
If its not there in the local repository, we can install it first in the local repository and then can add it as dependency.

Q: Should we create system software ( e.g Operating system ) in Java ?
A: No, Java runs on a virtual machine called JVM and hence doesn't embed well with the underlying hardware. Though we can create a platform independent system software but that would be really slow and that's what we would never need.

Q: Which UML diagrams you usually use for design ?
A: Use Case Diagram, Component Diagram for High level Design and Class Diagram , Sequence Diagram for low level design.

Q: How do you coordinate and communicate with the team developers ?
A: We as a team of developers , testers , analyst , lead and architect sit close to each other. Most of the time I would just jump to their seat and talk to them ( if required ). We have daily stand up where we discuss things that needs team attention.

Q: What kind of software architecture your organization follow ?
A: We have multi tier architecture with multiple layers , We have series of web servers and applications in application tier, infrastructure libraries at middle tier and Database servers at the lower tier. We are using Oracle as Database, ESB ( Enterprise service Bus ) for asynchronous communication and Rest Web Services.

Q: Difference between Proxy and Adapter Deisgn Patterns ?
A: Adapter object has a different input than the real subject whereas Proxy object has the same input as the real subject. Proxy object is such that it should be placed as it is in place of the real subject.

Q: Difference between Adapter and Facade ?
A: The Difference between these patterns in only the intent. Adapter is used because the objects in current form cannot communicate where as in Facade , though the objects can communicate , A Facade object is placed between the client and subject to simplify the interface.

Q: Difference between Builder and Composite ?
A: Builder is a creational Design Pattern whereas Composite is a structural design pattern. Composite creates Parent - Child relations between your objects while Builder is used to create group of objects of predefined types.

Q: Difference between Factory and Strategy Design Pattern ?
A: Factory is a creational design pattern whereas Strategy is behavioral design pattern. Factory revolves around the creation of object at runtime whereas Strategy or Policy revolves around the decision at runtime.

Q: Shall we use abstract classes or Interfaces in Policy / Strategy Design Pattern ?
A: Strategy deals only with decision making at runtime so Interfaces should be used.

Q: What are standard architectural questions:-
A: Characteristics of a good architect design/ Consideration for designing a good application architecture
                o             Should address functional requirements
                o             Should address non functional requirements
                o             Should address cross cutting concerns

•             Application Architecture layer - Key principles of Software Architecture
                o             Layered Architecture: A decomposition of services such that most interactions occur only between neighboring layers.
                o             Enterprise Process-Centric: A business process manages the interactions between multiple intra-enterprise applications, services, sub-processes and users.
                o             Component-Based Architecture -Decomposes application design into reusable functional or logical components that expose well-defined communication interfaces.
                o             Service-Oriented Architecture (SOA) -applications that expose and consume functionality as a service using contracts and messages.

•             Non functional requirements of the application design- at-least highlight important ones
                o             Scalability and capacity planning - considered for high user load
                o             High Availability - downtime and uptime of system
                o             Reliability and Usability -bug free system and easy to use
                o             Maintainability and Extensibility - quality code, standard routines  and upgradable, new releases
                o             Performance - Response, processing and tun around time of application

•             Cross cutting concerns of the application -some key concerns addressing
                o             Transaction processing
                o             Internationalization and localization which includes Language locale
                o             Information security -authentication and authorization
                o             Caching -local,server, network, database caching
                o             Logging
                o             Exception Management

•             UML Diagram and tools- key diagrams used by technical team
                o             Diagram
                                             Class diagram
                                             Sequence diagram
                                             Deployment diagram
                                             Use case diagram
                o             Tools
                                             Rational Architect
                                             Argo UML (freebees)
                                             Visual Paradigm
                                             Star UML etcs
                o             Reverse Engineering and code generation

•             J2EE Core Design Pattern -as per application layer
                o             Presentation Tier
                                             Intercepting Filter -intercepts incoming requests and outgoing responses and applies a filter.
                                             Context Object-encapsulates state in a protocol-independent way to be shared throughout your application
                                             Front Controller-a container to hold the common processing logic that occurs within the presentation tier
                                             Application Controller -centralizes control, retrieval, and invocation of view and command processing
                                             View Helper -encourages the separation of formatting-related code from other business logic
                                             Composite View -suggests composing a View from numerous atomic pieces
                                             Dispatcher View -defers business processing until view processing has been performed.
                                             Service To Worker
                o             Business Tier
                                             Business Delegate -reduces coupling between remote tiers and provides an entry point for accessing remote services in the business tier.
                                             Service Locator -encapsulates the implementation mechanisms for looking up business service components.
                                             Session Facade -provides coarse-grained services to the clients by hiding the complexities of the business service interactions.
                                             Application Service -centralizes and aggregates behavior to provide a uniform service layer to the business tier services.
                                             Business Object -implements your conceptual domain model using an object model.
                                             Composite Entity -implements a Business Object using local entity beans and POJOs.
                                             Transfer Object -provides the best techniques and strategies to exchange data across tiers
                                             T O Assembler -constructs a composite Transfer Object from various sources
                                             Value List Handler -uses the GoF iterator pattern to provide query execution and processing services.
                o             Integration Tier
                                             Data Access Object -enables loose coupling between the business and resource tiers
                                             Service Activator -enables asynchronous processing in your enterprise applications using JMS.
                                             Domain Store -provides a powerful mechanism to implement transparent persistence for your object model.
                                             Web Service Broker -exposes and brokers one or more services in your application to external clients as a web service using XML and standard web protocols

•             J2EE Application Design Pattern
                o             Creational Patterns
                                             Factory Pattern
                                             Abstract Factory Pattern
                                             Singleton Pattern
                                             Builder Pattern
                                             Prototype Pattern
                o             Structural Patterns
                                             Adapter Pattern
                                             Bridge Pattern
                                             Composite Pattern
                                             Decorator Pattern
                                             Facade Pattern
                                             Flyweight Pattern
                                             Proxy Pattern
                o             Behavioral Patterns
                                             Chain of Responsibility Pattern
                                             Command Pattern
                                             Interpreter Pattern
                                             Iterator Pattern
                                             Mediator Pattern
                                             Momento Pattern
                                             Observer Pattern
                                             State Pattern
                                             Strategy Pattern
                                             Template Pattern
                                             Visitor Pattern

•             J2EE Application Development Framework
                o             Spring 3.0
                o             Jakarta Struts 2.0 -Servlet life cycle
                o             EJB 3.0
                o             JSF
                o             JPA -Hibernate/ibatis
                o             AJAX
                o             GWT
                o             JSON
                o             FLEX -actionscript

•             J2EE Application Server - deployment and administration
                o             Apache Tomcat
                o             Websphere Application Server
                o             JBOSS
                o             WebLogic

•             Database Systems - SQL- complex queries -PL/SQL
                o             Oracle 9i/10g/11g
                o             SQL Server 2000/2005/2008
                o             MySQL 5.5

•             Application build management
                o             ANT - Build tools -build.xml/properties  MAVEN -pom.xml
                o             HUDSON - continuous integration build server

•             Source Version controls - resolving conflict, branching,tagging
                o             SVN
                o             CVS
                o             VSS
                o             GIT

•             SOA -implementation and approach
                o             Webservices -AXIS 2 framework, webservice annotation  RPC style and Restful services

•             JMS - MQ - MDB
                o             Point-to-Point (Queue destination): In this model, a message is delivered from a producer to one consumer.
                o             Publish/Subscribe (Topic destination): In this model, a message is delivered from a producer to any number of consumers.

Q: Some generic knowledge test questions
A: •        Java collection frameworks
                o             List, Set,Tree -
                                             synchronized collections
                                             sorted collections
                                             collections methods
                o             Use case for selecting one above other like arraylist over linkedlist (vector deprecated)
                o             Order of processing time -add, remove and search
                o             sorting and searching techniques - Heap merge sort, b-tree search

•             Exception Handling in JAVA
                o             compile time exception
                o             run time exception

Q:        Questions related to OOPS
A:           o             Abstraction
                                             abstract class, method
                o             Encapsulation
                                             public,private,protected
                o             Inheritance
                                             extend
                                             implements
                o             Polymorphism
                                             Overriding - method
                                             Overloading -method,class

Q:        Questions related to multi-threading - synchronization, deadlock handling, runnable interface and thread class
A: •        stateless entity bean and stateful entity bean scalability?

•             Transaction isolation levels
                o             none,repeated,read, read committed, read uncommitted, serializable

•             Transaction attributes
                o             new, required,support,mandatory,never,not supported

•             Optimistic and pessimistic locking requirements
                o             Optimistic is implicit time-stamp based
                o             Pessimistic - explicit and client control

•             Use of custom classloader in application server- for hot deployment

•             design consideration and best practices for web services

•             Tools for monitoring code quality (PMD, find bug, checkstyle, -sonar)

Q: What is the difference between optimistic lock and pessimistic lock?
A: Optimistic lock is an implicit lock that tries to make best assumption about locking strategy and minimize time spent in lock of resource. Optimistic lock is usually implemented with some kind of timestamp strategy. Pessimistic lock is an explicit lock that set by client.

Q: What modeling tools you are familiar with? What version of TogetherJ (Rational Rose etc.) have you used?
A: Just explain the modeling tools which you have userd.

Q: If stateless session bean more scalable than stateful session beans?
A: This is very popular questions that leads to some confusion. According to the second edition of "Core J2EE Patterns" and contrary to popular belief, stateful session beans are not less scalable than stateless session bean. The reason for that is life cycle of either type is controlled by Application Server and control of life cycle is what defines the scalability of the application

Q: What's the difference between EJB 1.1 and EJB 2.0?
A: There are many differences. Some key points you want to mention are:
1.            New CMP model
2.            EJB Query Language
3.            Local interfaces
4.            EJBHome methods
5.            Message Driven Beans (MDB) support

Q: What distinguishes "good architecture" from "bad architecture"?
A: This is an open-ended question. There are few aspects of "good" architecture:
1.            Shall address functional product requirements
2.            Shall address non-functional product requirements, such as performance, scalability, reliability, fault tolerance, availability, maintainability, extensibility
3.            Shall be simple and comprehendible (to support maintainability and extensibility)
4.            Shall be well structured (support multiple tiers, parallel development etc.)
5.            Shall be detailed enough to share with different levels of organizational structure (marketing, sales, development, management)
"Bad" architecture is basically opposite to "good" architecture.

Q: What Do You Mean By High Availability?
A: Having better service capacity with high availability and low latency is mission critical for almost all businesses.
Availability means the ability of the application user to access the system, If a user cannot access the application, it is assumed unavailable. High Availability means the application will be available, without interruption.
Achieving high availability for a application is not always a easy task. Using redundant server nodes with clustering is a common way to achieve higher level of availability in web applications.
Availability is commonly expressed as a percentage of uptime in a given year.


Q: What Is Scalability?
A: Scalability is the ability of a system, network, or process to handle a growing amount of load by adding more resources. The adding of resource can be done in two ways
•             Scaling Up

This involves adding more resources to the existing nodes. For example, adding more RAM, Storage or processing power.
•             Scaling Out

This involves adding more nodes to support more users.
Any of the approaches can be used for scaling up/out a application, however the cost of adding resources (per user) may change as the volume increases. If we add resources to the system It should increase the ability of application to take more load in a proportional manner of added resources.

An ideal application should be able to serve high level of load in less resources. However, in practical, linearly scalable system may be the best option achievable.

Poorly designed applications may have really high cost on scaling up/out since it will require more resources/user as the load increases.

Q: What Is A Cluster?
A: A cluster is group of computer machines that can individually run a software. Clusters are typically utilized to achieve high availability for a server software.

Clustering is used in many types of servers for high availability.
•             App Server Cluster

An app server cluster is group of machines that can run a application server that can be reliably utilized with a minimum of down-time.
•             Database Server Cluster

An database server cluster is group of machines that can run a database server that can be reliably utilized with a minimum of down-time.

Q: Why Do You Need Clustering?
A: Clustering is needed for achieving high availability for a server software. The main purpose of clustering is to achieve 100% availability or a zero down time in service.

A typical server software can be running on one computer machine and it can serve as long as there is no hardware failure or some other failure.

By creating a cluster of more than one machine, we can reduce the chances of our service going un-available in case one of the machine fails.

Doing clustering does not always guarantee that service will be 100% available since there can still be a chance that all the machine in a cluster fail at the same time. However it in not very likely in case you have many machines and they are located at different location or supported by their own resources.


Q: What Is Middle Tier Clustering?
A: Middle tier clustering is just a cluster that is used for service the middle tier in a application. This is popular since many clients may be using middle tier and a lot of heavy load may also be served by middle tier that requires it be to highly available.

Failure of middle tier can cause multiple clients and systems to fail, therefore its one of the approaches to do clustering at the middle tier of a application.

In java world, it is really common to have EJB server clusters that are used by many clients. In general any application that has a business logic that can be shared across multiple client can use a middle tier cluster for high availability.

Q: What Is Load Balancing?
A: Load balancing is simple technique for distributing workloads across multiple machines or clusters.
The most common and simple load balancing algorithm is Round Robin. In this type of load balancing the request is divided in circular order ensuring all machines get equal number of requests and no single machine is overloaded or underloaded.

The Purpose of load balancing is to
•             Optimize resource usage (Avoid overload and under-load of any machines.)
•             Achieve Maximum Throughput
•             Minimize response time

Most common load balancing techniques in web based applications are

1.            Round robin
2.            Session affinity or sticky session
3.            IP Address affinity

Q: What Is Sticky Session (session Affinity) Load Balancing? What Do You Mean By 'session Affinity'?
A: Sticky session or a session affinity technique another popular load balancing technique that requires a user session to be always served by a allocated machine.

Q: Why Sticky Session?
A: In a load balanced server application where user information is stored in session it will be required to keep the session data available to all machines. This can be avoided by always serving a particular user session request from one machine.

Q: How It Is Done?
A: The machine is associated with a session as soon as the session is created. All the requests in a particular session are always redirected to the associated machine. This ensures the user data is only at one machine and load is also shared.

In Java world, this is typically done by using jsessionid cookie. The cookie is sent to the client for the first request and every subsequent request by client must be containing that same cookie to identify the session.

Q: What Are The Issues With Sticky Session?
A: There are few issues that you may face with this approach
•             The client browser may not support cookies, and your load balancer will not be able to identify if a request belongs to a session. This may cause strange behavior for the users who use no cookie based browsers.
•             In case one of the machine fails or goes down, the user information (served by that machine) will be lost and there will be no way to recover user session.

Q: What Is IP Address Affinity Technique For Load Balancing?
A: IP address affinity is another popular way to do load balancing. In this approach, the client IP address is associated with a server node. All requests from a client IP address are served by one server node.

This approach can be really easy to implement since IP address is always available in a HTTP request header and no additional settings need to be performed.

This type of load balancing can be useful if you clients are likely to have disabled cookies.

However there is a down side of this approach. If many of your users are behind a NATed IP address then all of them will end up using the same server node. This may cause uneven load on your server nodes.

NATed IP address is really common, in fact anytime you are browsing from a office network its likely that you and all your coworkers are using same NATed IP address.

Q: What Is Fail Over?
A: Fail over means switching to another machine when one of the machine fails.

Fail over is a important technique in achieving high availability. Typically a load balancer is configured to fail over to another machine when the main machie fails.

To achieve least down time, most load balancer support a feature of heart beat check. This ensures that target machine is responding. As soon as a hear beat signal fails, load balancer stops sending request to that machine and redirects to other machines or cluster.

Q: What Is Session Replication?
A: Session replication is used in application server clusters to achieve session failover.
A user session is replicated to other machines of a cluster, every time the session data changes.
If a machine fails, the load balancer can simply send incoming requests to another server in the cluster.
The user can be sent to any server in the cluster since all machines in a cluster have copy of the session.

Session replication may allow your application to have session failover but it may require you to have extra cost in terms of memory and network bandwidth.

Q: What Does Distributable Tag Means In Web.xml ?
A: In Java world, JEE applications use the concept of distributable web applications to provide session-failover and enable load balancing.

You can set a JEE application to support session replication by adding distributable tag in web.xml file.
<distributable />

Q: What Are The Requirements For Making A Java EE Application Session Replication Enabled?
A: Setting distributable tag in web.xml just enables the application to support session replication, however it does not guarantee that your application will work fine in a session replicated environment.

JEE Application developer needs to make sure following things are taken care during web application development.
•             All attributes/objects that are saved in HTTP Session are serializable. This means all your custom objects and child objects of that should be serializable.
•             Making changes to any session attribute should be done using session.setAttribute() method. If you have reference to a java object that was previously set in session, you must call session.setAttribute() method every time you make any change to the object.

Q: What Are Different Mechanism Of Session Replication?
A: Session replication between multiple cluster nodes can be done in many ways. The best approach may depend on the type of application. However there are few common methods used by application server vendors.

•             Using session persistence, and saving the session to a shared file system (PersistenceManager + FileStore) . This will allow all machines in a cluster to be able to access the persisted session from the shared file system.
•             Using session persistence, and saving the session to a shared database (PersistenceManager + JDBCStore) - This will allow all machines in a cluster to be able to access the persisted session from the shared database system.
•             Using in-memory-replication, This will create a in memory copy of session in all the cluster nodes.

Q: What Is CAP Theorem?
A: The CAP Theorem for distributed computing was published by Eric Brewer, This states that it is not possible for a distributed computer system to simultaneously provide all three of the following guarantees:
1.            Consistency (all nodes see the same data even at the same time with concurrent updates )
2.            Availability (a guarantee that every request receives a response about whether it was successful or failed)
3.            Partition tolerance (the system continues to operate despite arbitrary message loss or failure of part of the system)

The CAP acronym corresponds to these 3 guarantees. This theorem has created the base for modern distributed computing approaches.

World’s most high volume traffic companies (e.g. Amazon, Google, Facebook) use this as basis for deciding their application architecture.

Its important to understand that only two of these three conditions can be guaranteed to be met by a system.

Q: What Is Sharding?
A: Sharding is a architectural approach that distributes a single logical database system into a cluster of machines.

Sharding is Horizontal partitioning design scheme. In this database design rows of a database table are stored separately, instead of splitting into columns (like in normalization and vertical partitioning). Each partition is called as a shard, which can be independently located on a separate database server or physical location.

Sharding makes a database system highly scalable. The total number of rows in each table in each database is reduced since the tables are divided and distributed into multiple servers. This reduces the index size, which generally means improved search performance.

The most common approach for creating shards is by the use of consistent hashing of a unique id in application (e.g. user id).

The downsides of sharding are,
•             It requires application to be aware of the data location.
•             Any addition or deletion of nodes from system will require some rebalance to be done in the system.
•             If you require lot of cross node join queries then your performance will be really bad. Therefore, knowing how the data will be used for querying becomes really important.
•             A wrong sharding logic may result in worse performance. Therefore make sure you shard based on the application need.

Q: What Is ACID Property Of A System?
A: ACID is a acronym which is commonly used to define the properties of a relational database system, it stand for following terms

•             Atomicity - This property guarantees that if one part of the transaction fails, the entire transaction will fail, and the database state will be left unchanged.
•             Consistency - This property ensures that any transaction will bring the database from one valid state to another.
•             Isolation - This property ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed serially.
•             Durable - means that once a transaction has been committed, it will remain so, even in the event of power loss.

Q: What Is BASE Property Of A System?
A: BASE properties are the common properties of recently evolved NOSQL databases. According to CAP theorem, a BASE system does not guarantee consistency. This is a contrived acronym that is mapped to following property of a system in terms of the CAP theorem

•             Basically available indicates that the system is guaranteed to be available
•             Soft stateindicates that the state of the system may change over time, even without input. This is mainly due to the eventually consistent model.
•             Eventual consistency indicates that the system will become consistent over time, given that the system doesn't receive input during that time.

Q: What Do You Mean By Eventual Consistency? What Does Eventually Consistent Mean?
A: Unlike relational database property of Strict consistency, eventual consistency property of a system ensures that any transaction will eventually (not immediately) bring the database from one valid state to another.

This means there can be intermediate states that are not consistent between multiple nodes.

Eventually consistent systems are useful at scenarios where absolute consistency is not critical. For example in case of Twitter status update, if some users of the system do not see the latest status from a particular user its may not be very devastating for system.

Eventually consistent systems can not be used for use cases where absolute/strict consistency is required. For example a banking transactions system can not be using eventual consistency since it must consistently have the state of a transaction at any point of time. Your account balance should not show different amount if accessed from different ATM machines.

Some reference material for better understanding on eventual consistency
•             Microsoft Research Whitepaper about Eventual Consistency
•             Amazon CTO about Eventual Consistency

Q: What Is Shared Nothing Architecture? How Does It Scale?
A: A shared nothing architecture (SN) is a distributed computing approach in which each node is independent and self-sufficient, and there is no single point of contention required across the system.

•             This means no resources are shared between nodes (No shared memory, No shared file storage)
•             The nodes are able to work independently without depending on each other for any work.
•             Failure on one node affects only the users of that node, however other nodes continue to work without any disruption.
This approach is highly scalable since it avoid the existence of single bottleneck in the system. Shared nothing is recently become popular for web development due to its linear scalability. Google has been using it for long time.

In theory, A shared nothing system can scale almost infinitely simply by adding nodes in the form of inexpensive machines.

Q: How Do You Update A Live Heavy Traffic Site With Minimum Or Zero Down Time?
A: Deploying a newer version of a live website can be a challenging task specially when a website has high traffic. Any downtime is going to affect the users. There are a few best practices that we can follow
Before deploying on Production

•             Thoroughly test the new changes and ensure it working in a test environment which is almost identical to production system.
•             If possible do automation of test cases as much as possible. We use selenium for a lot of functional testing.
•             Create a automated sanity testing script (also called as smoke test) that can be run on production (without affecting real data). These are typically readonly type of test cases. However depending on your application needs you can add more cases to this. Make sure it can be run quickly by keeping it short.
•             Create scripts for all manual tasks(if possible), avoiding any hand typing mistakes during day of deployment.
•             Test the script to make sure they work on a non-production environment.
•             Keep the build artifacts ready. e.g application deployment files, database scripts, config files etc.
•             Create a checklist of things to do on day of deployment.
•             Rehearse. Deploy in a non-prod environment is almost identical to production. Try this with production data volumes(if possible). Make a note of time required for your tasks so you can plan accordingly.

Q: When doing deploying on a production environment.
A: •        Keep backup of current site/data to be able to rollback.
•             Use sanity test cases before doing a lot of in depth testing.

7 comments: