Thursday, August 26, 2010

Scala is for VB programmers

Normally I don't go for flame bait titles. But I haven't finished my morning coffee yet so I can't help myself. There's once again a debate raging across the internet about whether Scala is more or less complex than Java, along with the more nuanced argument that yes, it is more complex but only framework and library developers have to contend with this complexity. This argument usually happens when someone posts a little bit of code like this:

def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That

And then someone responds like this:

Why do not people realize that Java is too difficult for the average programmer? That is the true purpose of Scala, to escape the complexity of Java code! Framework code in Scala, with heavy use of implicit keywords and all kinds of type abstractions, is very difficult. This is correct, but this code is not meant for innocent eyes. You do not use that sort of code when you write an application.

I've seen this type of thinking before. A few years ago I had a bout of insanity and lead an ASP.NET project using ASP.NET 2.0. I had no .NET experience prior to this project. The project failed, although the reasons for that failure are legion and unimportant here. But I noticed something about ASP.NET developers: they have no clue how the technology works. It's a black box. Do you why? Because it is a black box. I searched and searched and couldn't even find a good illustration of the lifecycle for an ASP.NET page that's using events. This type of information is put front and center in the Java world. It's absolutely buried in the Microsoft world. Or at least the parts of it that target the hoards of VB programmers that are undyingly loyal to MS. The framework is magic dust created by the great wizards in Redmond so that you can build solutions for your customers. Do not question the dust. Think about VB. Or, no don't, it might damage your brain. My coffee hasn't quite kicked in, so I should have some immunity, so I'll do it for you. VB is a black box (well, at old school VB6). It was designed to allow people who do not know how to really program, and who will probably never know how to program, to create applications. It's completely flat, opaque abstraction. The dichotomy between the application developer and the framework developer is as high and as thick as the gates of Mordor.

There are many people in the Scala community that claim Scala's complexity can be hidden from the application program. I don't believe them, but there's a chance that they are right. It's technically feasible, and I can see how it could happen if Scala started attracting lots of VB programmers. I can't see how it's going to attract lots of VB programmers, but apparently many people in the Scala community think Scala is for VB programmers. So we'll just have to wait and see...

Sphere: Related Content

44 comments:

Monis Iqbal said...

very good points Erik

frosto said...

Great post! I agree Scala can be complex, but I'll still whish I could forget Java and start using Scala for everything. Scala does what Java does in a lot simpler way, it only turns complex when you start doing things that are (way) beyond what's possible in Java.

Anonymous said...

I don't get the distinction between framework and application at all. If I write application code, I introduce abstractions, classes, etc, there is no inherent difference between what I do and what a framework would do.

On top of that, I find that you'll typically have to understand your framework to become really proficient in it.

So, I agree, complexity is a problem. And for some of Scala's features, I'm not sure if the added complexity is a net benefit.

Unknown said...

Scala is the fancy man's Java. It's not about ease of use, or black-box simplicity, or even feature set, it's about programming novelty, language experimentation, and having more cool points than boring old Java.

Adrian said...

I wonder if you're burying the lead.

I am developing in Scala and keep trying to fill it the gaps in my knowledge but the type system and syntax are not easy! Add in the fact that in just trying to explain the features, books and blogs often have to introduce terms like 'monads', 'elidable', and 'intravariance' which, while not impossible to understand, do demand much more from programmers than C# or Java. Many people will react by ignoring these sections and living with holes in their knowledge.

Can developers use scala without knowing this? Maybe. Probably. But now you've got developers who don't understand their chosen language because of the added complexity, and that's before you've introduced framworks like Lift (or ASP.NET).

If people use frameworks like ASP.NET and have incomplete knowledge which you think is a problem, imagine how much worse it gets when they don't properly understand the framework AND the programming language!

art.the.nerd said...

> I searched and searched and couldn't even find a good illustration of the lifecycle for an ASP.NET page that's using events. This type of information is put front and center in the Java world. It's absolutely buried in the Microsoft world.

What are you talking about? A Google search for "lifecycle for an ASP.NET page" yields 579,000 hits. The very first one is from msdn (microsoft). Is your problem that it uses text instead of a diagram? Here is a diagram.

