Whats the best way to learn your second language?

so after learning c, i now want to get into object oriented programming, since im gonna take java next semester i want to use my summer vacation to get at least a small headstart, problem is every course and tutorial ive found assumes java is my fist language, so it covers really basic stufff like what a data type is, what each of the logic operators means, etc.
this is fine but ive found it to be extremely boring, so the question is, once you know all this stuff whats the fastest way to relearn it in another language?

Posted Jul 13, 2018, 9:15 PM UTC · edited

36
[deleted]•

Re-write an old project with the language you're trying to learn. A few languages (Go, Rust, C# come to mind) now have a quick overview you can do in few hours to get a grasp on syntax and special things.

8
BluDavidOP•

thanks, thats a very good idea, ill just rewrite some of the code ive written in c.

2
carcigenicate•

I'd say, read the simple stuff over again. It will help bridge your knowledge. You may know the concepts, but if it's a good guide, it will show the syntax of Java and idiomatic style. It never hurts to brush up on the basics anyways.

And I agree with the other answer of redoing projects. Everytime I learn a new language, I do the same three projects (in this order generally) :

  • The obligatory naïve prime number finder
  • Conway's Game of Life
  • A Tamagotchi clone

Since I already know these projects inside and out, I can focus on how the language works instead of spending time figuring out algorithms (unless I'm learning a new paradigm). And, since I've done these projects in every language, I've found it really helps bridge my thinking into the new language. I know how I did it in my previous language, so it connects the dots to the new language.

3
BluDavidOP•

Thanks for the advice, i just did game of life a few weeks ago in c, i think i'll start with that

1
ufo_catcher•

Skip the topics you already know

0
insertAlias•

I disagree; skim them to see if they're implemented in a novel or different way.

For example, if I had skipped the section on control flow when I was looking at Kotlin, I never would have seen that you can assign the result of an if statement:

val x = if ( a >= b ) {
    a / b
} else {
    b / a
}

Once you see that it's what you're already used to, then skip it, but at least take a look to see if something is different.

2