Question

This is basically a code development question that deals with frequent changes to one or more java files among many thousands.

A few years ago, as a software intern, I was given a large java / jsp code base and my mentor set me up using intellij IDE to build a WAR file for a web application (a student portal). I would then copy the War file to the tomcat container and launch it. I don't recall, but I recall to the effect that all I had to do was to press that one button (build?) to generate the WAR file. It took a long while to generate this War file. Intellij used an Ant file to build the war file. The team later migrated to Maven, but that's when my term was up.

Software development was very slow because I wanted to write code, compile and test code often in the web browser. There wasn't unit code testing.

So here's my question:

What does the industry do (for example FANG) where if I wanted to just modify ONE java file, how would I go about in a much faster fashion to compile that one file instead of recompiling every file to create a WAR file and then put it into the tomcat container and run it?

I just want to minimize the amount of time from inserting code to checking out how it behaves.

I tried to write my own batch script but taking into account all the thousands of java dependency was a nightmare. this this post. This is my first post since many years ago. I appreciate for someone to shed light on how I can approach this.

I wasn't happy with using this IDE solution because there was a very senior software engineer who didn't use an ide, isntead, used emacs on his mac. He got things done fast, but I didn't understand how he would go modify a few files and got it to run on tomcat. I can't imagine that he'd recompile everything. So please share with me some work flow using IDE and also preferably not to use an IDE.

I did my research and google but couldn't find an examnple tutorial of how such would be done. One reason I ask this question is because if I ever get a software engineering job, I would not want to modify one file and take forever to recompile everything.. it just doesn't sound like the way to go. This wasn't taught in school.

If there is a git project that deals with the above.. I'd be grateful if someone can send me an exampile git project that deals with the above webapp scenario.

Thank you. Gordon

No correct solution

OTHER TIPS

It took a long while to generate this War file.

The Java compiler (javac) runs very quickly even on large projects. Related build tools such as maven or gradle not necessarily, even on small projects. Using them is still a good idea.

I just want to minimize the amount of time from inserting code to checking out how it behaves.

Some IDEs integrate a servlet container with hot-reloading and background compilation. The result is that you can quickly run the changes in a local environment, without having to build a WAR file first.

Where this isn't available, it may be possible to embed a server like Jetty into the application, so that it can be tested without deploying to Tomcat.

What does the industry do (for example FANG)

How large companies do software development often has little bearing on how you should do development. Large companies can be surprisingly dysfunctional, and sometimes they just put up with such frustrations. For many build-related problems, more hardware might be the cheapest answer. Keeping application smallish is another popular approach (→ microservices).

I wasn't happy with using this IDE solution because there was a very senior software engineer who didn't use an ide, isntead, used emacs on his mac. He got things done fast

IntelliJ is a great Java IDE. There's no better environment for writing Java code. Emacs is, well, Emacs. People who are productive with Emacs or Vim aren't productive because that software leaks magic 10× engineer juice, but because those people have spent a lot of time familiarizing themselves with these tools, sometimes to the point of writing their own plug-ins. In both IntelliJ and Emacs, you can compile the project with a single keyboard shortcut – the Emacs user is just more likely to know that shortcut.

You are also missing the possibility that the very senior engineer isn't productive because they don't use IntelliJ, but despite using Emacs. Knowing what you're doing is more important than the tools you're using, but using good tools is still good.

Licensed under: CC-BY-SA with attribution
scroll top