Live data from Hacker News

Scala Feels like EJB 2

blog.joda.org

71–80 of 119 posts

Re: Scala Feels like EJB 2

#71
post #6

Scala's great, if you have a gorgeous Haskell program and you want to port it to the JVM. Unfortunately, by itself, that may be a niche market. If you want a dynamic language, you have lots of great choices. If you want powerful syntactic abstractions, you have Clojure, Lisp or Racket. You can win big with any of these tools. But some problems benefit from powerful mathematical abstractions, and that's where Haskell…

I get and have built Probability monads often enough. They seem really cool since keeping normalization around is theoretically nice, but they seem broken in "real" applications.

Everything I do with probability ends up looking mathematically dissimilar to probability. Most algorithms go far out of their way to avoid on-the-fly normalization because it's so expensive. An EM update monad is just the State monad.

I love Haskell (never used Scala) but I find the very things you're marketing it with abhorrent to use.

Re: Scala Feels like EJB 2

#72
Where I worked, we switched from Java to Scala a few months ago, and we're all loving it. I really don't understand Stephen Colebourne's criticisms. Well, actually, sure I understand every one of his criticisms, but I could make equally damning or more damning criticisms of just about every programming language. No programming language is perfect. On the other hand, we find Scala to be much more expressive than Java. In Scala, I can write code in a natural way, rather than the way that Java wants to force me to write it. The result is cleaner, more elegant code, that is significantly shorter with much less boilerplate and code repetition, and easier to understand.

Sure the type system is complicated, but I don't really have to understand all its nuances in order to get my program to compile and work. When you use Scala, after a short while you just develop an intuition for it.

The comparison to EJB 2 is a bit nutty, if you ask me, since writing code in Scala tends to be the antithesis of all the terrible Java monster enterprise library crap. The libraries that people use in Scala tend to be much simpler and more straight-forward.

I do agree that there's a contingent of the Scala community who seem to want to rub their fluency with category theory in your face. This is hardly representative of the entire community, however, and I'm sure they must exist in the communities for almost every functional programming language these days. The solution for this is for people to come up with more intuitive explanations for the powerful tools that category-theory inspired abstractions provide. I know that this can be done, and it will be done, when functional programming become mainstream enough that it attracts better writers.

(I, myself, have been thinking of writing up a little essay called "The Mapcat is the state monad of Massachusetts" to try to explain monads in a better way than comparing them to space suits, or whatever. Okay, okay... mapcat isn't a state monad, but I think the title's funny anyway.)

Re: Scala Feels like EJB 2

#73
Scala is awesome, when combined with AKKA it's even better. We're much more efficient then we ever were in Java. Also, ops doesn't know it's not java since they can use all the same jvm tools.

val myList = "Jim" :: "Bob" :: Nil myList(println)

what's hard about that?

Re: Scala Feels like EJB 2

#74
The article seems very fear driven, many of his arguments simply do not gel with my experience.

We have been using Scala for 4 months now and have the first cut of our product released:

The Scala community have been great - we have had insightful answers on the Lift, Akka, Dispatch and Scala users list and on stack exchange.

We have used parallel collections and Akka actors to get good scalability without the usual pain. We do have some mutable data structures where it makes sense - we appreciate the flexibility to do that. The distinction between mutable and immutable data structures is pretty easy to read in the code.

Our code base is very concise, and i think readable for the breath of functionality we have implemented. We have not used type level programming, simple Scala constructs like pattern matching, collections and closures make a huge difference. You can write obtuse code in Scala - we choose not to.

In short we see Scala as a competitive advantage going forward.

Re: Scala Feels like EJB 2

#75
post #54

Earlier quoted context omitted.

How about acting less aggressive? It certainly dosen't help you to get your point across. > Here's some Ruby code for you You just tried very hard to not understand the problem at hand, right? Because the equivalent Scala code looks like this: Array(1,2,3).map(_*2).map(_.toString).toSet > I can implement all of the above by my own Sure, if you OK with your code running magnitudes slower than the built-in stuff. That'…

The issue discussed here is the implementation and signature of "map", a trivial function that anybody should be able to understand and implement without a sweat. Sure, if you OK with your code running magnitudes slower than the built-in stuff ... scripting languages force you to use the built-in stuff These 2 sentences don't compile. You should also realize that the speed of the JVM has nothing to do with the static…

Seeing that you still don't grok the basics discussed here, this is probably my last answer to you.

