r/learnjava • u/Particular_Ambition8 • May 05 '21
What are some Java projects with little to no front end work?
Excluding low level projects, what ideas can you guys think of? Preferably, for beginner to intermediate java programmers.
17
u/knoam May 05 '21 edited May 05 '21
Find an API for something you're interested in and go from there.
1
May 06 '21
I just realized that I don’t know what an API used! I think I thought it was more, well, whatever the user interface would be for a program (so whatever the “front end” the OP was referring to).
But your comment and link make me think that I’m wrong here...
What’s an API?
4
May 06 '21 edited May 06 '21
You can think of an API as simply a function you can call from outside the project it's in. You may provide it with inputs and the API does something specific with them. There are different types of APIs like rest and soap for example, each exchange data differently and have certain communication protocols
For example, to communicate with a rest api, you need to use an Http client to send a certain type of http request along with your inputs in json as needed. The rest api logic maps your http request to a function/method/service in your code, and maps json data to input variables to that function.
The really nice thing about apis is that they provide a way for different languages and applications to exchange data, or a neutral way to serve many different clients. For example let's say I create a function in Java that adds two numbers together like so.
public int add(int i, int j){ return i+j: }
This function can only be called from within my Java app now. However, I can use springboot, which is a framework that manages the logic of transforming my function into a rest api (for example it handles mapping JSON data into Java variables and vice versa). In springboot, I only need to add a few annotations like @Controller on my class and @PostMapping at my function, then my function becomes an API that can be called by anyone with an http client. If I deploy it on a server on a certain URL, anyone can ping that URL while sending me two numbers in JSON, then the API would send them back the sum of it. But still, at the most basic level, my API is nothing more than a function that's expected to provide a certain service. There are some really cool apis out there that do some pretty nice stuff. If you want, install postman, which you can use to send api requests, and mess around with a few apis online
Edit: oh, and another important note, APIs are often used by front-end clients like websites to offer backend functionality. This results in your front-end and backend being completely separated. For example, let's say you build a few APIs in springboot that offer CRUD database functionality (the Api functions themselves return or update database contents), then you can deploy this spring application completely separately, and your website front-end be it angular or react or pure JS would use an http client to communicate with the database through api requests sent to your spring app
1
u/cervantesrvd May 06 '21
Really easy to understand and detailed reply, I now get the idea better. I'm not the OP but many thanks mate.
1
1
u/knoam May 06 '21
An API is what you create when you want to make it easy for someone to write code to interact with your thing.
The I in API is interface, which is the same as the I in GUI. So a GUI is what you make when you want someone to be able to interact with your thing in terms of point/click/tap/drag/type. An API is a coding interface.
That's the strict definition of API that applies to code you write for your colleagues to use and it applies to libraries. Most often API is used specifically to refer to remote APIs.
A remote API is what you would use to talk to an external system running on a server. Say you want to create a bot or have your code send a tweet. Often it looks like sending an HTTP request, which is the same thing as how your browser downloads a web page. But instead of getting HTML (a document format) back, you'll get back a data format like JSON or XML.
To understand an API, compare it to something like Autohotkey which automates pointing and clicking, or web scraping. These are not APIs and they make the task harder than they need to be because they require you to reverse engineer user interfaces. And they're not stable. A web page could get redesigned and break your scraping code. An API won't change all of the sudden because it has less reason to and they know it will break your code.
8
u/1-12TH May 05 '21 edited May 05 '21
I built a Prime Number Finder / PC Bench Mark. I know finding prime numbers is a pretty standard suggestion but when I had finished it would find the first ten million primes, determine the average amount of primes found per second, reads a file containing previous attempts and ranks the current trial, then writes the info back to file.
I still enjoy running a version of it on different or new machines when I get a chance.
4
2
u/ViralLola May 05 '21
You could make a car showroom project. Have arrays that hold the color, make, model, top speed, average miles per gallon, etc. Have functions that will sort the car via various means. (alphabetical order, by top speed, etc.) Have a function to search if a certain car exist. Then use stacks and queues to add and remove cars as they are being "bought" and "sold".
2
May 05 '21
You’d probably end up getting bored doing the kind of things we do in the real world.
So simple games are good; Like blackjack (the dealer has simple rules to follow)
Battleships (with an AI.)
Chat app for networking.
I like the idea of a maze solver using A* or similar.
2
u/s_131 May 05 '21
You can access a covid API and maybe play around with that. Maybe make a simple dashboard
2
u/darksounds May 05 '21
Card and puzzle games are wonderful options.
Consider making an idle game! Simple way to do a game loop without being graphically heavy. Can just use simple buttons to handle purchases, so it uses a few front end ideas, but doesn't have to be pretty!
2
u/americk0 May 06 '21
Lots of great suggestions here for no-front-end-code projects so I'll add some little-front-end-code suggestions. You can learn just the fundamentals of html and maybe just enough javascript to get forms to submit in probably under 2 hours and spend the rest of the time working on a backend rest api using Java and a tool like Spring Boot to implement all kinds of websites. For example,
Make a To-do list site. You'll need to learn a little about html forms and how to use JavaScript's fetch API to call your backend endpoints but the rest of the logic is Java
Make a movie database website. Learn about html forms and JS's fetch API, choose a database like mongodb or mysql to learn about, search online for imdb raw data (should be able to get the data as a couple giant csv files), and make the magic happen with Java. You could keep the front end ugly and simple and just focus on the bare minimum html to get form input and display results and the rest of the work is in Java (and some SQL if you go with a relational db)
Build a simple social media site. Minimal front end code needed to add and display posts and comments. Add a database to store the posts, comments, and users. Then just wire it all together with Java
If you want to do it all in Java then you could replace the front end bits with Java's UI libraries and choose a NoSQL database as an alternative. Those are some little-front-end-code if you wanted some ideas for mostly-Java apps that you could write that showcase how Java plays into the backend web dev scene
2
1
u/RedHeadedCongress May 05 '21
I made a matrix calculator back when I was taking linear algebra that had very minimal front end work
1
u/getbeetlejuiced May 05 '21
create a Premier League table where you can add matches with dates that automatically update the league table using an abstract class called league manager
1
1
1
u/Stack_Canary May 06 '21
You can make REST-services that use different kinds of technologies. I.e a sping boot application which connects to a database of user, authentication, maybe it has integration with other services? Here is a list of free REST-endpoints you can play around with and consume with an application https://github.com/public-apis/public-apis#open-data.
There are a bunch of interesting frameworks to interface with external services, such as spring boot openfeign for instance. For example, you can make a rest endpoint that returns random cat facts which it collects from another API.
On top of this you can generate REST-docs for your endpoints with openAPI/swagger. You can make integration and unit tests to test your code using mockito, wiremock, junit5 etc.
Even though the concept of a "REST service" seems simple, it doesn't have to be a REST controller that returns a string, you can make it as complex with as many concepts as you want. Having a solid understanding of controllers, services and database interactions in a CRUD application is in itself extremely valuable, as that's what most backend developers make these days.
1
u/ItsBJr May 07 '21
APIs, algorithms, command line tools, automation, web scrapping, databasing...
My personal favorite is automation and web scrapping, it's both practical and easy. Also helps practice a lot of core concepts.
40
u/brilovless1 May 05 '21
Command line apps have no web front end needs....
Make a casino. Deck of cards, for high low, black jack, red or black games.
Battleships
Make a maze generator and then a maze solver.
Same for sudoku, crosswords, or a hang man game ... Make a 'creator' and then a 'solver'.