Moving from Python to Java :(

For last 9 months my company was developing an
enterprise application. Our main language was Python.
Its going to implement all over India by next few months.

Next month we will start our new project, Java will be our main
language. Now I started refreshing my Java. And this is one thought
came to me today, when I looked into Strings in Java.

One of Python's primary design principle is that:
"Special cases aren't special enough to break the rules."
That is, the language should avoid having privileged features
that you can't reuse for other purposes. The consequence of this
principle is, more generalisation of syntax and semantics
of a language.

In Python : (of course, there are better ways)

age = 9
print "He is " + str(age) + " years old."

In Java:

int age = 9;
String s = "He is " + age + " years old.";
System.out.println(s);

Concatenating string and integer like this is possible in Java,
because it is a "special case".

So, I should be very much bothered about Java's special cases.
Otherwise I will code something like :

String s = "four: " + 2 + 2;
System.out.println(s);

See, here I should have been written :

String s = "four: " + (2 + 2);

Brackets (()), plus (+) and quotes ("") put together in different
ways makes lots of special cases.

Now I dream that I am writing Python code as did in the last 9 months.

Popular posts from this blog

Some thoughts on Python 3 adoption

PyCon India 2014 received 143 proposals

PyCon India 2014 - Call for Proposal