Ceylon Readability for the Modern Java Developer.
-
Upload
kathleen-harrison -
Category
Documents
-
view
225 -
download
3
Transcript of Ceylon Readability for the Modern Java Developer.
![Page 1: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/1.jpg)
CeylonReadability for the Modern Java Developer
![Page 2: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/2.jpg)
History• Red Hat’s, Gavin King
• Readability
• Harmful constructs
• 1.0.0 (Nov. 2013)
• 1.1.0 (Oct. 2014)
• Sri Lanka (1972)
![Page 3: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/3.jpg)
Names, bindings, scoping• Case-sensitive
• Immutable by default
• Static scoping (Exception: JS)
![Page 4: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/4.jpg)
Data Types• All objects (no primitives)
• Integer, Float, String
• Postfix “?” allows for null
• Postfix “+” must contain a value
• Postfix “*” denotes sequential (Iterating over arguments)
• “value” keyword for type inference
• Intersection and Union types ( & |)
• “alias” keyword
![Page 5: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/5.jpg)
Expression and Assignments• Same as Java
• Pure, first-order functions (no object burden)
• <keyword(s)> <type> <id> = <value> || <function>;
{String*} & Correspondence<Integer,String> strings = [“Hello”,”world”];
String? str = strings.get(0); //Call get() of Correspondence
Integer size = strings.size; //Call size of Iterable
![Page 6: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/6.jpg)
Control Structures• If, switch, assert, for, while, try-catch
• Curly braces regardless of number of lines
• C-style for loops unnecessary (use range operator)
• For-loops can have “else” block, optionally
• No do-while
• Remove type to infer exception type
![Page 7: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/7.jpg)
Subprograms• Abstracted from “Callable” interface
• shared interface Callable<out Return, in Arguments>
given Arguments satisfies Anything[]{ }
![Page 8: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/8.jpg)
Abstraction and Encapsulation• Helps ease “this” usage• No “new” keyword for instantiation
"A polar coordinate" //Class annotation class Polar(Float angle, Float radius) {
shared Polar rotate(Float rotation) => Polar(angle+rotation, radius); shared Polar dilate(Float dilation) => Polar(angle, radius*dilation); shared String description
= "(``radius``,``angle``)"; } print(Polar(0.37, 10.0).description);
![Page 9: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/9.jpg)
OOP Support• Ceylon supports “impure” OOP
• Lack of structural polymorphism
• Class is a constructor that produces a new instance of a given type
![Page 10: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/10.jpg)
Concurrency• Concurrent models unavailable by default
• Must use Java or a 3rd party module
![Page 11: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/11.jpg)
Readability• Familiar syntax
• Static typing for better understanding
• Annotations
• Hard for newer users to get used to heavy, static typing
![Page 12: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/12.jpg)
Writability• Expressiveness is encouraged when writing in Ceylon
• Great workflow
• Functions and fields can be written as standalone (no class needed)
• Standalones compiled into classes within the “.car” file
![Page 13: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/13.jpg)
Reliability• Runs on the JVM
• Static typing allows for much greater reliability
• Immutable nature also enhances reliability
![Page 14: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/14.jpg)
Cost• Free plug-in for Eclipse
• Open source
• Relies on JVM (resource intensive)
![Page 15: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/15.jpg)
Extras• Uses modules
• Ceylon Herd
• Java and Javascript can be fully integrated into Ceylon code
• Ceylon code can be compiled to JS code natively
![Page 16: Ceylon Readability for the Modern Java Developer.](https://reader035.fdocuments.net/reader035/viewer/2022062720/56649f0e5503460f94c22298/html5/thumbnails/16.jpg)
Questions• Do you have them?