Is programming a generic skill?


Came across a post by Justin Etheredge discussion whether changing between languages is just a matter of syntax.


Or, to pick a specific example, can a Java programmer quickly and easily learn to write C# code?


The answer is obviously “yes”. Development is about a way of thinking and approaching problems, and given the similarity between Java and C#, a good Java developer should take a minimal amount of time to learn how to write functional code in C#. The biggest barrier is libraries, which are more different than the languages are.


The answer is equally as obviously “no”. Sure, you can write functional code, but you will not be able to write idiomatic code. Like a high school senior with 4 years of French class on a trip to Paris, you can make yourself understood, but you aren’t going to be mistaken as a native. You ask a question, somebody replies, “Ce ne sont pas vos oignons”, and you just end thinking of soup.


So, yeah, you can write C# code, but it’s going to be Java written in C#. Given the closeness of the languages, it may be sufficient, but you’re going to force some refactoring on any idiomatic C# speakers who inherit your code.


It can be worse – when I first started writing in Perl, I wrote C code in Perl, which just doesn’t work very well. And over time, I became at least functional, though perhaps not idiomatic in Perl (though, because of TMTOWTDI, it’s hard to judge that in Perl).


However, if you can become idiomatic in multiple languages, your toolset broadens, and you become more useful in all your langauges.

Comments (7)

  1. zproxy says:

    What if you are able to express yourself and to program in one language (c#) and have a certain tool to take care of the syntax translation to other languages (java, actionscript, php, javascript) and have a certain library to take care of the base class library mappings?

    Have a look at this:

    http://jsc.sourceforge.net

  2. Bobby Cannon says:

    I agree that programming is a generic skill. Programming is a thought process about how to create solutions of for lack of a better word problems. The problem may not be a problem but a desire. Anyway back to the point. Programming is about being able to mentally grasp the issue then design and create a solution.

    A language must be selected base on the solution. Not all languages are equal nor can you just pick one up and learn the syntax and away you go. I feel that languages are like a carpenters tools but way more advanced. If languages were like hammers then yes it would be easy just pick up any hammer and swing it at your problem but it’s not that easy. You must dig deep and learn the tool of choice (C#, C++, Perl, PHP, ASP.NET).

    Even languages like ASP.NET have specific things you must know before developing a web application. For example C# ASP.NET application uses C# syntax but you may still need to understand more about Win Forms.

    Basically you must learn the tool in order to use the tool effectively. Just my thoughts…

  3. J says:

    I’ll make an analogy to learning natural languages. Learning your first language is difficult, because you’ve never done it before, and you have to learn to think about language in a totally different way. If you’ve studied German for a while, and gotten the knack for it, learning Spanish will still be difficult, but you’re a leg up on the person in your class that has never studied a language before. You are now familiar with the concept of nouns having gender, and what direct objects are, etc.

    I think the same applies to programming. When you learn your first language, you’re also learning to program: concepts of variables functions, data types, conditional logic etc. When you pick up your second (third, fourth) languages, you’ve got many of the basic concepts down, so your time to fluency is much shorter than the person just starting out.

    That being said, there are some languages in which the paradigms are so different, it is probably better to come in with no baggage of other languages. In the natural world, studying German will probably not help much in learning Chinese because the thought process is just completely different. I think the same divide exists between imperative and functional languages, because you have to approach problem solving from two very different avenues.

  4. ericgu says:

    zproxy,

    My experience with translation sorts of projects is that they don’t tend to produce very good results. Just to take an obvious example, if I’m writing code in C# I might use iterators (ie "yield return") to make my code easier to use, but the translation of that into Java is going to be problematic, because there’s a bunch of language support under the covers. You’re not going to get idiomatic Java out of it because you wouldn’t express that conceptually the same way in Java.

    J,

    I agree, especially about the divide between imperative and functional languages. I think I might make the statement about scripting vs high-level languages.

  5. Mike Martinez says:

    ~Logic~ is a generic skill.  Writing programming code in a given language is a very specific skill.  They are separate and different skills, and you need to have them both. Logic is definitely the easier to master.

  6. I don’t think it’s really about syntax but about platform. Java and C# are rather close in syntax since both derived from C++ and C# derived from J#.

    It’s more about platform, knowledge of libraries. ADO.NET has a huge set of features for example a Java Developer would have a rather steep learning curve.

  7. zproxy says:

    I have considered supporting "yield return".

    It will create a rather complex iterator type. At this time my compiler is not yet capable of converting it to another language, but it can be done. The code will look somewhat verbose tho.

    For example the implementation for Enumerable.Select without the actual use of yield return will look like this:

    http://jsc.svn.sourceforge.net/viewvc/jsc/core/ScriptCoreLib.Query/Shared/Query/Enumerable.Select.cs?view=markup

    Note, that this code can be converted to actionscript/javascript with the current version of the compiler.

    The next step would be to make the compiler support yield keyword, but it would cost resources to do that…