I'm a writer, programmer, web developer, and entrepreneur. Preona is my current startup that began its life as the team developing Twitulater. Our goal is to create a set of applications for the emerging Synaptic Web, which would rank real-time information streams in near real time, all along reading its user behaviour and understanding how to intelligently react to it. Swizec is a DZone MVB and is not an employee of DZone and has posted 65 posts at DZone. You can read more from them at their website. View Full User Profile

My Language is Better than Yours

03.30.2012
| 10124 views |
  • submit to reddit

My language brings all the geeks to the yard,
And they’re like “It’s better than yours”
Damn right, it’s better than yours,
I can teach you, but I have to charge


Programming languages
– the second favorite thing for geeks to fight about (right after code editors and IDE‘s).

Everybody knows Java sucks, that PHP is a script kiddie’s tool and that Lisp is the most magnificent thing ever to crawl out of the primordial ooze of academic language research.

Ask somebody else and suddenly everyone knows JavaScript is the best thing since sliced bread and Java is only used by weird people of the Indian persuasion … and Google. For some reason.

Does all of this really matter?

At the end of the day most languages are turing complete, which means you can use any language to do anything. Write your next killer app in brainfuck for all I care. You should do it in malbolge actually, that will make the whole geek community green with envy.

But you know what, your app doesn’t win based on the technology you use, users don’t care! What matters is solving an actual problem.

There’s still no excuse for any modern language to exist without type inference though …

Uncovering the Unknown: Principles of Type Inference – an awesome talk explaining exactly why there is no excuse for making people type int and char in 2012.

I’m looking at you Java.

John McCarthy, an American computer scientist.

John McCarthy, an American computer scientist. (Photo credit: Wikipedia)

 

Published at DZone with permission of Swizec Teller, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Robert Saulnier replied on Fri, 2012/03/30 - 12:00pm

We spend more time reading code than writing it. So how would you read this?

public void doSomething(var obj) { 

    var owners = obj.getOwners();

    // Do something with owners 

} 

 Is owners a Collection, List, Set, Iterator, array, something else?

 Is there an Owner class or are owners represented as User objects, or something else?

Sure the compiler can infer the variable types, but programmers are not compilers.

Dusan Nedeljkovic replied on Fri, 2012/03/30 - 1:05pm

I completly agree with author of this article - there's no real need for us to declare INT, STRING, etc.

I love Java, I love C#, but in PHP - I am so fast that it's simply ridicilous how flexibile it's allowing me to be, and how fast and simple you can solve even the most complicated problems, and never have a glitch.

Good article. Thumbs up for the author.

 

Aravind Yarram replied on Fri, 2012/03/30 - 1:23pm

I agree with 

Robert Saulnier. 

 Most of our time is spent understanding and maintaining the existing code. So strongly typed languages are always the best bet for building business apps. 

Jose Smith replied on Fri, 2012/03/30 - 1:43pm

Agree 100% with Robert.  Maybe I'm simply not smart enough to understand the value of type inference - I'm just you're average Java joe programmer after all.  I disagree with most of that linked video.  How is the ease of implementing type inference in a programming language correlated to its usefulness to developers?  Typing String name = "Daniel" is not any more difficult for me than typing var name = "Daniel".  What DOES slow me down when developing is when my IDE's code completion is either non-existant or just plain bad.  And of course, as Robert said when I have to read and maintain the code for the duration of the project.  It's even worse a team of developers uses uses type inference in an inconsistent matter all throughout the code base:

def doSomething(x) {
 def owners = x.getOwners();
}

def doSomething(x) {
 List<Owner> owners = x.getOwners();
}  
 
def doSomething(Person x) {
 def owners = x.getOwners(); 
}

def doSomething(Person x) {
 List<Owner> owners = x.getOwners(); 
}  

List<Owner> doSomething(x);
List<Owner> doSomething(Person x);
.
.

 ... you get the idea 

 

Mark Unknown replied on Fri, 2012/03/30 - 2:17pm in response to: Jose Smith

