Sie sind auf Seite 1von 16

Good caliber candidates have the ability to look at the big picture and drill down into details.

The line between software development and


software architecture is a tricky one. Regardless of you are an architect, developer, or both, one needs to have a good understanding of
the overall software architecture. The following Java interview questions are very popular with the interviewers and it can significantly
influence the decision of Hire!o Hire. "o, it really pays to have a good overview of various possible architectures. The questions shown
below will also make a good platform for further questions depending on your answers.
#e prepared for a white board session on architectures, especially the bird$s eye view of the last application you had worked on. There
will be lots of follow on questions like why a particular approach was used%, what are the benefits and drawbacks of a particular
approach%, etc.
Q. &an you draw me a '((( foot view of the architecture of the system you wereare involved in,
in your currentlast position%
Q. &an you describe the architecture of a medium)to)large scale system that you actually
designed or implemented%
Q. &an you white board the components of the system you recently worked on%
Q. How would you go about designing a J** shopping cart application%
Q. &an you discuss some of the high level architectures you are e+perienced with%
A. There are a number of high level conceptual architectures as discussed below. These individual architectures can be mi+ed and
matched to produce hybrid architectures.
Model-View-Controller Architecture
,ost web and stand)alone G-. applications follow this pattern. /or e+ample, "truts and "pring ,0& frameworks and "wing G-..
The model represents the core business logic and state. The view renders the content of the model state by adding display logic. The
controller translates the interaction with the view into action to be performed by the model. The actions performed by a model include
e+ecuting the business logic and changing the state of the model. #ased on the user interactions, the controller selects an appropriate
view to render. The controller decouples the model from the view.
Service Oriented Architecture (SOA)
The business logic and application state are e+posed as reusable services. 1n *nterprise "ervice #us 2*"#3 is used as an orchestration
and mediation layer to decouple the applications from the services.
The above architecture has 4 tiers. The application tier could be using a typical ,0& architecture. The service orchestration tier could be
using *"# products like 5racle "ervice #us, T.#&5, etc and #6, products like 7ombardi #6,, 6ega #6,, etc. .n the above diagram,
the *"# integrates with the #6, via messaging queues. The service tier consists of individual services that can be accessed through
"516 or R*"Tful web services. The "51 implementation requires change agents to drive adoption of new approaches. The #6,,
application integration, and real)time information all contribute to dynamically changing how business users do their 8obs. "o, it needs full
support from the business, requiring restructuring and also it can take some time to reali9e the benefits of "51. &loud computing is at
the leading edge of its hype and as a concept compliments "51 as an architectural style. &loud computing is e+pected to provide a
computing capability that can scale up 2to massive proportions3 or scale down dynamically based on demand. This implies a very large
pool of computing resources either be within the enterprise intranet or on the .nternet 2i.e on the cloud3.
User Interface (UI) Co!onent Architecture
This architecture is driven by a user interface that is made up of a number of discrete components. *ach component calls a service that
encapsulates business logic and hides lower level details. &omponents can be combined to form new composite components allowing
richer functionality. These components can also be shared across a number of applications. /or e+ample, Java"cript widgets, Java
"erver /aces 2J"/3 components, etc.
"#S$ful data co!osition Architecture
The user interface can be built by calling a number of underlying services that are each responsible for building part of a page. The user
interface translates and combine the data in different formats like :,72translate to HT,7 using :"7T3, J"5! 2Java "cript 5b8ect
!otation3, 1T5, 2feed for mail messages and calendar applications3, R"" 2for generating R"" feeds3, etc.
%$M& co!osition Architecture
.n this architecture, multiple applications output fragments of HT,7 that are combined to generate the final user interface. /or e+ample,
Java portlets used inside a portal application server to aggregate individual content..
'lu(-in Architecture
.n this architecture, a core application defines an interface, and the functionality will be implemented as a set of plug)ins that conform to
that interface. /or e+ample, the the *clipse R&6 framework, ,aven build tool, etc use this architecture.
#vent )riven Architecture (#)A)
The *;1 pattern decouples the interactions between the event publishers and the event consumers. ,any to many communications are
achieved via a topic, where one specific event can be consumed by many subscribers. The *;1 also supports asynchronous operations
and acknowledgments through event messaging. This architecture requires effective monitoring in place to track queue depth,
e+ceptions, and other possible problems. The traceability, isolation, and debugging of an event can be difficult in some cases. This
architecture is useful in scenarios where the business process is inherently asynchronous, multiple consumers are interested in an
event2e.g. order status has changed to partially)filled 3, no immediate acknowledgment is required 2e.g. an email is sent with the booking
details and itinerary3, and real)time requestresponse is not required 2e.g. a long running report can be generated asynchronously and
made available later via online or via email3.
,ost conceptual architectures use a h*brid a!!roach using a combination of different architectures based on the benefits of each
approach and its pertinence to your situation. Here is a sample hybrid approach depicting an online trading system.

