Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

How to understand new java web application

Let us say main java program is in xyz.class(in package test1) which has A() method which has C() method inside that.

public void A() { C() ; }

but C() method is in different class say abc.class in different package say test2.

I keep changing to new projects every 3-6 months due to nature of my job.
If i go to new project to understand the java application esp. if one class is in service layer other classs is DAO layer etc it adds more complexity to remember.

Let us say if there are UI files(login.jsp. order.jsp, confirmation.jsp of shopping cart) from which we are doing some CRUD operation on the database with UI, SErvice, DAO etc layers is it is good idea to take paper and pen and write the flow from which package ,class, method, line which other package ,class, method, line getting called or put debug points on specific lines. Challenge is when code changes by other deveopers line numbers keep changing also.

How to understand and document the flow so that i remember al the time with quick glance wthout spending too much time.

I tried each step as screenshot and paste in word document and refer that and also take hard copy of printout. But some times that documet coming too long like 50-100 pages which is bit challenge.


please advise
Any links resources ideas highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

Adding to complexity some methods come from classes of jar files which do not open in eclipse. How to take them also into consideration?
Avatar of dpearson
dpearson

Treat external JAR files the same way that you treat code from another layer.

Don't try to follow the code into those files (which for an external JAR without source, is of course impossible) and instead just understand the methods as best you can from the available documentation, names and parameters.

Doug
Avatar of gudii9

ASKER

Nothing to do with identifying the design patterns to understand the web application right. Otherwise that is also one other challenging task to identify different design patterns in different layers like UI, service, DAO etc. Please advise
Yes you generally don't need to worry about identifying design patterns when trying to understand a set of code.

You might very occasionally recognize that the code you are reading is following a specific design pattern, but design patterns are much more useful when writing code than when reading it.  They're a way to discuss and implement different designs, rather than a way to think about the code when reading it.  99.9% of the code you read will not be part of a design pattern.
Avatar of gudii9

ASKER

That makes more sense

99.9% of the code you read will not be part of a design pattern.

Above line is not clear. I thought other way. can you please elaborate?
Design patterns tend to be used to solve specific types of problems.  E.g. How do you write code to interface to another module - maybe I'll use the Adapter Pattern.  So the code you write to connect one interface to another could be said to be part of a design pattern, but the two sides of the connection are not.

In my experience, the vast majority of code in a system is not built to meet a specific design pattern.  It's largely code providing direct functionality - e.g. code to write to a database, code to verify input parameters in a request etc.

You learn design patterns so you have a set of tools to help solve hard problems.  But most of the code we write should not be solving hard problems - those should only come up occasionally, allowing most of what we write to be simple and easy to write.  If it all seems hard, then something is probably wrong with how you are doing it.

Doug