🌐
GitHub
github.com › in28minutes › java-best-practices
GitHub - in28minutes/java-best-practices: Best practices in Coding, Designing and Architecting Java Applications · GitHub
I've been Programming, Designing and Architecting Java applications for 15 years. I would like this page to serve as a good starting point for programmers to understand what it takes to build good applications. I would talk about Best practices and Frequently asked questions in Coding, Designing and Architecting Java Applications.
Starred by 1.4K users
Forked by 621 users
🌐
GitHub
github.com › jph98 › java-best-practices
GitHub - jph98/java-best-practices: Best practices for things you should and should not do using Java
Best practices for things you should and should not do when coding Java.
Starred by 7 users
Forked by 2 users
🌐
GitHub
github.com › topics › java-best-practices
java-best-practices · GitHub Topics · GitHub
awesome reactive-programming awesome-list hibernate-orm-framework java-performance-tuning java-best-practices good-first-issue java-awesome awesome-java spring-boot-microservices object-oriented-programming-in-java android-development-java restful-api-development java-concurrency-and-multithreading java-security-best-practices unit-testing-with-junit-and-mockito java-and-cloud-computing java-integration-with-docker-and-kubernetes data-structures-and-algorithm-in-java
🌐
GitHub
github.com › in28minutes › java-best-practices › blob › master › pdf › CodeReview-BestPractices.pdf
java-best-practices/pdf/CodeReview-BestPractices.pdf at master · in28minutes/java-best-practices
Best practices in Coding, Designing and Architecting Java Applications - java-best-practices/pdf/CodeReview-BestPractices.pdf at master · in28minutes/java-best-practices
Author   in28minutes
🌐
GitHub
github.com › topics › best-practice
best-practice · GitHub Topics · GitHub
This repository crested to put the code examples of my Java string best pratices youtube video series. You can view videos using below URL ... Apache Fineract CN template for creating new services. Contains best practices examples and documentation
🌐
GitHub
github.com › hotplugin › java-best-practices
GitHub - hotplugin/java-best-practices: Best practices in Coding, Designing and Architecting Java Applications
I've been Programming, Designing and Architecting Java applications for 15 years. I would like this page to serve as a good starting point for programmers to understand what it takes to build good applications. I would talk about Best practices and Frequently asked questions in Coding, Designing and Architecting Java Applications.
Author   hotplugin
🌐
GitHub
github.com › narottamgla › java-best-practices
GitHub - narottamgla/java-best-practices: Best practices in Coding, Designing and Architecting Java Applications
Best practices in Coding, Designing and Architecting Java Applications - narottamgla/java-best-practices
Forked by 2 users
🌐
GitHub
github.com › binkley › modern-java-practices
GitHub - binkley/modern-java-practices: Modern Java/JVM Build Practices
Modern Java/JVM Build Practices is an article-as-repo on building modern Java/JVM projects using Gradle and Maven, and a starter project in Java (the advice works for non-Java languages on the JVM though details may change).
Starred by 976 users
Forked by 71 users
Languages   Shell 51.0% | Java 41.8% | Earthly 7.2% | Shell 51.0% | Java 41.8% | Earthly 7.2%
Find elsewhere
🌐
GitHub
github.com › agitrubard › java-spring-best-practices
GitHub - agitrubard/java-spring-best-practices: A repository dedicated to showcasing best practices in Java and Spring through concise code snippets.
This repository is a collection of best practices and code snippets for Java development using the Spring Framework.
Starred by 111 users
Forked by 12 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › caarlos0-graveyard › java-best-practices
GitHub - caarlos0-graveyard/java-best-practices: A practical guide through all sort of nonsense things people should not do while coding Java
A practical guide through all sort of nonsense things people should not do while coding Java - caarlos0-graveyard/java-best-practices
Starred by 30 users
Forked by 11 users
Languages   JavaScript 89.3% | CSS 10.7% | JavaScript 89.3% | CSS 10.7%
🌐
GitHub
github.com › topics › best-practices
best-practices · GitHub Topics · GitHub
A repository dedicated to showcasing best practices in Java and Spring through concise code snippets.
🌐
GitHub
github.com › RameshMF › java-best-practices
GitHub - RameshMF/java-best-practices: A guide to java/j2ee best practices
A guide to java/j2ee best practices. Contribute to RameshMF/java-best-practices development by creating an account on GitHub.
Starred by 7 users
Forked by 6 users
🌐
Google
google.github.io › styleguide › javaguide.html
Google Java Style Guide
These practical concerns take priority over alignment. Optional grouping parentheses are omitted only when author and reviewer agree that there is no reasonable chance the code will be misinterpreted without them, nor would they have made the code easier to read. It is not reasonable to assume that every reader has the entire Java ...
🌐
GitHub
github.com › PacktPublishing › Design-Patterns-and-Best-Practices-in-Java
GitHub - PacktPublishing/Design-Patterns-and-Best-Practices-in-Java: Design Patterns and Best Practices in Java, published by Packt · GitHub
This is the code repository for Design Patterns and Best Practices in Java, published by Packt.
Starred by 56 users
Forked by 53 users
Languages   C 43.5% | C++ 30.8% | Java 25.3% | HTML 0.4%
🌐
GitHub
github.com › cxxr › better-java
GitHub - cxxr/better-java: Resources for writing modern Java · GitHub
Java's type system is pretty weak. It doesn't differentiate between Strings and Strings that are actually regular expressions, nor does it do any taint checking. However, the Checker Framework does this and more. It uses annotations like @Nullable to check types. You can even define your own annotations to make the static analysis done even more powerful. Even when following best practices...
Starred by 5.8K users
Forked by 713 users
🌐
GitHub
github.com › andrejs-ps › Java-Refactoring-Best-Practices
GitHub - andrejs-ps/Java-Refactoring-Best-Practices: Demo code for my Pluralsight course: Java Refactoring Best Practices
Demo code for my Pluralsight course: Java Refactoring Best Practices - andrejs-ps/Java-Refactoring-Best-Practices
Starred by 6 users
Forked by 13 users
Languages   Java 100.0% | Java 100.0%
🌐
Pmd
pmd.github.io › pmd › pmd_rules_java_bestpractices.html
Best Practices | PMD Source Code Analyzer
This rule is defined by the following Java class: net.sourceforge.pmd.lang.java.rule.bestpractices.UnitTestContainsTooManyAssertsRule ... public class MyTestCase { // Ok @Test public void testMyCaseWithOneAssert() { boolean myVar = false; assertFalse("should be false", myVar); } // Bad, too many asserts (assuming max=1) @Test public void testMyCaseWithMoreAsserts() { boolean myVar = false; assertFalse("myVar should be false", myVar); assertEquals("should equals false", false, myVar); } } ... <rule ref="category/java/bestpractices.xml/JUnitTestContainsTooManyAsserts"> <properties> <property name="maximumAsserts" value="1" /> <property name="extraAssertMethodNames" value="" /> </properties> </rule>
🌐
GitHub
gist.github.com › 313677fcc9d9d9ad9dad3d2325be8fd7
Java coding best practice · GitHub
Java coding best practice. GitHub Gist: instantly share code, notes, and snippets.
🌐
Google Cloud
cloud.google.com › java › documentation › java best practices
Java best practices | Google Cloud
Artifact Registry [Containers] ... built Java artifacts. GitHub, Gitlab, and Bitbucket are also good homes for your source code. Test automation can be critical to your success using most of these techniques. For additional thoughts about testing best practices, take a look ...
🌐
Reddit
reddit.com › r/javahelp › best practices for java project git repositories?
r/javahelp on Reddit: Best practices for Java project git repositories?
November 19, 2021 -

I'm a developer with no previous Java experience, who has recently taken on a technical product manager role. I will be working with several developers going forward, including a Java developer who will be maintaining a REST API server that runs under Tomcat on AWS Elastic Beanstalk.

The Github repos which I've taken over from the previous developer include no documentation whatsoever. There is just some Java source code, an IntelliJ .idea configuration folder, a buildspec.xml file, and a pom.xml file.

I've installed Tomcat 9 on my Ubuntu workstation and figured out the basics of using Maven to compile and deploy a WAR file, so I'm comfortable I have the basic lay of the land now.

With that as background, obviously the current state of this git repository is not ideal. I would like to whip it into better shape, add some documentation, and generally make sure that it follows best practices.

So... in the Java world, what are those best practices? Specific questions:

  • Are there certain files that should always be present in version control? Conversely, are there others that should be gitignored and never checked in?

  • What is the preferred way to store environment configurations for local dev, stage, and prod environments?

  • How are WAR files typically deployed to AWS EB? Should the deployment scripts be checked into Git?

  • Is docker commonly used in the Java world and/or is it helpful? Should a dockerfile be included in this Git repo and if so, is there any specific way it should be configured?

  • Is the IntelliJ editor preferred by most Java developers, or should the project be editor-agnostic?

  • Any other advice on how to make this a clean Github repo?

Thanks!

- Java noob

Top answer
1 of 5
3
There's nothing really special about java when it comes to using git, same general principles as any language apply, such as checking in everything project need but not any editor specific files, binaries or generated files, and especially don't check in secrets. Are there certain files that should always be present in version control? You source code and any other files needed for you code to build and run. Conversely, are there others that should be gitignored and never checked in? Never check in any secrets like database passwords or api tokens. Binary files and generated files should not be checked in either. (ie .class and .jar files for java, anything under mavens target/ directory, any reports or logs that produce files outside of target/). In general editor specific files (.idea and .iml for intellij) should not be checked in, since those are specific to the developer and not part of the project. What is the preferred way to store environment configurations for local dev, stage, and prod environments? This depends entirely on how your application handles its configuration. I've seen both just having local config files checked in and in andin deployed environments the config is provided by the environment, and I've also seen config files for each environment part of the project repo. The important thing is that you don't check in any secrets like database credentials or api keys. Should the deployment scripts be checked into Git? If you have scripts then yes. Is docker commonly used in the Java world It's as common as it is with other languages. Should a dockerfile be included in this Git repo? Does the project use docker? From your description it sounds like it doesn't. Is the IntelliJ editor preferred by most Java developers, or should the project be editor-agnostic? Yes and Yes. Intellij is popular, but the project should be using maven (or gradle) and be editor agnostic. There are other popular ide's as well including eclipse, netbeans, and even vscode. As long as you stick to a standard build tool (maven or gradle) the project should work in any editor.
2 of 5
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.