Skip to content

Same Program Twice

You'll port something you wrote into a second language and notice what stays the same, because that's the actual skill.

About

The second language is faster to learn than the first, and the third is faster than that. The ideas carry over and only the spelling changes. Pick a mainstream one with a different surface, like JavaScript or Go if you started in Python, or Python if you started in JavaScript. Save the strange ones, like Haskell, Lisp and Rust, for the Unfamiliar Paradigm badge. You'll type a semicolon in the wrong language for about a week, and then it settles.

At a glance

Per requirement
25 XP
Completion bonus
150 XP
Requirements
5
Takes
One weekend
Skill level
Beginner (done it a few times)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
On your own
Locked for now
Earn two more Common badges in Coding to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Install a second language and run a hello world in it. Pick one with a different flavor, so compiled if your first was interpreted, or braces if yours used indentation. Take a screenshot of the version check and the hello output. Photo
  2. 2
    Port one of your Loop Drills programs line by line. FizzBuzz or the primes are good choices. Keep the logic identical and only change the syntax, and resist the urge to improve it. Take a screenshot of both versions side by side with matching output. Photo
  3. 3
    Port the word counter and compare how each language handles files and dictionaries. The file-reading and map code will look different in the second language. Note the parts where it made you do more work, or less. Take a screenshot of both versions with a three-line note on the differences. Photo
  4. 4
    Find three things the new language does that your first one can't, or does differently. Static types, compile errors, no exceptions, or different ideas about what counts as true all qualify. Write each one in a sentence with an example. Take a photo or a screenshot of the list. Photo
  5. 5
    Write a 50-line program in the new language without looking at the first one. Make it something new, like a small tool or a fresh drill. The test is whether you can think in the second language yet, not whether you can translate into it. Take a screenshot of the code and of it running. Photo