1
$\begingroup$

As in computer science field we have to learn several programming languages like C++, Java, C#, python, php etc to complete our tasks and home assignments. However you are good in only one language. As I know all languages are related to each other at some extent, but it's difficult for me to remember syntax for all languages and doing different tasks for these to become familiar to these.

How can I improve and learn other languages easily so that I can perform my assignments easily and in less time? If anyone can guide me. Thanks in advance

$\endgroup$
3
  • $\begingroup$ Assuming that the professor is making reasonable choices about what languages to use for different assignments, the languages will be chosen specifically to highlight important differences in approach. This means that you are being given tasks that are intrinsically more difficult to "translate" between languages. $\endgroup$
    – Ben I.
    Apr 30, 2019 at 15:19
  • $\begingroup$ I have fixed some of the grammar in the question, but do not know the meaning of “you are good in only one language”. $\endgroup$ Apr 30, 2019 at 21:54
  • 1
    $\begingroup$ Unfortunately your teachers obsession with teaching many languages is miss-guided. It is better to learn one language well. (plus may be some side Domain Specific Languages e.g. regex, html, css, bash, awk, …). C++ is to complex for a novice. You should know at least 3 languages well, before starting C++. $\endgroup$ Apr 30, 2019 at 21:57

4 Answers 4

2
$\begingroup$

Once you learn how to program with a given paradigm, learning other languages in that same paradigm should be fairly straightforward. One of the best ways is to write a large program in the new language.

But if other tools than those you are used to are more commonly used with the new language use those tools as well.

But there are some subtitles. For example, Java and Python are quite close conceptually. But the differences require that you "think different" about some things. For example, dynamic vs static typing is a really big difference between the two languages even though they are both OO languages at base. In Java you write (I hope) a lot of interfaces. In Python it would be odd to do so, even if actually possible (with different syntax).

On the other hand, if you need to learn a language in a different paradigm, say a functional language rather than those you have in your list, then it might be good to go back to a "know nothing" stage and start with a good book intended for beginners in that language. This is because the thought process in, say Scheme, is quite different from that in Java. For example, it is a bit of a subtle thing to write a linear time process to reverse a list in Scheme if you are thinking like a Java programmer. But the way that you do that task efficiently is a mind expander.

So, for a "similar" language, build something big with appropriate tools and watch for the tricky bits. For a "different" language, start over. Here "similar" means the same overall paradigm.

$\endgroup$
3
$\begingroup$

Looking at Buffy's answer it's clear to me that I've understood the question quite differently, so I will set some context before I get to the point.

However you are good in only one language.

I think that this is too strong: it's possible to be good in several languages if you use them all frequently. However, I do know the feeling. The main language used in my undergrad course was Java, and that was virtually the only language I used in the 7.5 years after graduating. But for the past 9 years the primary language in most of the projects I've worked on has been C#. Now when I revisit Java I keep typing string and getting compile-time errors until I correct it to String.

On the other hand, the key word there is primary. One project was written in C# but used a code generation tool whose templates were in some weird Visual BASIC variant for which I never found documentation, and in addition had large and complex SQL stored procedures. Real world projects often contain an unholy mess of different languages, chosen for good or bad reasons, and the ability to handle that is a useful skill to develop.


As I know all languages are related to each other at some extent, but it's difficult for me to remember syntax for all languages

Supplement your memory. Write revision notes as though you were preparing for an exam on the differences between the language: one side of paper (A4 or letter) where you list the most important mappings from your strongest language to the target language. E.g. if your strongest language is Java then your notes for C# might include:

  • import is using
  • Method names begin with upper case
  • Map is IDictionary and HashMap is Dictionary
  • Generic types are reified, so if you have a static field Foo in a class Bar<T> then Bar<string>.Foo is a different field to Bar<int>.Foo.

Also, use IDEs where possible. It's much quicker to fix compile-time errors as soon as you type them than to wait until you've finished a unit and can attempt to compile. Auto-completion for syntax is also getting quite advanced now.

$\endgroup$
2
$\begingroup$

I teach classes that each use different languages: Python, C#, Visual Basic, Thunkable, Scratch, Alice, Small Basic and a few other odds and ends. I am not good in any of them off hand, but I have a set of resource locations that will refresh my memory or show me the important features of the languages. I learn how to learn languages. I get the language syntax confused all the time switching back and forth like I do so I have to have samples handy as to how a particular task is done in a particular language. I still mess up regularly but the kids all think I am a nut case anyway so not big deal. They live with it.

$\endgroup$
3
  • $\begingroup$ Hmmm, so is this "how not to do it_"? Language isn't just syntax. Just as spoken language is more than grammar. $\endgroup$
    – Buffy
    Aug 19, 2019 at 19:57
  • $\begingroup$ Once you understand the fundamentals of programming languages the differences at the beginning level is just syntax. Once a kid can program in something as simple as Scratch (although some pretty complicated programs have been don in Scratch) learning a new language starts with the new syntax. When I am doing Python, Java and Small Basic it is often "Opps, wrong For loop syntax". Language is not just syntax, but often the differences between languages is syntax. $\endgroup$ Aug 20, 2019 at 18:20
  • 1
    $\begingroup$ Sorry, but you are demonstrating ignorance here. A good python program should not look like a VB program. It requires a different mindset. Do you think that the difference between, say, Scheme and Scratch is just syntax? $\endgroup$
    – Buffy
    Aug 20, 2019 at 18:43
1
$\begingroup$

An effective way to learn another programming language is learning compared to the known language.   Ideally I think one language should be learned for each important paradigm: C / C ++ for imperative / objective paradigms, lisp / Haskel for functional paradigm and SQL for declarative paradigm - the rest of the languages being a combination of these paradigms. As for the syntax there is "Intellisence" or equivalent.

$\endgroup$
1
  • $\begingroup$ Actually, though, the question was about how. You seem to be saying: Just. Do. It. Not necessarily a bad approach, of course. $\endgroup$
    – Buffy
    Aug 19, 2019 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.