• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is a stash of solutions in a developer's toolkit a naive approach?  RSS feed

 
Mark Richardson
Ranch Hand
Posts: 108
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like to solve Java puzzles and I have created a fairly organized package structure which I have uploaded to GitHub. My idea is that when I become a real developer one day, I will be able to access my vast personal collection which is nicely commented, in order to solve real-world problems. Is this a naive approach? Do any real developers do this type of thing? Is this a bad idea? good idea?

For example, I will have a package devoted to manipulating collections. Another package which shows me 3 different ways to print out the Fibonacci sequence. Another package which deals with File Operations, and so on. Then another package with examples where I use regular expressions. I know I can't account for every scenario I will face in the workplace, but at least I will have some type of quick "to-go."
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's a good idea to record what you've learned about various Java features, so that one day when you need to do something specific with collections or files, you can lookup your own snippets to remind you of how to do what you need to do. You might not use your own snippets literally, but it can help you remind of how things work.

I'd recommend against writing your own collections utilities libraries or copy-&-pasting your own utility classes into your real projects, because for almost anything you'll want to do in Java there is already an open source library available. For collections, for example, there's Apache Commons Collections and other very useful libraries are Apache Commons Lang and Google Guava. Advantages of using these libraries versus your own utility classes are that these libraries are widely used and have been thoroughly tested, and that other developers are likely to be familiar with them.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, don't try writing your own date/time classes. It is not worth reinventing the wheel if there are good date/time utilities already available (see the Java™ Tutorials). But it is worth recording other things you have done.
I think one utility class it is worth writing is to handle Scanners for keyboard input. Consider making a thread‑safe version, remembering that Scanner isn't thread‑safe.

Why don't you think you are a real developer? Just because nobody is paying you to do it? Whenever people do start paying you, they are likely to have policies about which utility classes you use, and they will differ from workplace to workplace.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!