+1 to Robert and Jose. Minus a bunch to the author. I just reviewed someones code (C#) last week and he used var a lot. It made the code so difficult to read. Of course, poorly named variables did not help. 

Robin Small replied on Fri, 2012/03/30 - 5:11pm

Good article. In response to some of the comments - there is no need to go all the way to not specifying types on anything. I've found the nicest medium is enforce them on type signatures, and make them optional for other variable (yes, Scala). You specifying them if you need them, but leave them off if they are already obvious. IDE's such as IntelliJ have a popup you what the type is with just a keyboard shortcut.

Jonathan Fisher replied on Fri, 2012/03/30 - 6:31pm

Strong types make it easier for "the other guy" to read your code. I remember seeing a study on Python somewhere where it showed something like 90% of variables were used in a static way, anyway. I'm kicking myself because I can't find it... 

Christopher Umbel replied on Fri, 2012/03/30 - 8:20pm

it's true that users don't care about the language you write your app in.

but! 

if a language causes your app to perform poorly users care. if a language causes you to deliver features more slowly than your competition they may care. if a language causes you to have a hard time hiring programmers your product and therefore users may suffer.

then again, if a language offends your sensibilities negatively affecting your motivation then users, especially if they're paying hourly for custom work, can suffer.

the point is that the choice of language can certainly matter and some are simply "bad" or at least bad in certain situations.

"The Tao of Programming" by Geoffrey James has taught us: 

The Tao gave birth to machine language. Machine language gave birth to the assembler.

The assembler gave birth to the compiler. Now there are ten thousand languages.

Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.

But do not program in COBOL if you can avoid it. 

 

William Shenfield replied on Sun, 2012/04/01 - 7:20am in response to: Christopher Umbel

 Language diversify within companies and projects creates hell, but competition between languages is good (survival of the fittest).

Leaning and becoming skilled delivering business applications with a modern language takes years, it's not just about the syntax it's the ecosystem which encompasses the frameworks, libraries collections, PDF's, XML, Word or Excel Documents not forgetting tools Maven, Ivy, Ant, Make etc.... And lets not forget persistence RDF/ SPARQL, Relational/SQL, Interprocess communications etc... the list goes on.

As a business owner and a supplier in the financial services sector - having to support all this diversity is a nightmare. Those applications based on dead languages with hundreds of man years invested in them like RPG, Fortran, Cobol, Flash, VB, Pascal or the dead platforms like .NET, Silverlight AHHHHH. Although the savings in terms cost and improved delivery would more than pay for themselves, trying to get the teams to move on when they have 20-30 years of their lives invested in these dead technologies is painful - once achieved the benefits are amazing.

The hardest is to keep an eye on where industry is going, having a strategy that adapts and keeps up, but in the process it must remove diversity and keep in check all those programmers who say I use the best language for the Job.

Those programmers that use the best language for the job may get the initial application delivered quickly, but they are putting the future of the business into crisis – one,two,three years on we no longer have that Perl, Lisp, Lua, Ruby, Python, F#, Nemerle, Forth... The Dev has left, the skills are lost we're in a mess, a re-write is in processes and the regulators are threatening to close the business all because of something trivial like they want our data via a triplestore instead of in PDF's or our compitors Web pages can be viewed on a mobile device but ours can't because it requires IE.6.

In summary keep up with the latest languages and developments use them on your personal projects, but don't force them on businesses until it's clear they will have a mainstream future. For now in the professional world stick with C(# or ++)/Java at the back-end and JavaScript/HTML5 at front (may be drop that # Windows is dying where is it on modern devices PADS, Phones, Routers, TV's etc...). They may be horrid languages but we will stack up less problems for the future by limiting diversity. 

Stuart Slaugh replied on Sun, 2012/04/01 - 2:33pm in response to: Aravind Yarram

I'm a contract web developer & I couldn't imagine using anything but PHP! It performs superbly(Facebook is written entirely in PHP as are many other big data-driven Web Apps) & lacks nothing. This idea that only strongly typed languages are maintainable is absurd; simply use descriptive variable names, e.g. '$title_string', comment them when declared e.g. '$number_of_rows //int'. Too many programmers, no matter what language they use, write obscure, unreadable code.

Jack Jackson replied on Sun, 2012/04/01 - 3:08pm in response to: Stuart Slaugh

 I'm a contract web developer & I couldn't imagine using anything but PHP! It performs superbly(Facebook is written entirely in PHP as are many other big data-driven Web Apps) & lacks nothing. This idea that only strongly typed languages are maintainable is absurd...

Typical PHP programmer. Doesn't even know the difference between a "strongly" typed and "statically" typed language. Then claims that variable names are the same as static analysis. How can we take such opinions seriously. PHP is the BASIC of today.. it is the worst designed language around and has the worst designed libraries. Any impartial observer can see that. The fact that people make it work for large projects is a testament to their heroism.. but not a testament to the validity of the platform. In the old days people wrote huge apps using assembler.. that doesn't mean assembler is the best programming language.

Learn a few languages other than PHP and then come back and we'll talk. In the meantime get off my lawn. 

Robert Saulnier replied on Mon, 2012/04/02 - 9:45am in response to: Stuart Slaugh

I'm not sure if your post is an April Fool's joke, but I'll respond anyway.

Facebook is not written entirely in PHP. If you don't believe me, google it.

Putting the type in the variable name is even more verbose than statically typed code.

By putting the type of a variable in a comment,  you're basically doing the same thing that a statically typed language forces us to do.

One thing to note about PHP is that the scope of the variables are mostly local to the page you're working on (unless you're including lots of other pages or using some framework).

Also, if static typing was useless, why did they add Type Hinting in PHP? http://www.php.net/manual/en/language.oop5.typehinting.php 

 

Tim Boudreau replied on Sat, 2012/04/07 - 5:48am

The first time you write, oh, say, security code that does a boolean test, and you find that it always passes because you're testing the string "false" instead of false, and the string false evaluates to true, you will know why you want types.  Been there and done exactly that in server-side javascript.  

Yaron Levy replied on Sun, 2012/06/10 - 10:13am

This type of argument is only true if there's no difference between the productivity of programmers working in different languages.

I'm currently using Perl, but wish I was using Clojure. I'm pretty sure I can do things in Perl much faster than I could do them in Java, and far faster than I could do them in brainfuck and assembly.

Language choice matters. Its not the most important thing in the world, but it is important. You can't provide the best tools available to your users if you write it in brainfuck. The competition will eat you alive if you try.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.