6 Replies - 3202 Views - Last Post: 04 August 2012 - 09:48 PM

#1 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1372
  • View blog
  • Posts: 3,470
  • Joined: 28-November 09

Clone Language

Posted 04 August 2012 - 11:29 AM

I've been doing this for quite some time now, but it seems to have been getting some interest lately. I practice a technique I call clone languages, the concept is that you program as you would in your primary language, and force yourself to rewrite it in a clone language on your own time.

Some wonder why in the world I would do that. My answer? It keeps me on my toes, prevents forming a bias, and lets me think in multiple paradigms.

Any thoughts on this technique?

Is This A Good Question/Topic? 2
  • +

Replies To: Clone Language

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9286
  • View blog
  • Posts: 34,808
  • Joined: 12-June 08

Re: Clone Language

Posted 04 August 2012 - 11:38 AM

Can you give an example?
Was This Post Helpful? 0
  • +
  • -

#3 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1372
  • View blog
  • Posts: 3,470
  • Joined: 28-November 09

Re: Clone Language

Posted 04 August 2012 - 11:50 AM

I write a framework in Ruby at $WORK, and I do the same thing in Python at ~.

It forces me not to be a Rubyist elitist or the same in Python or whatever language I use. It forces me to think in other paradigms than what I'm used to or comfortable with.

Haskell is about to become my 2nd clone language when I get a bit more background in it.

This post has been edited by Lemur: 04 August 2012 - 11:52 AM

Was This Post Helpful? 1
  • +
  • -

#4 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3589
  • View blog
  • Posts: 11,165
  • Joined: 05-May 12

Re: Clone Language

Posted 04 August 2012 - 12:17 PM

Lemur has a point. Particular languages have a "flavor" or a "Correct Way" of doing things. One could do a direct transliteration from on language to another, but the code just doesn't look right in the destination language. One has to adapt the logic to match the style of the language.

The one that I always spot is when somebody goes from Java to C#. They keep on doing someString.Equals("someValue") and chains of if-else-if doings string comparisons, whereas in C#, on would do someString == "someValue" and use switch() statements. (Yes, I know that Java now has switch statements for strings, but I think most of the tutorials or books that people learn/cut&paste haven't been updated.)

I know that when I used to post refactorings for Ruby code on refactormycode.com, I always prefaced it with "I just dabble in Ruby" to avoid the angry mob at my door with torches and pitchforks because "that is not the Ruby way of doing things".

Another example is the perl-isms where you do the imperative command first, and the tack on the condition afterwards on the same line. The C-style if followed by the statement to be executed will work, but "it just doesn't look right" in the eyes of a somebody who lives and breathes perl everyday.

Or imagine a BASIC program just being translated straight into C with goto's and all. Although it will still work and it's one procedural language to another, I'm quite sure several of us would be going "WTF? What's with all these goto's?"

This post has been edited by Skydiver: 04 August 2012 - 12:17 PM

Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5848
  • View blog
  • Posts: 12,707
  • Joined: 16-October 07

Re: Clone Language

Posted 04 August 2012 - 04:58 PM

Yep, I do that. Both for sport and serious. Any time I want to learn a new language, I'll implement tic-tac-toe. Then, maybe a card game.

I had a company wide budgeting program that went through many incarnations. It started out life in VB5 or VB4. In moved to Oracle Forms. Then Java Servlets. Then ASP. Then ASP.NET, two incarnations. The latest was a group effort. That version has been cooking for a few years.

Moving around Java, C, C++, Python, teaches you things. They are all very different ways of thinking. It's liberating when the methods adopted in one language seem become cumbersome and you go somewhere else.
Was This Post Helpful? 0
  • +
  • -

#6 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7807
  • View blog
  • Posts: 13,201
  • Joined: 19-March 11

Re: Clone Language

Posted 04 August 2012 - 05:10 PM

Yes, I do this whenever I can. It's a win three ways: you learn something new about the source language, and about the target language, and about the original problem.

Quote

Any time I want to learn a new language, I'll implement tic-tac-toe. Then, maybe a card game.


For me, it's Hamurabi. I don't know why, it's just become a bit of a ritual.
Was This Post Helpful? 0
  • +
  • -

#7 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1372
  • View blog
  • Posts: 3,470
  • Joined: 28-November 09

Re: Clone Language

Posted 04 August 2012 - 09:48 PM

For me it's always been reinventing the wheel, just because I can and because it tends to be the most challenge. If it's already done, you don't have the luxury of setting the standard, you have to break the curve and make something better.

If not that, normally a nice little chat program for encrypted sessions that goes through SSH and uses key pairs or other forms of encryption. I try and see how many bases I can cover on the list of major fields in technology.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1