Wiki source code of WebObjects with Scala

Version 275.1 by Ravi Mendis on 2009/09/15 20:14

Hide last authors
Ravi Mendis 21.1 1 === What is Scala? ===
Ravi Mendis 195.1 2
3 Scala is a modern language not unlike Groovy.
Ravi Mendis 209.1 4 It is said to be more powerful (and faster) than Groovy or Rails which has been the reason for its adoption at sites like Twitter.
Ravi Mendis 195.1 5
Ravi Mendis 274.1 6 |= |= Objective-C |= Scala
7 |= Mutable/Immuable Datatypes | Collections (e.g: NSArray/NSMutableArray) | //All datatypes//
8 |= Concurrency | Grand Central Dispatch (extensions) | //Built-in// |
9
Ravi Mendis 195.1 10 === Why Use Scala? ===
11
Ravi Mendis 270.1 12 In a Web 2.0, building concurrent WebObjects applications is a must.
Ravi Mendis 195.1 13 Developing and maintaining a concurrent or multi-threaded WebObjects application can be challenging.
14
Ravi Mendis 263.1 15 Scala offers concurrency built into the language.
Ravi Mendis 270.1 16 So it may offer new solutions to WO developers...
Ravi Mendis 195.1 17
Ravi Mendis 247.1 18 === Can WebObjects be Programmed With Scala? ===
Ravi Mendis 195.1 19
20 Yes. It is very simple.
21 Scala compiles to java bytecode. Hence using it with WebObjects is fairly straightforward.
22
Ravi Mendis 247.1 23 == How to Develop WebObjects With Scala ==
Ravi Mendis 195.1 24
Ravi Mendis 231.1 25 1. [[Install the Scala eclipse IDE>>http://www.scala-lang.org/node/94]]
Ravi Mendis 263.1 26 1. Add Scala support to your project
Ravi Mendis 231.1 27 11. Right-click your project in the WO Explorer
28 11. In the context menu select Scala -> Add Scala Nature
29 1. Convert or use ##.scala## instead of ##.java## source
Ravi Mendis 195.1 30
31 {{note title="Note"}}
32
Ravi Mendis 263.1 33 This is for Eclipse/WOLips developers
Ravi Mendis 195.1 34
35 {{/note}}
36
37 == WO Scala Example ==
38
Ravi Mendis 205.1 39 The following is a mixed Java/Scala version of the WO Movies D2W app.
Ravi Mendis 195.1 40 All the EO logic and WO components are in Scala.
41 Only the Application class is Java.
42
43 {{attachments patterns=".*zip"}}{{/attachments}}
44
45 === Setup ===
46
47 1. Install and run the OpenBase OBMovies database.
48 1. Right-click on Application.java and run as a WOApplication (as usual).
Ravi Mendis 272.1 49
50 ==== EO Templates ====
51
52 See: [[Scala templates>>http://wiki.objectstyle.org/confluence/display/WOL/EOGenerator+Templates+and+Additions]]