r/javahelp • u/[deleted] • Feb 14 '20
Applying Java in the Real World
I’ve been doing Java programming for 4 years now (2 years in high school, almost 2 years in college), but i feel like I'm not going anywhere with what I'm learning. I can grasp the concepts fairly well and have gotten better at creating algorithms, but everything I'm doing doesn’t feel meaningful because it’s all surrounded by completing code examples.
My professor is currently using Daniel Lang’s Introduction to Java Programming. We recently completed Inheritance & Polymorphism, and are supposed to move on to JavaFX, Animations, Queues, Hashing, Weighted Graphs and Applications, and some other topics.
With this being said, i’d like to know:
Should i continue progressing with the topics in the books before anything else?
Or
Is it possible that I can apply my knowledge of Java to real life issues and projects, instead of solving simulation-like questions, and if so, what are some resources that can help guide me?
Thank you in advance
13
u/jcar74 Feb 14 '20
Some "real work" projects i did (and do daily basis) involves:
- Spring boot JPA with MySQL. Rest endpoints and some thymeleaf templates.
- Read and excel, proccess data and write another excel (POI). Also injecting images in an excel, (img filename can be constructed with column values)
- Scraping with jsoup or selenium, or pure regexp (i did a lot of scraping projects)
- Current project involves indexing a BD and 1TB PDF/html to elasticsearch 7.6, using Spring Boot 2.3.0.M1. Rest endpoints to index, search... Btw, i found a memory leak bug on pdfbox (with or without Tika), currently using system calls to pdftotext. Evaluating debezium for bd sync.
- A crapton of little conversion apps for XML, CSV, json, excel, BD and many other esoteric formats.
My 2 cents: keep on with theory and basis, and do something related to your interests, or that you enjoy.
TLRD: Spring Boot and having fun.
5
u/wsppan Feb 14 '20
This. Find a service that provides an endpoint and create an app the communicates with the endpoint using Rest calls. Use spring boot to create the scaffolding. While your at it, create unit and integration tests, use a mocking framework to mock the rest call while testing your apps code. If not already using an IDE, pick one and get real comfortable using it for development, testing, and debugging. Create a git repository and use it to track your changes and to publish your releases. Use your IDEs git integration to track your local changes. All of these will go a long way to what it's like in th ed real world.
7
u/ImPureSilver Feb 14 '20
I'm on the same boat as OP. Except I only have about a year learning and coding. I tried to learn Spring, but it's much harder than people make it to be. That's besides the point tho. It's just hard to get to making something happen.
2
Feb 14 '20
Keep asking questions! Spring has an interesting learning curve depending on what your theoretical base is.
Ask questions on here! I'm always happy to answer Spring-related questions.
1
u/ImPureSilver Feb 15 '20
Oh cool, thanks in advance.
My first question. I understand that Spring can be many different things. Some of which I understand can be a database management tool, a Rest API, and many more, but how is it that these things come into play when trying to make some applications for Android or any other platform?
Second question, I was watching a Udemy Spring basics course. The few things I understood were the annotations such as @Component and @AutoWired simply because it's like telling Spring to spawn said object with said method, but what I don't get is this. Am I supposed to annotate everything around my application or do I just have to understand more if not all of the annotations?
5
Feb 15 '20
So on the first question, Spring is a framework, and there are components that are built for that framework. For example, you need Spring Data to do database stuff with Spring, and Spring Data is a part of Spring.
There's "plugins" in the larger ecosystem. Spring Web does Rest API type stuff, etc.
They only come into play when you need them to. For example, if your Android app is going to download data from a complicated messaging tool. You could use Spring Cloud Stream ( https://spring.io/projects/spring-cloud-stream ) to do so, otherwise you'd be writing the libraries by yourself, or using some other library. Spring Cloud Stream is a "nice to use" version that is meant to be easy and straightforward.
Think of Spring as an ecosystem, it's a framework with a bunch of pieces that you can use.
For the second question, these annotations do work in the background.
What you want to look into is "dependency injection". For example, you want to create a new object using
new MyObject()right?Rather than do this, you can do something like:
@Beanpublic MyObject makeMeMyObject() {
return new MyObject();
}What this does, is now anywhere in the code where you say
@Autowired
MyObject object;It will call the Bean that you wrote.
To put it a bit more simply, rather than instantiating things using "new", you request it to be autowired in, and Spring will get and build something for you. It means Spring can do clever things, like reuse old objects, wait until the last minute to build stuff, and it makes code just a little bit cleaner IMO.
It'll take a little while, but try to understand the Spring Context. That's where most of the magic is happening. Once you have a good idea about the context, things start to fall into place. Hope this helped!
5
u/amackenz2048 Feb 14 '20
Come up with some program you would like and start building it. Maybe it's an Android app to take notes in. Or a program that automates some task for you. I once wrote a program that graphed 3-D functions to a) learn OpenGL and b) help me with Calculus.
You can also find something on GitHub that maybe you want to make some modifications to. Add a new feature for it! You'll get some good experience with learning to read and understand someone else's code which you'll need in "the real world".
4
u/NotObviouslyARobot Feb 14 '20
I use Java to build data processing tools that let me draw meaningful conclusions about business data.
2
u/TheRealMongul Feb 14 '20
The most useful class in my undergrad CS sequence was, by far, Data Structures (where you get into Stacks, Queues, Linked Lists, Maps, Trees, Graphs, etc). From there the rest of the courses in my school were more academic than practical, though it sounds like if you're getting into JavaFX at some point, then that's good stuff.
In my experience, university CS programs are always research focused. I've long thought schools should develop a Software Engineering curriculum for more practical stuff you'll need (with courses on dependency management, unit testing, and case studies for software design and system architecture).
For now, though, there's no substitute for actual job experience. I feel like I learned more in my first 2 years as an actual software developer than my entire time in college. Of course, as you move up to Senior Developer and eventually Principal or Lead Developer, that academic stuff from college starts to become more and more important (critical, in fact, if you land a job at a major firm like Amazon or Google).
A good place to start might be to read up on the products Spring offers (spring.io). There are plenty of tutorials for learning how to implement simple RESTful web services and other things. It may be a bit overwhelming at first, but especially if you start with basic Spring Boot stuff, you could start writing working applications pretty quickly, and since Spring stuff is SUPER common in the world of Java-based software, it'll be valuable experience!
2
Feb 15 '20
I'm in a very simmiliar situation. I learned coding java at university and after the first semester, where I learned the basics of OOP, I decided to code some stuff on my own. For example the first project I did was a simple particle system using JavaFX. After that I was looking for some freelance work to get some money besides university and I quickly decided to go into android programming. It took some time for getting my first paid project while I was constantly trying to improve my skill and knowledge. But the most important thing is that learning all that theoretic computer science stuff at university is very essential for real life projects. No online tutorial can keep up to a professor and staff who has years of experience especially in teaching other people. But I also think its very important to code your own stuff and develope real live applications because it keeps you motivated.
1
u/DreadedEntity Feb 15 '20
I did java for years in school and I thought I was “good” but now that I’m working professionally there are things you need to be able to do to actually be useful. They teach you foundation stuff at school but nothing was actually “cool”
Here are some actual cool things you can do with programming:
Create canvas and draw on screen (awt)
GUI (I think I remember this being called swing in java)
Multithreading
Make 2 programs talk to each other using sockets
These things will let you hit the ground running at work if you know them:
Send http requests to an api and handle responses
Build a small website using java
Interact with a database
1
1
u/umakemyheadhurt Feb 14 '20
Basic data structures liked queues, lists, hashing is very valuable. JavaFX is meh. I don't think universities provide very good real world training. Learn how to use Maven, structure a project, import and use dependencies, write unit tests, and build a jar that can execute.
2
u/Devpupper Feb 14 '20
I actually was given the same advice when I was in the early days of my college career. My problem was that I was forcing it. I found later it was much easier to contribute to open source that I was using in my projects because I knew what would make it better.
Not saying not to contribute to open source because there a bunch of projects on GitHub that are looking for help. Looking and seeing others code is a great learning experience too. But I'm just saying it was definitely easier for me when I knew what problems to solve. To me, recognizing that is what being a programmer is.
One other thing, if you are going down there in source route, code triage is an awesome tool to find projects in your wheelhouse that you'd be able to contribute to.
Also, code triage is an awesome tool.
0
u/aenigmaclamo Extreme Brewer Feb 14 '20
Personally, when I was in your shoes, I felt like I couldn't get "real world" from Java and explored other languages. Looking back, it wasn't true but arguably, I had to look elsewhere to learn that.
Part of the problem is that a lot of things don't really seem "real world" even if it's something that you'd get paid to do professionally. Really, you probably don't actually want to do the kind of work -- it's boring and it's often just as useless as a class problem unless you feel like you have a real use case for it. You'd be better off finding something you want to do and learn the tech that's required to adequately do it.
If you can't really think of anything to do, maybe the best option is for you to get a job, internships, or some sort of research work. You'd be surprised at the opportunities that your university may have for you if you just asked the right person.
-1
0
Feb 14 '20
[deleted]
-1
u/mk321 Feb 14 '20
It's hard to find open source project in Spring.
0
Feb 14 '20
[deleted]
1
u/mk321 Feb 15 '20
I don't want contribute to Spring Framework because it's too difficult for beginning.
I looking for projects (web application, backend application) that use Spring Framework.
It seems that easy to find that projects, but most of them are only hello world, examples and tutorials. I can't find just projects written in Spring.
If you have different opinion, please show me some links to repositories to that projects.
21
u/sombriks Feb 14 '20 edited Mar 07 '20
do not underestimate that _theoric_ base that you're building, of course you can go straight to the business world, but if a problem gets real tricky that base will give you the way to solve it.
That said, there is no harm in upload your code lessons on github or open pull requests for open source projects, it might help you to better understand the so-called "real world".