Live data from Hacker News

Scala Feels like EJB 2

blog.joda.org

21–30 of 119 posts

Re: Scala Feels like EJB 2

#21

Consider this method signature: def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That All this complexity to allow for automatic conversions (the following will return a Set[String]) ... BitSet(1, 2, 3).map { _.toString + "!" } In a dynamic language, the signature of map is simply this: (a → b) → [a] → [b] The big difference is that the language doesn't care about types "a" and "b" until runtime…

Not only dynamically typed languages, the signature would also look remarkably close to (a → b) → [a] → [b] in ML and Haskell. Your ML and Haskell compiler would also make check that it was called correctly at compile time without extra unit tests.

The difference is that Scala also abstracts over the "container" not just the contents.

If Scala only did what ML and Haskell do, the type signatures would be exactly that.

Re: Scala Feels like EJB 2

#22
Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good language because

- Compatible with JVM

- Strong type system

  - Linear Typing

  - Substructal Types

  - Local Type inference
- Concurrency constructs built in as actors (Akka)

- Integration of OO and functional paradigms

- Supports Higher Order Programming

- defn-site Variance based Parametric Polymorphism

- Mixin Class Composition for finer grain reuse

- Traits provide stackable behaviors (aspect-oriented style)

- Embedded Polymorphic Domain Specific Language (DSL) using dependent path types

Every language design is a trade off, but Scala is more expressive and concise than Java. Sometimes that may look to you as code which is unreadable. Other languages like clojure make some other trade offs. But Scala tries to bring some of the benefits of functional programming (in say Haskell) to Java.

Re: Scala Feels like EJB 2

#23

Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good language because - Compatible with JVM - Strong type system - Linear Typing - Substructal Types - Local Type inference - Concurrency constructs built in as actors (Akka) - Integration of OO and functional paradigms - Supports Higher Order Programming - defn-site Vari…

Is it easy for programmers of all abilities to understand and use?

Will I still understand my own code in 9 months time?

I think that their is more to being a good language than a list of features.

Re: Scala Feels like EJB 2

#24

Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good language because - Compatible with JVM - Strong type system - Linear Typing - Substructal Types - Local Type inference - Concurrency constructs built in as actors (Akka) - Integration of OO and functional paradigms - Supports Higher Order Programming - defn-site Vari…

Is it easy for programmers of all abilities to understand and use? Will I still understand my own code in 9 months time? I think that their is more to being a good language than a list of features.

Yes, yes and yes.

Re: Scala Feels like EJB 2

#25
post #5
post #4

Earlier quoted context omitted.

Steve's remarks on concurrency seem a totally fair observation to me, don't a large number of functional languages deal with concurrency through immutability and support that at the language level - I can think of Clojure, Erlang, Haskell, F# for example. The fact that it was possible to send a mutable message to a Scala actor made me extremely suspicious when I first used the language.

It's a relatively well acknowledged fact in the community that Scala's builtin actors are heavily flawed. This is why many of us switched to using Akka. It is also why there are currently plans to integrate Akka actors into the language itself, replacing the builtins. He does acknowledge that "It could become EJB3" which is a far sight better. But the tone of the rest of his post genuinely seems in conflict with this…

Interoperation with Java from Clojure is generally fairly painless. The largest exception that I can think of is if you are trying to integrate with a library/framework that is heavily object-oriented and requires class inheritance. Clojure is very opinionated on the functional programming aspect, and although it is generally possible to extend classes, it can be relatively painful.

However, if you are only using objects, calling methods, or even implementing interfaces, interoperation for Clojure is quite nice.

Re: Scala Feels like EJB 2

#26

Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good language because - Compatible with JVM - Strong type system - Linear Typing - Substructal Types - Local Type inference - Concurrency constructs built in as actors (Akka) - Integration of OO and functional paradigms - Supports Higher Order Programming - defn-site Vari…

Is it easy for programmers of all abilities to understand and use? Will I still understand my own code in 9 months time? I think that their is more to being a good language than a list of features.

>Is it easy for programmers of all abilities to understand and use?

Thats a loaded question. I don't know about you but I have met alot of People who write VBScript in excel spreadsheets that call themselfes programmers. To say the language is bad because programmers of all abailities can't understand and use it will make all languages even the simplisest ones fail that test.

You should be asking can programmers that I will be asked to work with understand it and use it, however your answer to that question I think will say more about the programmers you hire / work with then it will about scala.

Re: Scala Feels like EJB 2

#27
post #21

Earlier quoted context omitted.

Not only dynamically typed languages, the signature would also look remarkably close to (a → b) → [a] → [b] in ML and Haskell. Your ML and Haskell compiler would also make check that it was called correctly at compile time without extra unit tests.

The difference is that Scala also abstracts over the "container" not just the contents. If Scala only did what ML and Haskell do, the type signatures would be exactly that.

Can you explain the scala type signature for map? I see no container declared and it is less than obvious to me how it actually represents map across a container. I guess it is the implicit?

Re: Scala Feels like EJB 2

#28
post #21

Earlier quoted context omitted.

Not only dynamically typed languages, the signature would also look remarkably close to (a → b) → [a] → [b] in ML and Haskell. Your ML and Haskell compiler would also make check that it was called correctly at compile time without extra unit tests.

The difference is that Scala also abstracts over the "container" not just the contents. If Scala only did what ML and Haskell do, the type signatures would be exactly that.

> The difference is that Scala also abstracts over the "container" not just the contents.

Haskell is perfectly able to do that as well if desired. `[]` is a monadic type.

Re: Scala Feels like EJB 2

#29

Most of the comments here talk about how whatever useful can be done in Scala can be done in some other language. That is not the point, Scala is a good language because - Compatible with JVM - Strong type system - Linear Typing - Substructal Types - Local Type inference - Concurrency constructs built in as actors (Akka) - Integration of OO and functional paradigms - Supports Higher Order Programming - defn-site Vari…

Is it easy for programmers of all abilities to understand and use? Will I still understand my own code in 9 months time? I think that their is more to being a good language than a list of features.

The list of features were meant to just illustrate that Scala is not some programming fad, it is strictly more expressive than Java and based on solid programming language principles.

Although,I agree the code may not be easy to understand for everyone in the beginning but with effort and training I believe every programmer can learn enough of it to be more productive.

Re: Scala Feels like EJB 2

#30

Everything's unreadable until one learns to read it. This is a classic non-argument that people buy into for reasons I can't comprehend. Is Scala harder to read than other languages? Perhaps, but then just say that. As Rich Hickey pointed out recently, "I can't read German; does that mean it's unreadable?"

I disagree. While I don't know German, I can read German and even will understand some words and in some contexts even the general meaning of the sentence (i.e. restaurant menu or technical texts with large amount of English loanwords/terms).

You don't need to know Python, to understand it on the level of pseudo-code. You don't need to know Clojure to understand it on the level of S-expressions, etc.

Post reply on HN