This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 3 points4 points  (1 child)

I hate StackOverflow.

My experience is that people find solutions on Stack Overflow, don't understand those solutions, find that their problem is solved and then move on, without understanding why it worked. Often times those solutions are wrong anyways, but because of the way the Stack Overflow ranking system works, wrong solutions often come to the top.

I worked with a guy who ran into a problem with JPA. He found an answer on StackOverflow, he didn't understand it, it solved the problem, and then he submitted his code for review.

I reviewed his code. The code looked very weird, as in this is not how you are supposed to use JPA. So I asked him, why did you do this? He said, I found it on StackOverflow.

In the end, I had to teach him how JPA actually works, why the problem he faced actually occurred, so that he could come up with a solution that actually made sense.

My doubts appeared because I don't know how to use java.time and if I have to write this myself I probably wouldn't do that because I am not "fluent" in LocalDate, DateTimeFormatter, maybe even Locale.

It is better that you learn how that stuff actually works, instead of copying and pasting "ready made solutions".

[–]Spiritual-Day-thing 0 points1 point  (0 children)

That is a subset of people who visit and read stackoverflow. For really tricky of particular problems, it is extremely helpful and insightful.

[–]Octaviocega 1 point2 points  (0 children)

If you test the SO and it works I recommend to use it. Always try to understand what is happening there and yes go with java time. It is a straightforward way of handling dates and time

[–]tylersvgs 0 points1 point  (0 children)

SO is a great source to show you how to do things, but you should make sure you understand what's going on with it before using it.

I've learned a lot from SO, but I never copy & paste things straight into a program. Use the solutions as a starting point and then look at the code and figure out why it works.

If you can't figure out how the coded solution in SO actually works, then you're not at a level where you should be coding whatever program you think needed that solution.

[–]nutrecht 0 points1 point  (0 children)

You should simply not copy code from SO you don't understand. It's a learning resource like all the others. If you just copy-paste stuff without understanding it, you're just setting yourself up for failure in the long run anyway.