Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

gordon provi

Greenhorn
+ Follow
since Aug 04, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gordon provi

Jan Daermann wrote:1. I would not worry about the compile time issue, that’s a non issue if you start your own project.



This is at the crux of the problem, that once I get a job, it's no longer my project that I start.  I have to be able to quickly modify code and compile just a few java files to test things out.  This is the whole point of this thread.


Jan Daermann wrote:
2. If you are worried about the relevance of the tools for your job search, go on stackoverflow in the job section and check what is required. I would think that many jobs require experience with an IDE environment, a backend environment (Java Spring 5.0 or Java Spring Boot 2.0, very similar) and a front end environment (html, css, Javascript plus JS libraries like React or Angular).
3. There are tutorials available: udemy offers a course “fullstack development with Spring Boot 2 and React” for $12.- in the moment. There is also a good book with the same name on Amazon that gives a fun overview without going into too much detail.
4. Just to make sure we are on the same page: Backend means any Java framework (like Spring Boot 2.0), typically edited on an IDE like eclipse. It handles all the data persistence (JPA, Hibernate), security, backend logic and deals with requests that reach the server. It runs on a separate server and typically has access to a database server as well. Nowadays it is often a RESTServer or RESTApi -> it does not return a webpage anymore, it returns a dataset (JSON object, representational state transfer). Frontend often means html, css, Javascript sites, often edited in a different IDE (Visual Studio Code) that typically runs in conjunction with a JS development tool like “npm” or “yarn” (The JS world is a little more complicated here). React and Angular are the graphics libraries for JS that make things easier. npm includes its own webserver that runs the websites simultanously, so you see changes in your code on the flight. The frontend consumes the JSON object coming from the backend and display it. After you have digested this jungle you are a fullstack developer .




These do not teach people how to modify one or few java files in a major web app program.  Thus point of this thread.
1 week ago

Jan Daermann wrote:Eclipse for JavaEE Developers includes JUnit testing. This is probably the version you want to download anyway if you do web applications. Maven and Github support should be included as well.
As for recommendations for Youtube tutorials you would have to post what framework you are planning to use or has been used in the existing project. Spring MVC or Spring RestAPI projects are very different than projects with other frameworks, but they are all Java frameworks.
If you want to improve Modularity in your project I suggest you look for "Java Microservices" on Youtube. If you look for Java Modularity you end up with lessons about Java9+ in the 'SE' world and not so much in the 'EE'/'Jakarta' world.



I've been away from programming for 3 years.  I didn't know Spring.  But I would like to use a project with Maven.  I've heard that React is popular.  I don't want to waste a lot of people's time so I'm thinking, if you have an open source Spring project or whatever framework that uses Eclipse, and have Junit testing, and are willing to make the video that would do it for me.  Most important for me though is:   I'd like to just change one java file of the many and have eclipse recompile only that one file and not anything else =)  this project of course would use Tomcat, so it's an webapp.  These are the only requirement.. frameworks, etc, it doesn't matter, and I can learn something on the side too=)   Well, I'm fine with any framework just to minimize the burden and get this tutorial off the ground; besides, if and when I get a new job, I don't get to call the shot as to what to framework to use, so all is fair game at this point. =)  I'm just pretty desparate to see this fast compilation / work flow.  This is the whole intent of my post.  I just want a tutorial on how it's really done in the real world so that I have some confidence that I don't have the "imposter syndrome." =)  I suppose once the tutorial gets posted using Eclipse, if people who use emacs can chime in how they go about doing things of just compiling that one file, that would be fine too.  I'm curious about this emacs or simple editor thing because this particular senior architecture guy was able to churn out code FAST.  I don't know what his setup is or how he's able to code without an ide.  he used a mac and was basically on the command prompt.  Some say it's best not to code with an ide because of the setup issues one may run into going into a new job.  Thus, I'd like to see things done with and without an ide, but the main thing is, i'd like to see change in one one java file =)  without recompiling everything else.

Thank you,
Gordon
2 weeks ago

Tim Holloway wrote:

Jeanne Boyarsky wrote:

Stephan van Hulst wrote:In addition to what Jeanne said, if it takes a long long time to build your WAR, the application is probably not modular enough. Thousands of classes in a single assembly? Bad design.


Ooh. Good point.

To spell that out a litter more since Gordon is a student:
IDeally the projecct would have one or more Java project it depends on. Then you need to just rebuild the jar it is in and not recompile all the code in other jars.



Upvote.

I have used Emacs as an IDE for Java. There's a plugin for that. It's not as good as, say Eclipse, but at the time, I was editing on a 200MHz Pentium. Emacs is a monster, but not compared to most Java IDEs. Plus the machine in question wasn't running a windowing system.

