My first main language was Java. However, over the years I've dropped Java in favor for Python, JavaScript, bash, etc. I still have advanced reading knowledge of Java, but since I haven't coded in it for so long, my writing knowledge is intermediate at most. The other day, while looking at some old code written in Java, I got inspiration to re-write it as a learning experience to reacquaint myself.

It was at that point that I stopped to think that if I wrote this in Java, it would be nice, but when the renewed inspiration had hit me, I wanted to implement it as a web app (it was a game), so other people could play it.

So now here's the dilemma: Do I re-write (and heavily refactor) the code I've previously written in Java, and then in JavaScript (for the web version), or do I just forget about Java altogether and re-write it in JavaScript?

EDIT: I have no problem writing in Java first and then JavaScript, but I'm more likely than not going to need Java anymore for a long while. What I'm trying to ask is whether or not I should rewrite the old code in Java first, to practice a skill I may not need in the future. The actual languages are less important than that question.

  • You need to decide how important it is to you to practice your Java skills. It sounds like you don't think it's of any practical importance (but keep in mind that that could change). Is your main goal to have fun? (Nothing wrong with that, of course.) Aug 10, 2012 at 17:28
  • Yeah, my main goal is currently to reignite my passion for programming :-) Which is why I ask this question. It's nothing enterprise-related, but I'm wondering if the Java refactor will be fun or tedious. Aug 10, 2012 at 17:30
  • "I'm wondering if the Java refactor will be fun or tedious." -- I don't think anyone can answer that for you. Aug 10, 2012 at 17:40
  • Oops, I worded that poorly. My mistake. I meant if it would have any practical purpose (in the long run) to refactor in Java first. Aug 10, 2012 at 17:43
  • Does no one write java applets anymore? Aug 10, 2012 at 17:55

3 Answers 3


Consider your end result - an online game, written in JavaScript.

As such, by all means, take inspiration from your old codebase and plan ahead.

The way I would approach this would be to figure out what refactoring I would do and use both the old codebase and the refactoring plan as a blueprint for a new codebase using JavaScript.

My point is that if you are going to refactor to Java, then directly port to JavaScript, you will hit problems when porting from Java to JavaScript (idioms, how the different environmentw work, assumptions not relevant to Java etc...). Ditching the intermediary step you know that the JavaScript will not be a direct port and will be already ahead in regards to issues with a direct port.

Since this is a personal project designed for your enjoyment, you should aim for that - you don't have to refactor the whole codebase. If you start and feel that it is not constructive to your goals (rekindling the fun in programming), stop and go ahead with the re-write in JavaScript, without having done a whole lot of work that you find tedious.

  • I agree and thank you. But that still doesn't address the main issue (which I may not have made clear and may need to re-phrase in the question). Since, as you say, I'm ultimately not going to use Java, should I use that transitional step to reacquaint myself with the language, just in case? Aug 10, 2012 at 17:24
  • @Chris - Well, any answer to that would be entirely subjective. Really, you are the only one that can answer it - it is up to you whether you want to reacquaint yourself with the language. There is no way to tell if it will be beneficial to yourself career-wise. A refactoring exercise can be lots of fun and can teach you something about the language.
    – Oded
    Aug 10, 2012 at 17:32
  • You're right about that. I secretly want to refactor it in Java, but I'm a bit scared that I'll be bored moving back to encapsulate(everything).withPrivateMembers. The extreme OOP abstractions scare me. Aug 10, 2012 at 17:36
  • 1
    @ChrisBlake - It is not an all or nothing proposition... You can start with refactoring. If it becomes tedious, ditch it and go ahead with the Javascript re-write.
    – Oded
    Aug 10, 2012 at 17:37
  • ...Actually, that's probably the best idea. If you add that to your answer, I'll accept it :-) Aug 10, 2012 at 17:38

Using an old language sounds all rosy; sometimes we almost have a nostalgic appreciation for languages we used earlier in our lives. Like a house we lived in when we were young. This is my analogy and answer.

The things that caused me to move out of my parents house when I was 18 aren't easily remembered. But if I moved back in, the rosy appreciation and nostalgia would wear off quickly. I would remember the shower near my room with poor pressure. The limey poorly softened well water. The inability to bring a girl over without my dad engaging them in a philosophical expose about their purpose in life.

And just as a side note... Java is to you as PHP is to me. I also moved to Python. Using a tool you don't HAVE to use causes your task to be missing a key component. I call it the "Bridge of Necessity". This bridge caries us across rivers that we lack the courage, motivation, or ambition to cross ourselves. Always approach a project with a bridge of necessity. Often I make promises to friends like "In a week I will have this cool demo to show you". This forces me to get off my ass and program the cool thing I was spouting off about or otherwise be a liar. You don't want to be a liar do you, DO YOU?


  • Thanks for this really informative answer! If you had come sooner, you might have gotten the +25 ;) Aug 10, 2012 at 21:12

Even if you don't use the "old" language directly, you will always find practical uses of it, either indirectly (ideas used originally in that language pushed in newer languages) or directly (in the case of Java you can see already how many languages are built on top of the JVM and encourage interoperability with existing Java libraries -- Scala, JRuby, Clojure, etc.). Using another JVM language means that you don't even need to rewrite your code: Just reuse it and write only the new parts in your favorite language.

Not the answer you're looking for? Browse other questions tagged or ask your own question.