MCAndre said...

*Do you why?* should be *Do you know why?*

I completely agree. FOSS all the way.

Erik Engbrecht said...

@art.the.nerd
That diagram is a *perfect* illustration of my problem. All I could find was stuff like that. It describes a webpage lifecycle without mentioning HTTP a single time! It's useless junk if you have any concern with understanding what's going on.

@Todd - I suggest you read my recent post on the market for technical workers being a market for lemons. It should make my opinion of people who are attracted to tech because it pays well pretty clear.

Paul Keeble said...

One of the guiding principles of the Java language was to make things easier. Its Type system was simplified, the API Objectified and GC added. It was a simpler cleaner language and definitely a huge step forward for portability.

Many languages don't manage to be as readable as Java. The one thing you can say about (well 1.4 anyway) Java was that most developers could read it without ever having learned the language. That is a huge win verses many other languages.

However the market has grown and moved on, with many professional programmers looking for more succinct and cleverer code to deal with some of the horrid boiler plate that the Java approach creates.

Scala has made many things a lot better with improvements in readability and consistency. The introduction of some of the features however means programmers need to learn new paradigms and that is what makes the line above impenetrable to those who don't know the language. Of course public static void main(String[] args) is not exactly easy to read as a statement either, that is until you know the conventions.

Time will tell if the above ever becomes readable by most people or whether its just too different. But programmers have always needed to spend a large amount of time learning a language before the more advanced features are easy to understand.

Anonymous said...

There's not nothing. This is the ASP.NET application life-cycle:

http://msdn.microsoft.com/en-us/library/ms178472.aspx

It's a little hairy to understand but basically covers the gamut of what an ASP.NET developer needs to know about when things happen. If you really want to get into the IIS life-cycle in a little more detail there is also plenty of documentation on that.

I think there was a Joel on Software post way back when about Lord Palmerston on Programming which surmised that we are seldom in a position to comment on other coding worlds simply because we don't immerse in them. I'm sorry you didn't get that immersion from your ASP.NET project, but from the perspective of a regular user it is a powerful and well documented framework both at the API and details level.

Anonymous said...

You lost me at "I searched and searched and couldn't even find a good illustration of the lifecycle for an ASP.NET page that's using events."

Erik Engbrecht said...

@Anonymous
The page you link to is worse than useless. It's incredibly deceptive. HTTP is a stateless request/reply protocol, not stateful event-based protocol. ASP.NET attempts to provide a stateful, event-based programming model similar to VB. Abstraction is fine, but often times it leaks. When it leaks, it's very, very useful to know how the abstraction is working or supposed to work so you can plug the leak.

But the documentation you link to makes no mention of how ASP.NET abstracts away the stateless, request/reply nature of HTTP. It pretends it isn't there. It's not the ASP.NET event lifecycle that's scary, and it's not the HTTP request/reply cycle that's scary. It's the fact that the relationship between them is hidden that's scary.

Is this wasn't a problem, MS wouldn't have created ASP.NET MVC.

This all proves my point about culture. To you it's not important to understand the underlying technology. You only need to understand the abstraction layer directly in front of you. Microsoft's documentation is structured in a way to strongly encourage that attitude. It's part of the culture, and I can't argue with the commercial success of that culture.

But it's not part of the Scala culture, and I don't think it's part of the Java culture, either. So while opaque, black-box abstractions may be embraced in the MS world, I highly doubt they will be embraced in the Scala world. That means Scala programmers will have to confront the complexity of the language. If you can't tell, I don't think that's a bad thing. The language is complex, but it is also extraordinarily powerful and has extremely strong conceptual integrity. The complexity will scare a few people off, and result in a lot of noise in the blogosphere, but ultimately it is there for a reason and the reasons are good.

Anonymous said...

