(Part 2) Top products from r/javahelp
We found 20 product mentions on r/javahelp. We ranked the 61 resulting products by number of redditors who mentioned them. Here are the products ranked 21-40. You can also go back to the previous section.
21. Java Swing, Second Edition
Sentiment score: -1
Number of reviews: 1
Used Book in Good Condition
22. Data Structures and Algorithms in Java 5/E International Student Version
Sentiment score: 1
Number of reviews: 1
23. Android Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides)
Sentiment score: 0
Number of reviews: 1
24. Programming: Principles and Practice Using C++
Sentiment score: 1
Number of reviews: 1
25. Domain-Driven Design: Tackling Complexity in the Heart of Software
Sentiment score: 1
Number of reviews: 1
26. Java Puzzlers: Traps, Pitfalls, and Corner Cases
Sentiment score: 1
Number of reviews: 1
27. Hands-on AI with Java : Smart Gaming, Robots, and More
Sentiment score: 0
Number of reviews: 1
29. Design Patterns: Elements of Reusable Object-Oriented Software
Sentiment score: 1
Number of reviews: 1
Great product!
30. The Pragmatic Programmer: From Journeyman to Master
Sentiment score: 1
Number of reviews: 1
Save up to 15% when buying these two titles together.The Pragmatic Programmer cuts through the increasing specialization and technicalities of modern software development to examine the core process--taking a requirement and producing working, maintainable code that delights its users.It covers topi...
31. Object Design: Roles, Responsibilities, and Collaborations
Sentiment score: 1
Number of reviews: 1
32. Core Java Volume I--Fundamentals (9th Edition) (Core Series)
Sentiment score: 0
Number of reviews: 1
33. Agile Software Development, Principles, Patterns, and Practices
Sentiment score: 1
Number of reviews: 1
34. Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Sentiment score: 0
Number of reviews: 1
35. Computer Science: An Interdisciplinary Approach
Sentiment score: 1
Number of reviews: 1
Really helpful book for computer science majors/ people interested in cs.
36. Java: An Introduction to Problem Solving and Programming (7th Edition)
Sentiment score: 0
Number of reviews: 1
37. Intro to Java Programming, Comprehensive Version (10th Edition)
Sentiment score: 1
Number of reviews: 1
38. The Java Language Specification, Java SE 7 Edition (Java Series)
Sentiment score: 0
Number of reviews: 1
I actually ended up helping a few people on this exact problem. Small world, eh?
The way I would have designed it would be to start at how I wanted to use the system. This may seem odd and fairly abstract, but can lead some detail as to how it can be done:
Car entrant = new Car("Ford Fusion"); // or whatever
Spot spot = carPark.park(entrant);
if (spot == null) {
System.out.println("Could not find a spot for the car!");
} else {
System.out.println("Car was parked at: " + spot);
}
This tells me I automatically need a few things.
Car
classSpot
classCarPark
classCar
and returns theSpot
that the car was parked into; if available, otherwisenull
.So what was the purpose of this exercise? Merely to show one way to approach the problem. I'd personally say that the code above is fairly clean and understandable, would be a good way to have the final implementation be written.
---
From here you have a few options. One I found to be quite nice was having a
Floor
class that contains all theSpot
s available for that floor. This kinda makes sense, as multipleFloor
s make up a singleCarPark
and will usually be very very similar.Then as for parking the car, a modified Visitor Pattern was used. Which might seem a little confusing at first. However, think of it in the real world. A car will keep visiting available floors until it either runs out of floors or finds a spot to park. Just as you would do as you are trying to find a spot to park in.
So in the end it could look like:
public class Car {
public Spot visit(Floor floor) {
// find suitable empty spot
}
}
public class Floor {
private final List<Spot> spots; // all available spots
}
public class Spot {
// type, availability, etc...
}
public class CarPark {
private final List<Floor> floors;
public Spot park(final Car vehicle) {
for (Floor floor : floors) {
Spot spot = vehicle.visit(floor);
if (spot != null) {
return spot;
}
}
return null;
}
}
Very bare-bones implementation, but a good starting block. Here, I designed it with the real world in mind.
Car
,CarPark
,Spot
, these are all tangible real-world objects. And aCarPark
is basically a bunch ofFloor
s and eachFloor
has certainSpot
s available to it.This design here should mirror the real world fairly nicely. That is the purpose of OOP. Its to you can say things like
carPark.park(car);
and understand what that does.---
Hopefully you understood the steps I took here. If anything was too confusing, not explained in enough depth or anything, feel free to ask.
As to learning this stuff, here are my recommendations in order of importance:
Hopefully this helped clarify a few issues here.
Here's pretty much your most basic flow for problem 3:
To troubleshoot, use a debugger (Eclipse's builtin is nice). If you feel it's taking too long, break the program's execution and check its state. Is the loop counter about where it should be? Are the found divisors plausible? Is the loop end target plausible? Set a breakpoint on the first line inside the loop and keep stepping through (either one line at a time if you like, or just hit 'resume' and it will break again at the top of the next loop iteration).
I learned Java throughout college, as it was the primary teaching language. Honestly, the best way to learn is just to WRITE CODE. Solve problems that you don't know how to solve. Invent random things that are useful to you. Your code doesn't have to be perfect when you're learning (and it definitely won't be!), and what is important is that you constantly look for ways to improve. I want you to look back on code you've written a year ago, and think that it's absolute crap - that will show that you are learning and improving.
Somewhat counter-intuitively, the best resources are books! I'll list some recommendations below.
Keep these principles in mind:
Once you start getting a feel for Java, which I think you might be already, Effective Java is the book. You probably won't need any other resource for Java itself.
If you need help with something, Reddit is a great place, but Stack Overflow is the programmer's mecca. The best resource on the web for just about everything software, and their sister sites cover other topics, from IT/sysadmin to gaming.
I've read both Effective Java and Clean Code and highly recommend them as well.
There's also Agile Software Development (by Robert C. Martin):
http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445/ref=sr_1_1?ie=UTF8&amp;qid=1451828712&amp;sr=8-1&amp;keywords=agile+software+development
This book contains among other things a description of the SOLID principles of software design. For example the Single Responsibility Principle tells you that each class should have only one responsibility. This reduces coupling and leads to small and more easily understandable classes. The book also contains some nice case studies showing how to apply these techniques.
While Clean Code deals with writing code and how to design methods and classes, Agile Software Development tackles the topic at a higher level and discusses how to develop and design software consisting of different classes and packages etc. It requires a basic knowledge of programming and OO, though.
Robert C. Martin has also created a series of purchasable training videos at cleancoders.com. These videos cover the topics of both books starting with the rules for clean code and then going into the SOLID principles and other advanced topics.
I just started reading Effective Java about 2 days ago and am already 1/3rd through it. Very good stuff even though I've been doing Java for a good 8 years or so. Depending on your level some of it might be over your head but you can skip a section and come back to it later. Knowing some good habits is better than knowing none! I also got the Java Puzzlers: Traps, Pitfalls, and Corner Cases book and man that's a tough book. It's very easy to read and understand but so far I haven't figured out any of the puzzles on my own although I'm only about 10 in. So far I can't imagine encountering any of these situations in the real world (or at least my office) but it's good to know and understand them because I'm sure at least one will eventually happen.
declaring a method as private/public does different things. A public method means that any class can access that method. A private method on the other hand cannot be accessed by any class except the one it's in.
You're pretty new to java and it's awesome that you're starting to build programs. Keep going! I'm a big fan of this text book: http://www.amazon.com/Java-How-Program-Edition-Deitel/dp/0132575663
It's a very easy to read and has lots of great explanations/problems
To sharpen your OOP skills, I highly recommend these two books. I would go so far as to say they changed my life:
For Java EE (don't ever say J2EE today! You'll look like you haven't been keeping up), I don't really have any book recommendations. I like the tutorial published by Oracle. I've generally found the Oracle documentation pretty good when for learning specific Java technologies.
I would also recommend this book:
You'll learn a lot about how to properly use JPA by learning Hibernate, especially the pitfalls of using an ORM and how to avoid them. JPA is probably the hardest of all of the Java EE technologies to learn, I have found.
Java is an excellent choice of language to learn if making an Android app is your eventual goal. While Kotlin is also available, your desire of wanting to learn a language in the context of physics simulation makes you a perfect audience for a highly recommended book called Computer Science: An Interdisciplinary Approach by Robert Sedgewick. This book is excellent because of the interesting problems and wide breadth of science and math topics that it touches upon while teaching the Java language.
The upside to going through this book is you will have an excellent foundation of Java and computer science, fully prepared to learn Android programming. The downside is that this will take longer than a tutorial approach, and the book costs money. Here is a sample chapter 2 in PDF format.
Please note that Robert Sedgewick has another book called Introduction to Programming in Java. The difference between this book and the Computer Science book is that the Computer Science book has the entire contents of the Intro Java book, but also has three additional chapters on computing theory, computing machines, and processor design. Since the two books cost about the same price, you might as well get the larger Computer Science book with additional content.
If you prefer video lectures or an online course, they are available for this textbook:
Video lectures
Coursera's Computer Science: Programming with a Purpose
Coursera's Computer Science: Algorithms, Theory, and Machines - This course covers the second half of the Computer Science book.
By "single-node linked list" do you mean singly-linked list? If so:
Each node in a singly linked list is just an object with an 'element' field to store stuff, and a 'next' (or 'pointer) field to store the next object in the list. If there is only one node, this node is the head and its 'next' field is set to null. If you want to add another node to the list, you just create a new node whose next field is null, and set the head's 'next' field to equal the new node. If you want to traverse the list you create a new node and set it to the head:
Node cursor = head;
then use a loop
while(cursor != null){
//do something with the element
cursor = cursor.next();
}
Once the cursor reaches the last item in the list, "cursor = cursor.next()" means that cursor is set to null and so the entry condition for the loop is no longer met and stops executing. So you are just continually setting the cursor to be the object pointed to in the 'next' field of each node until it is null.
The problem with a singly-linked list is that you can only traverse "forwards" travelling to each node's 'next' object until you reach the end. This is where a doubly-linked list comes in handy. A doubly linked list has a 'next' field and a 'previous' field. This makes it easier to delete nodes in the middle of the list as to delete one you can just set the 'next' field of the previous node to equal that of the current nodes 'next', and the 'previous' field of the next node to equal that of the previous node, then set the current node's previous and next fields to null, un-linking the node from the list. Once there are no references to an object in java, and the object makes no references to anything else, then Java's garbage collection will free up the space that object was taking up in memory, so the object is deleted.
In your example code, to see the difference between these two loops, you need to visualise in your head what is happening at each iteration, and the check that the while loop is carrying out for its condition. Since the second loop is checking the cursor's 'next' field to see if it is null, instead of checking to see if the cursor itself is null as in the first loop, this means that once the cursor is set to the last node (whose next is null) the loop will not execute again. So any actions you were carrying out on each element would not be carried out on the very last node because that node's 'next' is null, which doesn't meet the condition of the loop.
I found it helps a lot more if you can visualise what is happening with data structures, this book does a great job of explaining everything with illustrations of what is happening during traversals and deletions etc, if you can get your hands on it you should.
I really like Intro to Java Programming, Comprehensive edition. link
It has tons of exercises and it covers lots of Java 8 features and JavaFx (the modern gui library for Java).
As a separate but related thought to my earlier reply, here's a link to http://docs.oracle.com/javase/tutorial/ the Oracle Java Tutorials. These things (and the Sun version) were my holy book when I was learning Java. Unlike the more C style book you appear to be using they focus on drilling the object oriented design concepts into your brain right from the start.
I also recommend picking up http://www.amazon.com/Programming-Principles-Practice-Using-C/dp/0321543726
While it isn't Java per se, the concepts Stroustrop focuses on are relevant to programming in any language.
If you have an understanding of how object oriented programming works, The Big Nerd Ranch guide to Android Programming is a great book. Not too expensive as far as CS textbooks go. If you aren't familiar with OOP or Java, though, you should start with basic programming in Java before moving on towards Android specific learning.
http://www.amazon.com/Java-Introduction-Problem-Solving-Programming/dp/0133766268
As an aside, I find it ridiculous author's like savitch can get away with a new edition every semester it seems like. When really the only thing that changes is the Java Version and the example problems. Other than that, I have his 4th edition of this same book, and I didn't notice much difference. I DO like it as a text-book, nonetheless.
Java is a great language to start out with and I would recommend two books to get you running. Since you are new to the language and programming in general, start with Head First Java. Then, move on to a more advanced treatment like Core Java. Thinking in Java is also very good but it's dense and some people have a difficult time digesting it.
Once you have the basics of the language down, learn about working with databases. Then, move on to server-side development as that's where the jobs are.
Despite the similarity of their names, Java and JavaScript are not similar and cannot be used interchangeably. JavaScript is primarily used in UI development in web browsers, although server-side implementations have existed for almost as long as JavaScript itself. Currently, the most fashionable of these implementations is node.js.
Lastly, since you are looking to work professionally but without any formal education, know that you are going to have a difficult time getting work for the first several years. You might find that learning JavaScript (and HTML and CSS) are a quicker route to finding a job as front-end web developers often do not require a college degree, whereas Java programming jobs invariably do.
Hey, I know this is quite old but I found this [book] (https://www.amazon.com/Introduction-Programming-Structures-Comprehensive-Version/dp/0134670949/ref=pd_cp_14_1?_encoding=UTF8&amp;pd_rd_i=0134670949&amp;pd_rd_r=MHYE6B8XA6WPERN5GNHW&amp;pd_rd_w=l9SBR&amp;pd_rd_wg=23PZO&amp;psc=1&amp;refRID=MHYE6B8XA6WPERN5GNHW), if you prefer something more updated.
http://www.amazon.com/Java-Language-Specification-Edition-Series/dp/0133260224
They didn't teach me in college either. I had to learn it on my own.
http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627/ref=pd_sim_b_29?ie=UTF8&amp;refRID=1SXX13TTS9GEP9DWYG53
http://www.amazon.com/exec/obidos/ASIN/0201708426/extremeprogrammi
https://encrypted.google.com/search?q=junit+tutorial
I started out with Hands-On AI with Java, and once I got the basics down, I progressed to more general AI literature and applied that in Java.
Make a personal project. I made a game editor.
Read more books.
Java Swing:
https://www.amazon.com/Java-Swing-Second-James-Elliott/dp/0596004087
Java I/O:
https://www.amazon.com/dp/0596527500/
Java Generics and Collections:
https://www.amazon.com/Java-Generics-Collections-Development-Process/dp/0596527756/
Java Concurrency:
https://www.amazon.com/Java-Threads-Understanding-Concurrent-Programming/dp/0596007825/
Java Network Programming:
https://www.amazon.com/Network-Programming-Elliotte-Rusty-Harold/dp/1449357679/
Java Web Services:
https://www.amazon.com/dp/1449365116/
Java Database Programming:
https://www.amazon.com/dp/1565926161/
Java Performance:
https://www.amazon.com/dp/1449358454/
Intro to Design Patterns w/ Java:
https://www.amazon.com/Head-First-Design-Patterns-Brain-Friendly-ebook/dp/B00AA36RZY/
Design Patterns (not Java and very dry, but much more in depth):
https://en.wikipedia.org/wiki/Design_Patterns
If you read every O'Reilly book on Java and do two or three big projects (or ten small ones) with what you learn in each book, you will learn how to do anything with Java. Java can do anything any other language can, but it takes longer to get there. Once you get there - once you build it - it will run forever, provided it's built well.
Online resources.
http://www.tutorialspoint.com/swing/
https://www.javatpoint.com/java-swing
The javax.swing class:
https://docs.oracle.com/javase/7/docs/api/javax/swing/package-summary.html
The Java API specification:
https://docs.oracle.com/javase/7/docs/api/
Never took one of these, defer to someone else's advice:
https://www.udemy.com/java-swing-complete/
It takes a while to figure out how to effectively use google. Look up my posting history to see how to format posts. You may need to make a test class to simplify things or provide a simple (and obviously safe) thing that people can execute and debug, if they decide to help you.
You will spend a lot of time on the Java API spec, so make sure that you know how to read a method header and signature. You'll get used to it after a few weeks.
*
General advice.**
Debugging is the single most important thing you do. If you can't see what's going wrong, you won't fix it except via trial and error (which is frustrating and takes forever). Any time something goes wrong, either walk through it with a debugger or get print statements working. Getting print statements working is often a job in itself.
I spend more time debugging than I do programming, because when things are going right it's a breeze but when they aren't it takes ages.
Take up some other hobby that keeps you active.
When you're frustrated and nothing is working, do something else. Go for a walk, garden for a bit, cook something. Make sure you have a notepad or note-taking program on your phone so you can stop and take notes when the solution comes to you.
If nothing else is working, just screw around with things and make print statements to see what they do. That's how I learned everything.
Try to break everything.
Don't be afraid of embarassing yourself.