Wiki source code of WebObjects with Scala
Version 272.1 by Ravi Mendis on 2009/09/15 20:03
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | === What is Scala? === | ||
2 | |||
3 | Scala is a modern language not unlike Groovy. | ||
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. | ||
5 | |||
6 | === Why Use Scala? === | ||
7 | |||
8 | In a Web 2.0, building concurrent WebObjects applications is a must. | ||
9 | Developing and maintaining a concurrent or multi-threaded WebObjects application can be challenging. | ||
10 | |||
11 | Scala offers concurrency built into the language. | ||
12 | So it may offer new solutions to WO developers... | ||
13 | |||
14 | === Can WebObjects be Programmed With Scala? === | ||
15 | |||
16 | Yes. It is very simple. | ||
17 | Scala compiles to java bytecode. Hence using it with WebObjects is fairly straightforward. | ||
18 | |||
19 | == How to Develop WebObjects With Scala == | ||
20 | |||
21 | 1. [[Install the Scala eclipse IDE>>http://www.scala-lang.org/node/94]] | ||
22 | 1. Add Scala support to your project | ||
23 | 11. Right-click your project in the WO Explorer | ||
24 | 11. In the context menu select Scala -> Add Scala Nature | ||
25 | 1. Convert or use ##.scala## instead of ##.java## source | ||
26 | |||
27 | {{note title="Note"}} | ||
28 | |||
29 | This is for Eclipse/WOLips developers | ||
30 | |||
31 | {{/note}} | ||
32 | |||
33 | == WO Scala Example == | ||
34 | |||
35 | The following is a mixed Java/Scala version of the WO Movies D2W app. | ||
36 | All the EO logic and WO components are in Scala. | ||
37 | Only the Application class is Java. | ||
38 | |||
39 | {{attachments patterns=".*zip"}}{{/attachments}} | ||
40 | |||
41 | === Setup === | ||
42 | |||
43 | 1. Install and run the OpenBase OBMovies database. | ||
44 | 1. Right-click on Application.java and run as a WOApplication (as usual). | ||
45 | |||
46 | ==== EO Templates ==== | ||
47 | |||
48 | See: [[Scala templates>>http://wiki.objectstyle.org/confluence/display/WOL/EOGenerator+Templates+and+Additions]] |