Scala is great for now for banks or institutions that need fairly fast code, in the places where they aren't writing it in assembly because it has to be incredibly fast. For the rest of us, it is going to be overlooked except for academia which is so lost in the clouds all the time, they'll love it. But the "next" big thing (even though it's been here already for a good while) is Ruby (specifically JRuby, because Ruby on JVM is awesome, fast, and lets you still use Java fairly easily). As a long time Java developer, I thought Scala at first was the deal. But, I can say for sure that while Ruby is not without its hiccups and poorly experienced developers thinking they are the business, saying Java is crap, and getting acclaim for their work that is only great because the language lets them write average code and look great, it is only a matter of time before the rest of the smart guys writing Java give up on it and switch over, making many more killer projects.

Anonymous said...

It's not for VB programmers that use Option Declare ;-)

Anonymous said...

You know, Odersky himself thought that function signature was too complex (see top rated comment):

That's why soon after his post there they put the "use case" into scaladoc, so the docs have this in addition to the full version:

def map [B] (f: (A) ⇒ B) : List[B]

Anonymous said...

"But the "next" big thing (even though it's been here already for a good while) is Ruby (specifically JRuby, because Ruby on JVM is awesome, fast, and lets you still use Java fairly easily). "

It will be JRuby + Mirah...

JRuby + Rails for webapps

And I wish Mirah + QtJambi + Excelsior JET AOT compiler[yeah right, too expensive] for the desktop

Randy Bigbie said...

"Is this wasn't a problem, MS wouldn't have created ASP.NET MVC."

Wow...now I really know that you don't know what you are talking about. ASP.NET MVC is not a fix for ASP.NET Web Forms. They are two completely separate options for an ASP.NET developer.

Erik, relax, just because it doesn't serve your purpose doesn't mean it needs to be fixed.

I agree with the Anonymous who said: You lost me at "I searched and searched and couldn't even find a good illustration of the lifecycle for an ASP.NET page that's using events."

Some people don't need to know how the pipes were made in order to use the pipes correctly. Stop being so arogant. Such as good people don't have to know how the world was formed in order to be good people.

Anonymous said...

the real reason your ASP project failed was that a lot of "programmers" really haven't got a clue - in whatever language you choose - Java, c#, VB, Cobol, etc,etc,etc.

If they can't program they should be shown the door.

I have two programmers working on my project who a) can't code well b) don't test c) blame the frameowkr d) blame other people

Mario Fusco said...

Make me a favor: drink your coffee before to write posts like this next time. You evidently didn't understand neither the sense of the article you linked (that by the way is mine) nor which are the pros of Scala compared with Java.

Maybe this article by Martin Odersky can explain better the way which is the point:

http://lamp.epfl.ch/~odersky/blogs/isscalacomplex.html

Thomas said...

I'm working with ASP.NET WebForms since 2006. I think you are right. My points about ASP.NET WebForms are:
1. It tries to hide the web-technologies from the programmer and give him a statful programming experience like in windows
2. This doesn't work. It was quite painful to realize that you can't create a web-application without understanding how html, http, css etc. work
3. Lifecycle documentation is available but it is far too abstract to be useful
4. Control about generated html, css and javascript is very limited

Anonymous said...

Nice post, despite the acute caffeine deficiency!

Nahum Kovalski said...

When I started programming (in Fortran), my brother would take my handwritten code, punch card type it and then bring me back the output from the mainframe. I loved Fortran and wrote projects in it because it was straightforward and did the job. 35 years later, I manage a (thankfully very successful) custom designed electronic health record system that uses ACCESS, asp, asp.net and VB as various frontends to MySQL databases. Many an expert said to me "this is not a serious development environment". But it works, is fast, is EASY to update and modify. And the hundreds of employees in our company truly are happy. The ultimate judge of the value of ANY development environment is the USER. When the user gets their systems fast, and they are reliable and cost-reasonable, and easily modfiable to answer the world's ever changing needs, THEN you have a successful development environment. An ASP page that I can write and document clearly, that is made up of 50 lines of code BUT answers the user's needs within a day, IS great !

C G said...

Now that you've failed at programming even one application in ASP.Net, I do agree that it's quite easy to slam programmers who us MS technology.

Reading your comments on VB programmers I won't be surprised if you haven't written a line of VB code in your life either.

Well, since you didn't have your morning coffee before you wrote this, I will give you the benefit of doubt and not call you an absolute ass like Todd said you are, though I would be inclined to agree with Todd if you had, had your morning coffee.

Joey said...

