Fog Creek Software
Discussion Board

Mixing languages...


Just curious if anyone else has had the same experience. For the last couple months I've been working with C/C++ and Java. They're not interacting, just working on multiple projects concurrently. I usually don't spend more than a day or two in one particular language.

At first I thought my head would explode trying to keep track of the nuances, but to my surprise I'm finding that my understanding of each language is going through the roof. My take on this is that my brain is able to separate the syntax from the underlying principles much more easily now.

The only analogy that comes to mind is that of getting stereo vision by adding another eye.

Any thoughts? Similar experiences?

Tuesday, July 13, 2004

The semantic differences might have forced you to think more about the subtle issues underlying programming languages, which naturally would make you more productive at using whichever language you use.  Implementing different programming languages will do this for you too.

Tuesday, July 13, 2004

There are several good reasons for knowing multiple languages. You should learn some that are more different than C, C++ and Java, too. Yes, this will mean that you understand all of them better.

Gareth McCaughan
Tuesday, July 13, 2004

Web dev often means swapping between client side and server side. Client side is most often JScript. When I was using ASP VBScript, this got really confusing.  You normally start typing something, and realize half way through; you are using the wrong syntax. Now that I am using C# on the server side, it is much better. :-)

Gary van der Merwe
Tuesday, July 13, 2004

One of the things we do to understand something better is compare and contrast.  If I want to learn about triangles and squares, I can study triangles and squares in isolation and learn quite a bit.  I can also see how they differ from and how they are similar to each other.  By examining the similarities and differences I get a better understanding of both.

By using C/C++ and Java simultaneously, you are doing a lot of compare/contrast thinking.  That's not your primary intent, but it's what you're doing: you start writing Java after being in C++ for a day and you are constantly reminding yourself of the little differences.  "Oh yeah, no destructor."  "Right, no virtual keyword."  You're learning about Java by comparing/contrasting with C++.  And vice versa.  Sure, you already knew each language.  But in isolation (primarily).  Now you're getting a real in-depth feel for how they compare.

Should be working
Tuesday, July 13, 2004

I work in 3 fairly different environments everyday: C++, VisualBasic, and PHP.  And they really couldn't be more different.

The biggest thing I notice is the huge difference is coding style.  I once received some VisualBasic code written by a C++ coder -- and it was immediately obvious that this person was as C++ coder.  One example is that all the arrays were zero-based.  In VB it's common that arrays are one-based -- the code was "correct" but from a VB-coder perspective it was "wrong".

It's the little things...

Almost Anonymous
Tuesday, July 13, 2004

AA -

The phenomenon you've just described is at the heart of every pointless C++ vs Java debate.

muppet from
Tuesday, July 13, 2004

I am a native English speaker living in Germany and travelling about once a fortnight. I mixed my languages everyday.

"Scusi. Ich möchte ein chocolate icecream."

Nobody understands me. I usually resort to pointing and monkey-like antics. Like Steve Ballmer

Herr Herr
Tuesday, July 13, 2004

I've noticed that lately.  Work hacking is in C++, home hacking is in Ruby. 

I'm starting to really grasp Phil Greenspun's law that every sufficently complex C application contains an ad-hoc implementation of Common Lisp.  Ruby is an amazingly expressive language that ends up feeling a little like a functional programming language with objects (has functors, GC, and a lot of metaobject hooks).

I've learned a lot of lessons over the years by switching languages.  The notion of a programmer who only knows one or two languages really bugs me.  I do know that when I switched from Pascal/Modula-2 to C++, a lot of notions of optimal syntax for languages dropped out of my field of thought when I realized that Pascal may have been cleaner in some respects, forcing people to type out "begin" and "end" instead of { and } wasn't actually helping any.

It's cross training for your head, really.

Oh, and one pointer.  Never try to mix C++ and Java in the same executable.  It is only the road to pain.

Flamebait Sr.
Tuesday, July 13, 2004

Back when I was doing web dev w/ ASP VBScript and DHTML, I found it pretty easy to keep them separate in my head, but I also found I learned a lot more about both than I had ever known about either one individually.  This was because there were some things that were possible on the client, and some on the server, and some you had to hack out between the two.  So the two platforms were constantly pushing each other farther.

In regards to spoken languages, I find I can only keep one in my head at a time.  There are good days and bad days of course (good days, I can switch back and forth on the fly, bad days, I'm stuck in one or the other).  But in general, if I'm trying to write an email in German, I can't IM in English at the same time without screwing one or the other of them up.

Tuesday, July 13, 2004

I'll put in my usual plug for TCL or SmallTalk here.

It's really an eye-opener to see what you can do (and how things are done) with a language that has a very simple syntax.

I'd add "every programmer should know LISP", but then you'd think I was one of those no-common-sense Academics :-)


Mark Bessey
Tuesday, July 13, 2004

Ya ne znau. No sabe muchos linguos. Pourquoi demandez-vous?
Wednesday, July 14, 2004

Years and years I spent trying to get to grips with C/C++, but I just couldn't get it.  The theory was all fine, but when it came to actually writing code, I just couldn't seem to push any out.

The I started using a mixture of PureBasic and ASM, the combination of Basic and machine code being my computer 'mother tounge' from my Spectrum days.

With the syntax veil finally lifted from processor, I could finally get to grips with the whole thing.  I converted some non-trivial C++ code into Purebasic, and voila, it all fell into place very quickly.

Ged Byrne
Wednesday, July 14, 2004

*  Recent Topics

*  Fog Creek Home