You still fail to understand that the `map` (and other methods) are far more flexible in Scala, making them play well with sub-typing and inheritance (and in fact with stuff like `String` and arrays which don't implement any collection methods at all).

With your examlpe above, what result collection type would you get when you map with `Int -> String` over a `BitSet` or with `Char -> Int` over a `String`?

> You should also realize that the speed of the JVM has nothing to do with the static-ness of the language.

You have obviously never seen the mess JRuby and Clojure employ to run on the JVM.

Re: Scala Feels like EJB 2

#76
post #62

Earlier quoted context omitted.

Ok, so can I express that this method returns a collection of a single type and that collection always contains 10 items?

Yes, you can do that by using types indexed by a number. See https://apocalisp.wordpress.com/2010/06/16/type-level-progra... for one take on this.

Scala, with its “type-level programming”, crazy operator overloads and weird DSLs, is at a similar precipice as C++ was back when people started doing insane stuff with template metaprogramming (around the time of Alexandrescu's “Modern C++ Design”, 2001 maybe?).

Unfortunately, I don't think many Scala users were around at that time or in that community, so lessons of the past might be learned the hard way again.

There are many encouraging signs too, though, toward better and simpler practices. We'll see which way things go.

Re: Scala Feels like EJB 2

#78

Earlier quoted context omitted.

This could be caused by any of these widely known cognitive biases: - http://en.wikipedia.org/wiki/Commitment_bias - http://en.wikipedia.org/wiki/Endowment_effect - http://en.wikipedia.org/wiki/Sunk_costs - http://en.wikipedia.org/wiki/Herd_behavior [edit: also, you're inferring the experience of people from the complaints that they make. that means that you are automatically dismissing anyone who makes certain kinds…

> .... widely known .. Yeah right. Might I suggest you read more about - https://en.wikipedia.org/wiki/Cherry_picking_(fallacy) - https://en.wikipedia.org/wiki/Wikipedia:Neutral_point_of_vie... Rather pointing out that humanity is flawed. Why don't you try to practice living by virtue and show others the right way ? It's more honorable than finger pointing from a high horse.

what do you want me to do? i was less aggressive than you are. i gave links to references. i posted from my own account rather than hiding behind a new one. herd behaviour and sunk costs are good explanations for the kind of response i was replying to - everyone knows that technology creates "fan boys". so what, exactly, are you criticising in what i said?

i don't understand your anger, apart from the fact that you don't like to be wrong.

Re: Scala Feels like EJB 2

#79
It's unfortunate that there a number of very smart people from the Haskell community that are trying to mold Scala in Haskell's image that also appear to be very prominent and active in the community. Other than having some negative effect on Scala's public image, however, there's nothing wrong with what they are doing. People work on open source projects that interest them, and it is an interesting exercise for some to find out how different Haskell constructs can be encoded in Scala.

However, the rest of us lesser mortals use Scala very differently, and we far outnumber these people. If you pay attention to Martin Odersky, the creator of the language, you'll notice that he is more interested in serving our needs than those of the Haskellites. He's outright refused to make IO monads a core part of the language, for instance, even though they have pushed for it. He's also said that scalaz is on another planet entirely, and he's asked publicly that people stop using symbolic method names in their libraries unless they have external meaning beyond the library. This guy gets it. He really has created a language that is powerful, but also practical, an excellent language for writing code that is readable, maintainable, efficient, and concise.

The author of this article admits that Scala doesn't feel right to him. He then proceeds to try to justify that feeling in his mind with some very weak arguments. For instance, his module argument oh so coincidentally happens to play into fantom's strengths alone, as No other JVM language is trying to tackle this problem right now. He is right about the lack of tests and binary incompatibility, but these are known issues that already have been addressed to some extent and are continuing to be addressed. They are not core issues with the language itself.

Scala is lightyears ahead of Fantom and Fantom will probably never catch up. If Fantom can't win on technical merit, then apparently the next best strategy involves negative blogging!

Re: Scala Feels like EJB 2

#80
post #79

It's unfortunate that there a number of very smart people from the Haskell community that are trying to mold Scala in Haskell's image that also appear to be very prominent and active in the community. Other than having some negative effect on Scala's public image, however, there's nothing wrong with what they are doing. People work on open source projects that interest them, and it is an interesting exercise for some…

After struggling through using sbt and Maven/Ivy I can say it is categorically worse than what I have used in other languages including ruby-gem python-pip clojure-leiningen (a jvm language) and node-npm. When I say worse I mean doing what the majority of developers want from a module system: easily install modules, not provide a complicated mess of configuration and versions.

This isn't to say scala couldn't adopt a better system, but I don't think the community has an incentive because scala's main appeal is that it has a steep learning curve, but after you get over the hump you can do everything you want and more. I just think that high barrier to entry, as indicated by the post, may not be worth the benefits.

Post reply on HN