1. Solve functional problems
- At the most basic level, Scala has fully fledged closures with
collections support. This means you no longer have to write boiler
plate code such as (shamelessly ripped off a DZone post)
public List<Item> bought(User user) { List<Item> result = new ArrayList(); for (Item item : currentItems) { if (user.bought(item)) { result.add(item); } } return result; }
def bought(user: User) = items.filter(user bought _)
- There's more functional love, but I'm not qualified to talk about it since I currently still suck at functional programming :)
- Scala has an actors model (+ some other goodness) which is inheritly safer than Java's mutable data + locks on Thread model (no matter how good the libs are getting, Java is still hindered by the language).
0 comments: on "Why Use Scala over Java"
Post a Comment