I hereby assert that the average C++ or Java programmer is just as dumb as the average vb or c# programmer. Out there is an enormous amount of real bad and shitty C++, Java, vb, C# (and all other Languages as well) Code which gets copy an pasted every day without a single thought why and how it works. To pretend one framework or language is better then the other is just narrow-sighted.

Jan Kotek said...

I can not agree. For Joe programmer everything will be blackbox . In Java it may be Spring IOC or Hibernate. A lot of Java programmers does not even know about Garbage Collector.

And it is not fair to compare Scala to VB6. Biggest difference is that Scala is opensource, it's internals are documented and you CAN open blackbox.

But on other hand you are right. Scala is damm good at creating DSLs.

Adam Smith said...

Great article, I think you expressed quite clearly a lot of the things I think is wrong with the MS Development world.

@Nahum Kovalski
I don't think Erik is saying that you can't run your business that way or that it wouldn't work. I know loads of developers who would prefer your approach. We are all different.

But there are many developers including myself who don't like that way of working. I remember using Visual C++ with MFC years ago. Loads of autogenerated code you didn't really understand, but you weren't supposed to. Just follow the receipt. Then there was VB in MS Access which was a nightmare. They localized the programming language, so if-statement while-loops etc were in my native language. It bombed completely when we tried to merge code written in MS Access version for the US. The list goes on. It seems like it is so easy to get something up and running in the MS toolchain but as soon as you need to do something out of the ordinary it is a total pain in the butt.

MS gives you receipt. People in the MS world seem to code by following receipts while others like me and Erik I guess prefer to learn how to "cook".

Petke said...

Lets not go too far on this and say that magic back boxing is the microsoft way. Microsoft is not only about the VB folks, but also for C++ folks. C++ is the opposite of compiler magic. Any programmer "could" reimplement the framework that is STL if they wanted to. I had the miss fortune of working in J2MEE a while back. And I hated the magic black box that was the virtual machine. You could not even get two different mobiles from the same manufacturer to work the same. If you ask me Java for mobiles is madness. Not saying ASP.NET is better but at least it is one plattform.

Erik Engbrecht said...

@mario
This post is largely tongue-in-cheek. The primary claim is intentionally absurd. You shouldn't read too much into the post beyond the fact that I disapprove of black boxes and a strong application developer versus framework developer dichotomy.

@Jan
I think that's the way the world works, but I think it creates a lot of unnecessary problems. It's a tough question because no one can understanding everything. I think I need to write a more serious post on that...

Sean said...

Erik,

Your argument on VB (6) and .net is essentially one of "I don't understand this so it must not be understandable."

What an arrogant attitude. Maybe you just aren't as smart as you think you are.

Some of us have delivered major projects that drastically improved the way some of the world's biggest businesses work using VB6. Some of us took the time to learn how powerful it truly was when you dug in a bit and made a lot of money (and continue to do so) using the environments you failed to understand.

But I guess that's why we code and you blog :)

djlucas said...

You're right, we should build all the hardware from scratch and code everything in Assembler. And code the firmware, too. Can't have any piece that we don't understand.

Unknown said...

Erik - why do you insist on using ASP.Net (one framework for building web based solutions) as a bases for making comparisons to Scala (a programming language). They are seperate concepts. I am a developer in the .NET world, and I do not care for the level of abstraction built into the ASP.Net framework either. But to take your experience with the ASP.Net framework and apply that broadly to the .NET framework in general is not fair in my opinion. If you don't like ASP.Net (I am right there with you on that point) then find, or better yet, build a better framework for creating web applications. There are other options out there for building web based solutions. This post would have been much more credible to me if you had not made the mistake of trying to make generalizations about ASP.Net and use those as a basis for a comparison to Scala.

Anonymous said...

I would not call VB6 a black box. It is pretty obvious and straight forward how it works.

If you have used some event-based GUI framework like Qt or wxWidgets or have used languages like Delphi, you will find them pretty similar to how VB works.

Anonymous said...

lol I'm not a .Net lover, but after I read this I'm wondering if it's April 1st

1) Trying to lead an ASP .Net project with no prior .Net experience?

