Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Scala] Java anti-patterns
Index -> Programming, Java -> Java Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wtd




PostPosted: Sun Feb 10, 2008 2:18 am   Post subject: [Scala] Java anti-patterns

The following is a reasonable pattern Java code falls into:

code:
class Foo {
    private int bar;
    private String baz;
    private double qux;
   
    public Foo(int bar, String baz, double qux) {
        this.bar = bar;
        this.baz = baz;
        this.qux = qux;
    }
   
    public int getBar() {
        return bar;
    }
   
    public String getBaz() {
        return baz;
    }
   
    public double getQux() {
        return qux;
    }
}


And here's the equivalent Scala:

code:
class Foo(val bar: Int, val baz: String, val qux: Double)
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: