Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: what are some steps to learn a project where you have a little or no experience

As a starting programmer with little industry-experience, I find it frustrating to learn a new project which is based on many technologies that I am not familiar with. The project I am working on has about 150 classes with 15000 lines of code, and with its extensive focus on socket and security programming which I have zero experience in, I am not sure where I should start.

With limited documentation and help at hands, self-study is my best resource in trying to understand this project as a whole. I often find myself spending way too much time learning insignificant features of the product while missing out the crucial classes that I should really be focusing on... The main reason why it takes so much time is that I often have to look into Java API reference every few minutes to understand a small code block... I am sure I will eventually learn it through trial-and-error, but I am sure that there are some useful advices and guidelines I can use :)

like image 886
Midnight Blue Avatar asked Feb 01 '26 13:02

Midnight Blue


2 Answers

Initially, you don't need to understand every line of code.

Borrow a senior developer for a half-hour and ask him to give you the birds-eye view of the architecture - what the major blocks of code are, how they interact, and how the user / usage drives data through the system.

Then spend some time investigating the source for the modules you feel (after the explanation) will give you the best insight into "how it all works".

I have a (probably quite odd) habit of printing out large blocks of sourcecode, and covering a floor with the printouts. Then I can kneel down and crawl around on the floor with a pen and literally draw arrows from point to point, and draw around sections - I find that displaying code in 2D makes it easier to figure things out. It also enables making copious notes that help me understand the flow in more detail.

Before long, you'll start to recognise idioms (stylised ways of doing things) that characterise the code, and eventually you'll find your way into the mindset of the authors. Then everything will be a lot simpler.

While you're on the floor, crawling around, have a laptop+google handy, so you can decipher anything odd you encounter. Also: Coloured highlighter pens FTW.

Make (at least) two passes at understanding the source. The first time don't try to understand any of the minutiae... try to get a feel for "movement" - where data goes, and where execution goes. That will give you a framework for your mental model of the code. When you go through next time, you can start to break down details, but a top-down approach always makes things easier for me.

If you're not familiar with the technologies, language or environment, then do see if there are any books around you can grab. There's a lot more visible space in the real world than you can fit on a computer screen, and having google on a laptop, syntax/library references in a book, and the code all around you makes (for me at least) the whole process VASTLY simpler.

like image 180
Dave Gamble Avatar answered Feb 04 '26 06:02

Dave Gamble


A few things come to mind:

  1. Spend a little time getting familiar with the JDK and its standard classes. Having knowledge off the top of your head will take time and a lot more checking the API spec, but you can also spend some time just browsing without a particular thing you're looking up.
  2. If your project is using some frameworks or libraries, you can often get a high-level view of what these bring to the project by reading the "intro" page on the project site. I think this might be of particular help to you, since you cited unfamiliarity with some of the technologies used in the project as a source of frustration.
  3. If there are any functional integration or regression tests, these can often be a good way to get a handle on what the main entry points into the project are. Having a good grasp of the high-level functionality of a project is often helpful when trying to understand the little details.
  4. If you can find a mentor on your team to show you the ropes, that will probably help a lot.

I think, based on the size of the project you mentioned, that this can be a gentle introduction to production code for you. It might seem big now, but 15000 lines of code is on the smaller side of the projects you might eventually work on during the course of your career.

Remember also that this is necessarily going to be a learning experience for you. It's one of your first projects in the industry, so it might take a little while to get used to things. Keep in mind that you're not the first person to have to swim in library / framework soup in an unfamiliar code base.

Good luck!

like image 40
Paul Morie Avatar answered Feb 04 '26 07:02

Paul Morie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!