Create your own personalised starter project with dependencies, folder structure and compiling, working code
Nothing beats code that 'just works'
Give me something that works out of the box so I can start playing with it as soon as possible. Don't force me to wonder:
- Which project type do I need to create?
- What should the folder structure of the project be?
- Does this file need to be on the classpath or just the filesystem?
And the classic: Where exactly do I put this block of text you've just shown me so that I can see the thing you're explaining to me?
Developers need working code that runs, not context-free snippets of text.
With concrete working examples that run, you can experiment and play with the code to get real objective feedback.
And with feedback you can learn.
- How does this function work? Try it and see.
- What does this framework do? Try it and see.
- What happens when I do ... ? Try it and see.
Try it and see ... don't read about it.
For Java software development today, this usually means having a complete project setup and running in your IDE with all the required dependencies.
So, to get to where I can 'try it and see', I keep a little starter project ready in source control.
There are many ways to set up a project to start writing tests in Java (I'm a huge TDD fan).
Here's just one of them.
What is it?
A git repo with:
- working test and production boiler-plate code that demonstrates how to use JUnit and Hamcrest.
- my recommended folder and package structure
- gradle wrapper and build script to manage dependencies and generate IDE specific project files (useful when pairing with someone who uses a different IDE)
Just clone it and go.
$ git clone firstname.lastname@example.org:michaeldeluna/tdd-starter-kit.git Cloning into 'tdd-starter-kit'... remote: Counting objects: 25, done. remote: Total 25 (delta 0), reused 0 (delta 0) Receiving objects: 100% (25/25), 49.38 KiB | 32.00 KiB/s, done. Checking connectivity... done. $ cd tdd-starter-kit $ ./gradlew idea :ideaModule :ideaProject :ideaWorkspace :idea BUILD SUCCESSFUL Total time: 4.615 secs $ open tdd-starter-kit.ipr $
Do you always use the same set of frameworks or have a preferred project structure that you have to repeatedly construct by hand each time you start a new project or simply want to try something out?
Why not build your own custom project and check it into source control?