I've never done an in-depth study, but my impression has always been that given a set of files, the javac compiler will recompile only the files that need it. That is, if you delete all the target classes, then obviously all the files must be re-compiled, but the process should be much faster if you leave the compiled classes in the compilation target class directory, since only the changed source files need full compilation. Even if this wasn't true, however, then even Emacs could run the java compiler as part of a file-save operation instead of waiting for a batch build command.

Easy way to test. Take a large Maven (or Ant project). Change 1 file, save it, do "mvn compile". Note timing. Now do "mvn clean compile". If all files are compiled all the time, then the two times will be about the same and fairly long. Otherwise the second timing will be much longer than the first. And no, I don't think Maven is where the decision to do selective compilation is made, so if there's a difference, it's almost certainly javac.



-------------

I was a newbie, so all I knew at the time was to press the one button in intelij and I think it was called compile or something and it would go and build the whole war file.  intellij kicked off some sort of ant script to do the war compilation.  it would take a long time like x minutes or so to recompile even if I change just a single jar file.  I think I had click on the clean button too before each recompilation so that there's no error in the ant script, so that's one of the problem.
2 weeks ago

Stephan van Hulst wrote:In addition to what Jeanne said, if it takes a long long time to build your WAR, the application is probably not modular enough. Thousands of classes in a single assembly? Bad design.



How would you do it?  I always thought one web app would be one war file, which can have many jar files and .class files.  Are you saying that one big fat web app would have many war files?
2 weeks ago

Dave Tolls wrote:A couple of things leapt out at me from that.

gordon prog wrote:
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.



Dear lord.
At least youre not working there anymore.
That's a recipe for disaster.

gordon prog wrote:
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 don't really have anything against emacs, but it's not exactly a standard development environment for Java.
As others have said, the root problem is going to be the sheer monolithic nature of the project.

The one I'm on has a fair number of modules, and the build time across the module is 10-15 minutes, but that is mostly taken up with unit tests.

Since the IDE compiles the classes as I go along anyway, it is possible to simple lift the class(es) I've modified and drop it into the unpacked Tomcat deployment if I want to do a hacky test.
But note that that is a hacky test, and not something I would rely on to actually ensure things work properly.




Dav or anybody else, for the sake of me learning this one little skill of working on a massive project, I'd like to learn how to setup my ide (eclipse?  I'm requesting the eclipse environment because that's free and it can do web development whereas the intellij community version doesn't allow web development.) with an open sourced project on github so that I can download it and play with it as though i'm facing my first day of real work.  Important:  i request that this be some sort of web application that uses tomcat.  I assume there's such a free project on github, if not, maybe start a small one and we build it for knowledge building sake.  I request the project also be Java based.  It would be really helpful if this thread / youtube video can walk me through the setup.  I can't find such tutorial and I think it would help a ton others.  Also, the project would have unit testing etc.  I know I'm asking a lot but I think it would help a lot of newbies out there.  I've read books before, but it doesn't get at what people face in real world and put it all together.  I'm at a point that I feel pointless to prepare for job interviews when I feel that I don't know enough where I'd be kicked out the first day.  Thus this request.  For peets sake, for sure, this request would be shot down at StackOverfool.

I really wish someone can tutor me over this "getting started the right way hurdle."  School didn't teach it.  Landed my internship, didn't teach it, and I suffered.  I'm also interested in the dropping the jar file .. I'm not sure how to do the "unpacked Tomcat deployment" by dropping in a single jar file and have tomcat auto update.  Historically, tomcat was slow to auto update.  I dont' recall, since it's many years back so I don't recall how it was done.. he had me somehow compile for this one jar file and copy it into one of tomcat's directory, and restart tomcat (without recompiling to a war file) because it would not immediately recognize the change jar, but that lead to out of memory errors on tomcat.  

I suppose what I'm asking for is ... is there any chance someone can create a youtube video on the above? =)  It's much clearer than to type and it's much easier to follow along with fewer errors.  And to encourage you... maybe you can  monitize on the video too! =)  it's a win - win right?

To answer people's question:  reason why the company made one big fat war file was because there's a lot of web apps that the (company / school) hosted, and so each war file belong to one web app.  i suppose it was an easier way to keep track of web apps.   The war file was a bit over 100 megabytes.

Thanks a bundle,
Gordon
2 weeks ago

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.


I posted this question below but there appear to be dumb trolls who don't care to read the question:
https://softwareengineering.stackexchange.com/questions/395553/how-to-modify-and-compile-only-few-java-files-among-many-thousands-and-deploy?answertab=active#tab-top

Thank you. Gordon
2 weeks ago