2) Looking at Page Life Cycle documentation to find out how ASP.NET abstracts away the stateless, request/reply nature of HTTP? - A novice may think that this is the place to look, but it's not.

Anonymous said...

1) Don't believe yourself superior. Only because it is ASP.NET do you think you could learned it overnight?
2) There is a tool for every job, and .NET is an impressive well supplied toolbox. It can be a blackbox for a newbie so it can make it work or it can be as complex as you may needed it.
3) get a life, do you think we care if you know how Java or Scala works? if you can...good for you...and move on

Unknown said...

Funny comments, I guess most of them missed the joke. Sometimes I wonder also if with Scala will encourage the division of programmers into two castes: the wizards, working with higher kinded abstractions and creating powerful libraries with simplified APIS consumed by the caste of workers that just encode the business in a simplified domain specific language a-la VB...
Well, that's not the point ... I forgot what's the point... anyway, I really like Scala

Joaquim Rendeiro said...

So, HTTP is stateless and you don't understand the black magic of maintaining state in ASP.NET... Let me introduce to you the concept of "Viewstate". TADA!

It might be <strike>prone to misuse by people who try to use ASP.NET like a web version of WinForms apps (which by the way is kinda what Microsoft intended, so Joe the "programmer" is not actually at fault)</strike> slightly evil, but it's one of the basic things in traditional ASP.NET.

Unknown said...

You are an arrogant and ill-informed religionist when it comes to Microsoft. Just admit it.

VB isn't a black box unless you need it to be. I have written components and software in C/C++/C# and Java for 25 years. Except for the Java, much of that functionality was readily accessible from VB/VB.NET, and any other COM-aware application or language.

I have also solved complex problems with components and code written in VB. Complexity in language tools is over-rated and vain.
Simplicity is elegant, not obtusiveness.

Keep writing new languages. I guess it keeps you in some kind of elite group...

Anonymous said...

Hey Erik, ever hear of Reflector? Any self respecting .Net programmer knows about this tool that lets you see every piece of code from the .Net base class library.

rsenna said...

Since I'm MS developer, I would diplomatically say that as TODAY (and not as of 15 year ago, which seems to be the poster's view of MS developers) there is enough open standards and a complete, non-black-box, understanding of many facts, like the aforementioned sessionless nature of the web.

We do have not only ASP.NET MVC, but also many opensource projects, like the old Castle Project (which already had a great implementation of a web MVC framework), Umbraco, Ninject, NHibernate and the whole ALT.NET scene.

I do agree that ASP.NET WebForms is a kind of a black box though. But considering that I truly hate that framework, I do not have any objectivity to judge it too. :)

Paul Beckford said...

Hi Erik,

I saw the post as tongue-in-cheek. I've worked on both Java and .NET platforms and I share your sentiments.

It never hurts to look under the hood. The abundance of open source frameworks in Java compared to .NET is a clear sign that the two cultures are very different.

The lesson to take away is drink your coffee before posting, because the truth often offends :)

Having said that, there is perhaps a young .NET programmer out there that may be prompted by your post to look further a field.

If you prompt just one person to go master his craft rather then being a lemming, then taking all this abuse will be worth it :)

(Interestingly there is an ALT.NET crowd who use to spend their time trying to ape Java frameworks on .NET, hence ASP.NET MVC. And nowadays its all about Ruby envy, so the MS world is changing)

Last point. Haskell programmers and Smalltalk programmers could make similar observations about the Java crowd. Scala is a completely different beast. I haven't taken the time to master it, but from what I've seen it is to be respected. For me though if I'm going to learn an extremely expressive and conceptually pure language that covers both functional and OO programming paradigms in depth, why be constrained by the JVM? I might as well cut loose and go all the way:

http://newspeaklanguage.org/

Nice post.

Paul.

Cialis kaufen said...

Thanks for sharing that interesting article. Learned about a lot of new facts.

Outsourcing Programmers said...

Scala is more or less complex than Java, along with the more nuanced argument that yes, it is more complex but only framework and library developers have to contend with this complexity.

Anonymous said...

Scala's for smart people. That's cool with me, cause I'm smart!

Roberta said...

Here, I do not actually consider this will have success.