Einträge für November 2005

myndian.de

Samstag, 26. November 2005

Scala makes things "just work"

This is our response to Anonymous generic methods making things “just work” using Scala instead of C#. Others had coded solutions in Java or Groovy.

Here’s our code in Scala. Have a look, how simple things can be:

object FindPersonsDemo with Application
{
  case class Person(firstName: String, 
                    lastName: String,
                    age: Int);

  val persons = List(
      Person(“Cathi”, “Gero”, 35),
      Person(“Ted”, “Neward”, 35),
      Person(“Stephanie”, “Gero”, 12),
      Person(“Michael”, “Neward”, 12));
 
  val newards = for (val p <- persons;
                     p.lastName == “Neward”) yield p;
   
  Console.println(newards);
}

The solution in groovy is also very short and nice to read. I was impressed. We had a look at Groovy for some time, because it seems to be a very cool scripting language, with Java roots which makes it very interesting. So we tried to start using it for tests. We tried. With little success. After asking some questions in the user mailing list we got an solution, which did not satisfy us.

Many groovy examples I have read were confusing. There are so much tricks and things you have to know to understand them. A nice example is the map creation syntax, which starts a great discussion in the mailing list. It seems to be very nice:
def map = [name:“Wallace”, likes:“cheese”]
But you can only use Strings as identifier. I had not seen this until some one points this out on the mailing list. This is very ugly, I think.

Let’s get back to the example. I think Scala is much faster and in contrast to a scripting language and it is type save. Yes, it’s really type save, even if you don’t see some type informations in this short piece of code.

I think we will have a look at Groovy again in the future, but Scala seems to be the language of choice at the moment. (beside the standard languages like Java, C#, ...) There’s nother Nice one, but it does not seem to be stable enough for use in real projects.

The first real post in our new blog, by the way. :-)
Geschrieben von Jörg in Softwaretechnik um 20:48 | Kommentar (1) | Trackbacks (0)
Tags für diesen Artikel: c#, groovy, java, nice, scala
Artikel mit ähnlichen Themen:
  • Toying around ... with Scala
  • Grails tutorials and a free e-book
  • Runnig Grails
  • Premature optimization and object orientation
  • POJOs, POGOs und POCOs
  • View technologys for generated web layers
  • More about Groovy SQL Maps
  • Make your SQL Maps Groovy!
  • Groovy again
  • last language war language trolling
(Seite 1 von 1, insgesamt 1 Einträge)

Suche

Inhalt

Startseite
Galerien
Impressum

Kategorien

  • XML Alltag
  • XML Internet
  • XML Musik
  • XML Politik
  • XML Softwaretechnik
  • XML Sonstiges
  • XML Visuelles

Alle Kategorien

Archive

Juli 2010
Juni 2010
Mai 2010
Das Neueste ...
Älteres ...

Blog abonnieren

XML RSS 2.0 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Kommentare

Login

Verwaltung des Blogs

Login

Aktuelle Einträge

Netzwerkkultur verändert die Gesellschaft
Dienstag, 17. November

Absolute and relative date and time
Sonntag, 18. Oktober

Oren Lavie - Her Morning Elegance
Dienstag, 6. Oktober

Twitter & Blogroll
Samstag, 8. August

Read It Later: Round-Trip-Integration mit Firefox und Google-Reader
Montag, 3. August

Blogroll

* Jörg bei Twitter
* Jens bei Twitter
* Nils bei Twitter

* Beetlebum
* a life less ordinary?
* Martin Fowler's Bliki
* Springify
* BILDblog
* Plazeboalarm
* LawBlog
* ADOM Blog
* Being busy
* Dr. Gero Presser

Links

* Heise
* The Scala Programming Language
Nils' Fotos bei fotocommunity.de
Jogi auf Qype
Get Firefox!
Use OpenOffice.org

Heise News

* Alcatel-Lucent bleibt in den roten Zahlen

* IBM kauft Kompressionsspezialisten

* Speicherhersteller erwarten Preissteigerung

* Britischer Datenschützer findet in Googles WLAN-Datensammlung keine persönliche Daten

* Österreich wegen verpasster Einführung der Vorratsdatenspeicherung verurteilt

kostenloser Counter