/.: is a +inancial Information e,change protocol. <ou could also notice a number of synchronous calls using :,7HTT6 or "516HTT6
and asynchronous calls using J,". The above diagram also depicts that an enterprise architecture can be comple+ with a number of
moving parts. "o, it is imperative that all these moving parts are properly monitored and tested for any potential performance issues. ,ost
of these services will be running as a cluster or a load balanced service with either activeactive or active.passive configuration for high
availability and scalability.
-ava interview .uestions/
This page is for JavaJ=** 8ob seekers and interviewers and for people interested in self assessments on JavaJ=** technologies. There are
numerous books and articles on the market covering specific topics like Java, J=**, *J#, ;esign 6atterns, 1!T, ,aven, &0", ,ulti)Threading,
"ervlets, J"6, emerging technologies like 156 21spect 5riented 6rogramming3, Test ;riven ;evelopment 2T;;3, ;ependency .n8ection ;l 2aka
.o& > .nversion of &ontrol3 etc. #ut from an interview perspective it is not possible to brush up on all these books where each book usually has
from ?(( pages to @(( pages. The basic purpose of this page is to cover question 2and only questions3 on all the core concepts and key areas,
which all JavaJ=** developers, designers and architects should be conversant with to perform well in their current 8obs and to launch a
successful career by doing well at interviews. The interviewer can also use this book to make sure that they hire the right candidate depending on
their requirements.
Multi-$hreadin(
Ahat language features are available to allow shared access to data in a multi)threading environment% 2HintB "ynchroni9ed
block,"ynchroni9ed method,wait, notify3
Ahat is the difference between synchroni9ed method and synchroni9ed block% 2HintB#lock on subset of data. "maller code segment3.
Ahat Java language features would you use to implement a producer 2one thread3 and a consumer 2another thread3 passing data via a
stack% 2HintB wait, notify3
-ava lan(ua(e
Ahat Java classes are provided for date manipulation% 2HintB&alendar, ;ate3
Ahat is the difference between "tring and "tring#uffer% 2HintB mutable, efficient3
How do you ensure a class is "eriali9able% 2HintB.mplement "eriali9able3
Ahat is the difference between static and instance field of a class% 2HintB6er class vs. 6er 5b8ect3
Ahat methods do you need to implement to store a class in Hashtable or Hash,ap% 2HintB hash&ode23, equals233 .
How do you e+clude a field of a class from seriali9ation% 2HintB transient3
Inheritance
Ahat is the difference between an .nterface and an abstract base class% 2HintB interface inheritance, implementation inheritance.3
Ahat does overriding a method mean% 2HintB .nheritance3
Ahat about overloading% 2HintB different signature3
Meor*
Ahat is the Java heap, and what is the stack% 2HintB dynamic, program thread e+ecution.3
Ahy does garbage collection occur and when can it occur% 2HintB To recover memory, as heap gets full.3
.f . have a circular reference of ob8ects, but . no longer reference any of them from any e+ecuting thread, will these cause garbage
collection problems% 2HintB no3
#0ce!tions
Ahat is the problem or benefits of catching or throwing type C8ava.lang.*+ceptionD% 2HintB Hides all subsequent e+ceptions.3
Ahat is the difference between a runtime e+ception and a checked e+ception% 2HintB ,ust catch or throw checked e+ceptions.3
-S'
Ahat is the best practice regarding the use of scriptlets in J"6 pages% Ahy% 2HintB 1void3How can you avoid scriptlet code%
2HintBcustom tags, Java beans3
Ahat do you understand by the term J"6 compilation% 2HintB compiles to servlet code3
Servlets
Ahat does "ervlet 16. provide to store user data between requests% 2HintB Http"ession3
Ahat is the difference between forwarding a request and redirecting% 2HintB redirect return to browser 3
Ahat ob8ect do you use to forward a request% 2HintB Request;ispatcher3
Ahat do you need to be concerned about with storing data in a servlet instance fields% 2HintB ,ulti)threaded.3
AhatEs the requirement on data stored in Http"ession in a clustered 2distributable3 environment% 2HintB "eriali9able3
.f . store an ob8ect in session, then change its state, is the state replicated to distributed "ession% 2HintB !o, only on set1ttribute23 call.3
How does -R7)pattern for servlet work in the web.+ml% 2HintB dddF or F.8sp3
Ahat is a filter, and how does it work% 2HintB #eforeafter request, chain.3
-)1C
Ahat form of statement would you use to include user)supplied values% 2HintB 6repared"tatement3
Ahy might a prepared"tatement be more efficient than a statement% 2HintB *+ecution plan cache.3
How would you prevent an "G7 in8ection attack in J;#&% 2HintB 6reparsed"tatement 3
Ahat is the performance impact of testing against !-77 in AH*R* clause on 5racle% 2HintB /ull table scan. 3
7ist advantages and disadvantages in using stored procedures% 2HintB 6roB integration with e+isting dbase, reduced network traffic&onB
not portable, mutliple language knowledge required 3
Ahat is the difference between sql.;ate, sql.Time, and sql.Timestamp% 2HintB ;ate only, time only, date and time 3
.f you had a missing int value how do you indicate this to 6repared"tatement% 2HintB set!ull2pos, T<6*33
How can . perform multiple inserts in one database interaction% 2HintB e+ecute#atch3Given this problemB 6rogram reads '((,((( rows,
converts to Java class in list, then converts list to :,7 file using reflection. Runs out of program memory. How would you fi+% 2HintB
Read one row at time, limit select, allocate more heap 2result set H cursor3 3
How might you model ob8ect inheritance in database tables% 2HintB Table per hierarchy, table per class, table per concrete class3
-2)I
Ahat are typical uses for the J!;. 16. within an enterprise application% 2HintB Resource management, 7;16 access3
*+plain the difference between a lookup of these C8avaBcompenve8b,y#eanD and Ce8b,y#eanD% 2HintB logical mapping performed for
8avaBcompenv 3
Ahat is the difference between new .nitial&onte+t23 from servlet or from an *J#% 2HintB ;ifferent J!;. environments initiali9ed *J#
controller by e8b)8ar.+ml, servlet by web.+ml.3
Ahat is an 7;16 server used for in an enterprise environment% 2HintB authentication, authori9ation3
Ahat is authentication, and authori9ation% 2HintB &onfirming identity, confirming access rights 3
#-1
Ahat is the difference between "tateless and "tateful session beans 2used%3 2HintB "tateful holds per client state 3
Ahat is the difference between "ession bean and *ntity bean 2when used%3 2HintB *ntity used for persistence 3
Aith "tateless "ession bean pooling, when would a container typically take a instance from the pool and when would it return it% 2HintB
for each business method 3
Ahat is the difference between CRequiredD, C"upportsD, CRequires!ewD C!ot"upportedD, C,andatoryD, C!everD% 2HintB !eeds transaction,
e+isting 5I but doesnEt need, must start new one, suspends transaction, must already be started, error if transaction3
Ahat is Cpass)by)referenceD and Cpass)by)valueD, and how does it affect J=** applications% 2HintB Reference to actual ob8ect versus
copy of ob8ect. R,. pass by value.3
Ahat *J# patterns, best practices are you aware of% ;escribe at least two% 2HintB /aJade, delegate, value list, ;15, value ob8ect3.
;escribe some issuesconcerns you have with the J=** specification% 2HintB Get their general opinion of J=**3
Ahat do you understand by the term Coffline optimistic lockingD or long)lived business transaction% How might you implement this using
*J#% 2HintB version number, date, field comparisons.3
*+plain performance difference between getting a list of summary information 2e.g. customer list3 via finder using a #,6 entity vs.
"ession using ;15% 2HintB #,6B nK' database reads, n R,. calls.3
Ahat is meant by a coarse)grained and a fine)grained interface% 2HintB 1mount of data transferred per method call3
,M&3,S&$
Ahat is the difference between a ;5, parser and a "1: parser% 2HintB ;5,B reads entire model, "1:B event published during
parsing.3
Ahat is the difference between ;T; and :,7 "chema% 2HintB level of detail, "chema is in :,7.3
Ahat does the J1:6 16. do for you% 2HintB 6arser independence. 3Ahat is :"7T and how can it be used% 2HintB :,7 transformation. 3
Ahat would be the :6ath to select any element called table with the class attribute of info% 2HintB TableLMclassHEinfoEN3
-MS
How can asynchronous events be managed in J=**% 2HintB J,"3
How do transactions affect the on,essage23 handling of a ,;#% 2HintB Taking off queue. 3
.f you send a J," message from an *J#, and transaction rollback, will message be sent% 2HintB yes3
How do you indicate what topic or queue ,;# should react to% 2HintB deployment descriptor 3
Ahat is the difference between a topic and a queue% 2HintB broadcast, single3
SOA'
Ahat is a Aeb service, and how does it relate to "516% 2HintB "516 is the protocol.3
Ahat is a common transport for "516 messages% 2HintB HTT6 3
Ahat is A";7% How would you use a A";7 file% 2HintB :,7 description of Aeb "erviceB interface and how to bind to it. 3
Aith new J=** "516 support what isB J1:R, J1:)R6&, and "11J% 2HintB registry, rpc, attachments3
Securit*
Ahere can container level security be applied in J=** application% 2HintB Aeb -riEs, *J# methods3
How can the current user be obtained in a J=** application 2Aeb and *nterprise3% 2HintB get-ser6rincipal, get&aller6rincipal 3
How can you perform role checks in a J=** application 2Aeb and enterprise3% 2HintB .s-ser.nRole23, .s&aller.nRole23 3
)esi(n
!ame some types of -,7 diagrams% 2HintB class, sequence, activity, use case3
;escribe some types of relationships can you show on class diagrams% 2HintB generali9ation, aggregation, uses3
Ahat is the difference between association, aggregation, and generali9ation% 2HintB Relationship, ownership, inheritance3
Ahat is a sequence diagram used to display% 2 HintB 5b8ect instance interactions via operationssignals3Ahat design patterns do you
use. ;escribe one you have used 2not singleton3% 2HintB e.g. #uilder, /actory, 0isitor, &hain of &ommand 3
;escribe the observer pattern and an e+ample of how it would be used 2HintB e.g. event notification when model changes to view 3
Ahat are -se &ases% 2HintB ;efine interaction between actors and the system 3Ahat is your understanding of encapsulation% 2HintB
*ncapsulate data and behavior within class 3
Ahat is your understanding of polymorphism% 2HintB &lass hierarchy, runtime determine instance 3
'rocess
Have you heard of or used test)driven development% 2HintB e.g. :6 process 3
Ahat development processes have you followed in the past% 2HintB Rational, :6, waterfall 3
How do you approach capturing client requirements% 2HintB !umbered requirements, use cases 3
Ahat process steps would you include between the capture of requirements and when coding begins% 2HintB 1rchitecture, ;esign, -,7
modeling, etc 3
How would you go about solving performance issue in an application% 2HintB "et goals, establish bench, profile application, make
changes one at a time 3
Ahat developer based testing are you familiar with 2before system testing%3 2HintB -nit test discussion 3
How might you test a business system e+posed via a Aeb interface% 2HintB 1utomated script emulating browser3
Ahat is your e+perience with iterative development% 2HintB ,ultiple iteration before release3
)istributed A!!lication
*+plain a typical architecture of a business system e+posed via Aeb interface% 2HintB *+plain tiers 2presentation, enterprise, resource3
Java technology used in each tiers, hardware distribution of Aeb servers, application server, database server 3
;escribe what tiers you might use in a typical large scale 2O =(( concurrent users3 application and the responsibilities of each tier
2where would validation, presentation, business logic, persistence occur3. 2HintB 1nother way of asking same question as above if their
answer wasnEt specific enough3
;escribe what you understand by being able to CscaleD an application% How does a J=** environment aid scaling% 2HintB 0ertical and
Hori9ontal scaling. Thread management, clustering, split tiers 3
Ahat are some security issues in .nternet based applications% 2HintB authentication, authori9ation, data encryption, denial service, +ss
attacks, "G7 in8ection attacks 3
4eneral
Ahat configuration management are you familiar with% 2HintB e.g. &0", &lear&ase 3
Ahat issuetracking process have you followed% 2HintB Aant details on bug recording and resolution process3.
Ahat are some key factors to working well within a team% 2HintB Gets a view on how you would work within interviewerEs environment.3
Ahat attributes do you assess when considering a new 8ob% 2what makes it a good one3% 2HintB .nsight into what motivates you.3
Ahat was the last computing maga9ine you read% 7ast computing book%
Ahat is a regular online maga9inereference you use% 2HintB -nderstand how up to date you keep yourself.3

5hat is UM&6
-,7 is -nified ,odeling 7anguage. .t is a graphical language for visuali9ing specifying constructing and documenting the artifacts of the system. .t
allows you to create a blue print of all the aspects of the system, before actually physically implementing the system.
5hat is odelin(6 5hat are the advanta(es of creatin( a odel6
,odeling is a proven and well)accepted engineering technique which helps build a model. ,odel is a simplification of realityP it is a blueprint of the
actual system that needs to be built. ,odel helps to visuali9e the system. ,odel helps to specify the structural and behavior of the system. ,odel
helps make templates for constructing the system. ,odel helps document the system.
5hat are the different views that are considered when buildin( an ob7ect-
oriented software s*ste6
!ormally there are 4 views.
-se &ase view ) This view e+poses the requirements of a system.
;esign 0iew ) &apturing the vocabulary.
6rocess 0iew ) modeling the distribution of the systems processes and threads.
.mplementation view ) addressing the physical implementation of the system.
;eployment view ) focus on the modeling the components required for deploying the system.
5hat are dia(ras6
;iagrams are graphical representation of a set of elements most often shown made of things and associations.
5hat are the a7or three t*!es of odelin( used6
,a8or three types of modeling are structural, behavioral, and architectural.
Mention the different 8inds of odelin( dia(ras used6
/ollowing modeling diagrams are commonly used.
-se case diagram
&lass ;iagram
5b8ect ;iagram
"equence ;iagram
"tate chart ;iagram
&ollaboration ;iagram
1ctivity ;iagram
&omponent diagram
;eployment ;iagram
5hat is Architecture6
1rchitecture is not only taking care of the structural and behavioral aspect of a software system but also taking into account the software usage,
functionality, performance, reuse, economic and technology constraints.
5hat is S)&C6
";7& is "oftware ;evelopment 7ife &ycle. ";7& of a system included processes that are -se case driven, 1rchitecture centric and .terative and
.ncremental. This 7ife cycle is divided into phases. 6hase is a time span between two milestones. The milestones are .nception, *laboration,
&onstruction, and Transition. 6rocess Aorkflows that evolve through these phase are #usiness ,odeling, Requirement gathering, 1nalysis and
;esign, .mplementation, Testing, ;eployment. "upporting Aorkflows are &onfiguration and change management, 6ro8ect management.
5hat are "elationshi!s6
There are different kinds of relationshipsB
;ependenciesB ;ependencies are relations ships between two entities that that a change in specification of one thing may affect
another thing. ,ost commonly it is used to show that one class uses another class as an argument in the signature of the operation.
Generali9ationB Generali9ation is relationships specified in the class subclass scenario, it is shown when one entity inherits from other.
1ssociationB 1ssociations are structural relationships i.e. a room has walls, 6erson works for a company.
1ggregationB 1ggregation is the typical wholepart relationship. This is e+actly the same as an association with the e+ception that
instances cannot have cyclic aggregation relationships 2i.e. a part cannot contain its whole3.
&ompositionB &omposition is e+actly like 1ggregation e+cept that the lifetime of the $part$ is controlled by the $whole$. This control may be
direct or transitive. That is, the $whole$ may take direct responsibility for creating or destroying the $part$, or it may accept an already
created part, and later pass it on to some other whole that assumes responsibility for it.

%ow are the dia(ras divided6
The nine diagrams are divided into static diagrams and dynamic diagrams.
"tatic ;iagrams 21lso called "tructural ;iagram3B &lass diagram, 5b8ect diagram, &omponent ;iagram, ;eployment diagram.
;ynamic ;iagrams 21lso called #ehavioral ;iagrams3B -se &ase ;iagram, "equence ;iagram, &ollaboration ;iagram, 1ctivity diagram,
"tatechart diagram.
5hat are Messa(es6
1 message is the specification of a communication, when a message is passed that results in action that is in turn an e+ecutable statement.
5hat is an Use Case6
1 use case specifies the behavior of a system or a part of a system, QRse cases are used to capture the behavior that need to be developed. .t
involves the interaction of actors and the system.
Can *ou e0!lain 9#0tend: and 9Include: in use cases6
S*+tendE and S.ncludeE define relationships between use cases. #elow figure S*+tend and .ncludeE shows how these two fundamentals are
implemented in a pro8ect. The below use case represents a system which is used to maintain customer. Ahen a customer is added successfully it
should send an email to the admin saying that a new customer is added. 5nly admin have rights to modify the customer. /irst lets define e+tend
and include and then see how the same fits in this use case scenario.
.ncludeB .nclude relationship represents an invocation of one use case by the other. .f you think from the coding perspective its like one
function been called by the other function.
*+tendB This relationship signifies that the e+tending use case will work e+actly like the base use case only that some new steps will
inserted in the e+tended use case.
%ow do we re!resent !rivate; !ublic and !rotected in class dia(ras6
.n order to represent visibility for properties and methods in class diagram we need to place symbols ne+t to each property and method as shown
in figure S6rivate, 6ublic and 6rotectedE. SKE indicates that itEs public propertiesmethods. S)Sindicates private properties which means it can not be
accessed outside the class. STE indicate protectedfriend properties. 6rotected properties can only be seen within the component and not outside
the component.
Can *ou e0!lain se.uence dia(ras6
"equence diagram shows interaction between ob8ects over a specific period time. The message flow is shown vertically in waterfall manner i.e. it
starts from the top and flows to the bottom. ;ashed lines represent the duration for which the ob8ect will be live. Hori9ontal rectangles on the
dashed lines represent activation of the ob8ect. ,essages sent from a ob8ect is represented by dark arrow and dark arrow head. Return message
are represented by dotted arrow.
Can *ou e0!lain !riar* and secondar* actors6
1ctors are further classified in to two types primary and secondary actors. 6rimary actors are the users who are the active participants and they
initiate the user case, while secondary actors are those who only passively participate in the use case.
Can *ou e0!lain use case dia(ras6
-se case diagram answers what system does from the user point of view. -se case answer SAhat will the system do%E. -se cases are mainly
used in requirement document to depict clarity regarding a system. There are three important parts in a use case scenario, actor and use case.
"cenarioB 1 scenario is a sequence of events which happen when a user interacts with the system.
1ctorB 1ctor is the who of the system, in other words the end user.
-se &aseB -se case is task or the goal performed by the end user. #elow figure S-se &aseE shows a simple scenario with S1ctorE and a
S-se &aseE. "cenario represents an accountant entering accounts data in the system. 1s use caseEs represent action performed they
are normally represented by strong verbs.
1ctorEs are represented by simple stick man and use case by oval shape.
Can *ou e0!lain a((re(ation and co!osition in class dia(ras6
.n this 1ssociation there are two types mainly 1ggregation 1ssociation and &omposition 1ssociation.
1ggregation 1ssociation signifies that the child ob8ects can e+ist without the 1ggregated 5b8ect. &omposition on the other hand represents a strict
Uhas aU relationship wherein child ob8ects are tightly bound to the parent class and life of its instance depends upon lifetime of top level class
instance. /or e+ample say we have three classes -niversity class, ;epartment class and the 6rofessor &lass. The ;epartment cannot e+ist
without university which means that if -niversity is closed the ;epartment will also be closed. .n other words lifetime of the ;epartment depend on
the lifetime of -niversity. This is an e+ample of composition. 5n the other hand instances of 6rofessor class can continue to e+ist even if a
;epartment is shutdown representing and aggregation association with ;epartment class.
!oteB The filled diamond represents the composition and the empty diamond represents the aggregation.
General and general terms questions
Architect interview is slightly different from all other interview types. Interviewer is looking for ability of the candidate to think
independently on top of pure technical knowledge. Most of the questions are open-ended, prompting the interviewee to
discussion about different aspects of Java development. ther side of the interview is general questions about position of the
architect within the organi!ation. "ome questions do not have clear, direct or single answer and require discussion with the
interviewer. n top of questions mentioned here you may be asked generic questions #what is class, what is polymorphism
etc.$
%hat distinguishes &good architecture& from &bad architecture&'
(his is an open-ended question. (here are few aspects of &good& architecture)
*. "hall address functional product requirements
+. "hall address non-functional product requirements, such as performance, scalability, reliability, fault tolerance,
availability, maintainability, e,tensibility
-. "hall be simple and comprehendible #to support maintainability and e,tensibility$
.. "hall be well structured #support multiple tiers, parallel development etc.$
/. "hall be detailed enough to share with different levels of organi!ational structure #marketing, sales,
development, management$
&0ad& architecture is basically opposite to &good& architecture.
1ow much e,perience do you have with 2nterprise applications' Another variant of this questions is) &(ell me about
pro3ects where you worked with J+22'& 4et another version) &%hat, when and how made using 2J0'&
Interviewer is looking for your e,perience with designing J+22 applications and your e,perience with J+22
technologies and general terms. (his is often start of the discussion and bridge to the technical section of the questions.
%hat is scalability'
%hat is high-availability' 1ow is it different from scalability'
%hat is the fault tolerance'
%hat resources are used to keep up to date with J+22 technology'
4ou may mention design pattern books, such as &5ore 2J0 6atterns& and web sites, such
as http)77www.theserverside.com
Specific technical questions
%hat modeling tools you are familiar with' %hat version of (ogetherJ #8ational 8ose etc.$ have you used'
If stateless session bean more scalable than stateful session beans'
(his is very popular questions that leads to some confusion. According to the second edition of &5ore J+22 6atterns&
and contrary to popular belief, stateful session beans are not less scalable than stateless session bean. (he reason for that
is life cycle of either type is controlled by Application "erver and control of life cycle is what defines the scalability of
the application
%hat9s the difference between 2J0 *.* and 2J0 +.:'
(here are many differences. "ome key points you want to mention are)
*. ;ew 5M6 model
+. 2J0 <uery =anguage
-. =ocal interfaces
.. 2J01ome methods
/. Message >riven 0eans #M>0$ support
%hat transaction isolation levels do you know'
none, repeatable read, read committed, read uncommitted, seriali!able
%hat transaction attributes do you know'
requires new, required, supports, not supported, mandatory, never
%hat is the difference between optimistic lock and pessimistic lock'
ptimistic lock is an implicit lock that tries to make best assumption about locking strategy and minimi!e time spent in
lock of resource. ptimistic lock is usually implemented with some kind of timestamp strategy. 6essimistic lock is an
e,plicit lock that set by client.
%hat are entity beans. Are there any issues with them'
(ypical reaction to this question is very e,pressive answer that entity beans should not be used. (here are many
performancy implications with entity beans if used incorrectly. ne of the famous problems are &n?* call problem&
Inter-entity bean call is very e,pensive operation and should be avoided.
%hat core design patterns do you know'
Architect must know at least some basic design patters used in J+22 development, e.g. 0usiness >elegate, "ession
@acade, A, =ist 1andler, >(, 5omposite 2ntity, etc.
%here business logic should reside'
(ypical answer is &in business tier& (his usually opens series of questions like) %hat is business logic, how to determine
business logic, how business logic is different from persistent logic etc.
%hat is J>'
J> is Java >ata b3ect - persistent framework that is alternative to idea of entity beans
%hat is the difference between J"6 and servlet' %hen to use what'
J"6 is compiled into servlet. J"6 are better suit to view of information, while servlets are better for controlling stuff.
>oes the J+22 platform support nested transactions'
;o.
5an you use synchroni!ation primitives in my enterprise beans'
;o.
%hy all ma3or application server vendors provide custom class loaders in addition to system 3vm class loader'
"ystem one does not support hot deployment.
Performance questions
%hat are performance problems in J+22 and how to solve them'
%hat are 2ntity beans performance pitfalls'
%hat performance pattern do you know'
Design Pattern questions
5an you use singleton in 2J0'
4es, but should not #e,plain why$
%hat is MA5 pattern and why M, A and 5 need to be separated'
>escribe 0usiness >elegate pattern #or any other pattern$
1ow to prevent double submission of the form from J"6 page' #or describe "ynchroni!er (oken pattern$

O8a*. 5hat are *our res!onsibilities as an -ava Architect6


1s an architect,i had to involve myself from pro8ect initiation till delivery and initial support. "ome of the
responsibilities areB
F Technical inputs during business analysis.
F &oming up with use cases and validating the same with business analysts and end users.
F .dentifying the technology that will be used in the pro8ect .
F Recommending the development methodologies and frameworks.
F ;efining the architecture and the infrastructure requirements.
F 6roviding the high level design and helping the designers in low level design.
F ;efining and enforcing the coding standards.
F &onducting design audit.
F Guiding developers to accomplish difficult tasks.
F Helping to recruit technical people.
F ;efining and achieving performance targets.
F Helping the pro8ect manager in planning and e+ecution.

5hat are the different t*!es of !ro7ect develo!ent ethodolo(ies that are available6 5hich one do
*ou !refer or which one do *ou consider the best6
Aaterfall model, .terative model like the :6 and R-6 are widely used ones. /or big pro8ects, Aaterfall model
is mostly used. 1nd of)late :6 is also widely used. #ut in practice, all of them are tailored to suit the
requirements of the pro8ect and are used e+actly as specified.
And which one do *ou !refer6
:6 with adaptations.
5hat is an use case6
1n use)case is actually a requirement from the user of the system. 1n use)case is a statement of what the
system will do at the request by one of the actors of the system.
5hat do *ou ean b* an actor6
1n actor could be an end user or an e+ternal system who is serviced by the system.
5hat are all the thin(s *ou will consider when *our a!!lication is re.uired to counicate to an
e0ternal s*ste.
There could be many factors but primarily i will consider and finalise communication mechanism, data
e+change format, error handling and the initiating events.
5hat are e0actl* eanin( b* counication echanis6
#y communication mechanism, i mean synchronous or asynchronous communication. .f the application
requires immediate response, i will use synchronous communication methods or else asynchronous
communication methods.
Can *ou (ive e0a!les s*nchronous counication ethods6 And which one do *ou !refer6
"ockets,HTT6,R,.,*J#,&5R#1 and web)services are all ways for synchronous communication. . would
prefer web)services.
5h* web-services6
Aeb)services are based on service oriented architecture. They are platform independent. Aeb)services
make the application highly loose coupled ) for e+ample a J=** application can communicate with a .!*T
application with little effort and without any great hiccups.
5hat data e0chan(e forats do *ou !refer for inter-a!!lication counication6
:,7 is the preferred choice because of its simplicity and self)descriptive synta+. #ut sometimes you might
really need an :,7.
Can *ou e0!lain under what circustances *ou avoided usin( ,M& for data e0chan(e6
. worked on a banking application which had a suite of in)built applications which were built on the J=**
architecture platform. 1nd we had general wrapper value ob8ects which could be used across applications.
There it did not make sense to convert the value ob8ect to :,7 8ust for the sake of using :,7.
5hen *ou !ass -ava value ob7ects across a!!lications; will it not lead to ti(ht cou!lin( of the
a!!lications6
1s . told you earlier, these V applications were built using the same J=** architecture, hence these inter)
application data transfer ob8ects were grouped as part of the architectural common components.
%ave *ou ever used an* echanis other than -MS for as*nchronous essa(in(6
!o. . havent come across any other J=** framework for asynchronous communication. ,oreover J," is
simple and highly stable for asynchronous communication.
<ou have variet* of o!tions for !ersistence in -=##. 5hich one do *ou !refer6
1s you said, Ae have J;#&, #ean managed entity beans, container managed entity beans, hibernate, J;5,
toplink, etc. "ome are specifications from sun and others are open source frameworks. *ach have their pros
and cons. ,y first choice would be hibernate, if i had to tweak for performance and require control ) i would
go with J;#&.
5h* are *ou entirel* avoidin( entit* beans6
/irst of all, entity beans havent evolved at the speed of market requirements. .ts too heavy for database
operations. *ven with #,6s you dont really get the control you wanted. *ntity beans are highly unsuitable
for batch operations. 1nd it also has a steep learning curve for 8unior developers. . have seen many
architects who have stayed clear of entity beans for these obvious reasons.
5ill *ou !refer writin( coon co!onents on *our own for the a!!lication or will *ou !refer o!en-
sourced co!onents6
.t depends on the pro8ect timelines, availability and quality of open)source components and the real value
add.
5hat is a value ob7ect6
0alue ob8ect is a set of related data grouped together for purpose of communicating within the application.
0alue ob8ects are simple ob8ects with setter and getter methods and without any processing logic. They
should be seriali9able because of their network transfer capability.
Is there a difference between value ob7ect and data transfer ob7ect6
!o. #oth are one and the same.
;esign 6atterns
.n software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. 1 design pattern is
not a finished design that can be transformed directly into code. .t is a description or template for how to solve a problem that can be used in many
different situations. 5b8ect)oriented design patterns typically show relationships and interactions between classes or ob8ects, without specifying
the final application classes or ob8ects that are involved.;esign 6atterns are broadly classified into three categories.
Creational patterns
These patterns have to do with class instantiation. They can be further divided into class)creation patterns and ob8ect)creational patterns. Ahile
class)creation patterns use inheritance effectively in the instantiation process, ob8ect)creation patterns use delegation to get the 8ob done.
1bstract /actory groups ob8ect factories that have a common theme.
#uilder constructs comple+ ob8ects by separating construction and representation.
/actory ,ethod creates ob8ects without specifying the e+act class to create.
6rototype creates ob8ects by cloning an e+isting ob8ect.
"ingleton restricts ob8ect creation for a class to only one instance.
Structural patterns
These concern class and ob8ect composition. They use inheritance to compose interfaces and define ways to compose ob8ects to obtain new
functionality.
1dapter allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already e+isting
class.
#ridge decouples an abstraction from its implementation so that the two can vary independently.
&omposite composes 9ero)or)more similar ob8ects so that they can be manipulated as one ob8ect.
;ecorator dynamically addsoverrides behaviour in an e+isting method of an ob8ect.
/acade provides a simplified interface to a large body of code.
/lyweight reduces the cost of creating and manipulating a large number of similar ob8ects.
6ro+y provides a placeholder for another ob8ect to control access, reduce cost, and reduce comple+ity.
Behavioral patterns
,ost of these design patterns are specifically concerned with communication between ob8ects.
&hain of responsibility delegates commands to a chain of processing ob8ects.
&ommand creates ob8ects which encapsulate actions and parameters.
.nterpreter implements a speciali9ed language.
.terator accesses the elements of an ob8ect sequentially without e+posing its underlying representation.
,ediator allows loose coupling between classes by being the only class that has detailed knowledge of their methods.
,emento provides the ability to restore an ob8ect to its previous state 2undo3.
5bserver is a publishsubscribe pattern which allows a number of observer ob8ects to see an event.
"tate allows an ob8ect to alter its behavior when its internal state changes.
"trategy allows one of a family of algorithms to be selected on)the)fly at runtime.
Template method defines the skeleton of an algorithm as an abstract class, allowing its subclasses to provide concrete behavior.
0isitor separates an algorithm from an ob8ect structure by moving the hierarchy of methods into one ob8ect.

Das könnte Ihnen auch gefallen