SlideShare a Scribd company logo
1 of 41
Fantom
The Developers Choice
SlimerDude
aka
Steve Eynon
Fantom
is a
Future Proof
Next Generation
Language
Fantom vs Java
VS.
Steve Eynon
• Assembler
• Visual Basic
• Java (13+ years!)
• Javascript
• Ruby
• C#
• Fantom!
Full Stack, web application, developer
- Tedious
- Limited
- Complicated
- Anti-Agile
- Dangerous
- Ugly
Fantom
The Developers Choice!
Contents
4. Literals
3. Core API
2. Concurrency
1. Language Sugar
0. X-Platform Development
4. Literals
Fantom is a
Forward Thinking
Language
Java: Integer Numbers
byte – 8 bits
short – 16 bits
char – 16 bits
int – 32 bits
long – 64 bits
No performance gain in using fewer bits!
Plus more
in C# !!
Fantom: Integer Number
Int – 64 bits
Job done.
64 bits gives +/- 292 years of Nano seconds!
1ms = 1,000,000 ns
Java: Number Literals Only
int countdown = 10;
print("This spaceship will
self destruct in " + countdown);
10!
10 what?
Units are important!
Fantom: Duration Literal
countdown := 10min
echo("This spaceship will
self destruct in ${countdown}")
Duration choices:
10ns, 10ms, 10sec, 10min, 10hr, 10day
We’re gonna
make it!
Fantom: URI Literal
url := `http://fantom-lang.org/download`
url.scheme // --> http
url.host // --> fantom-lang.org
url.name // --> download
ID ‘36’ vs URI `myApp:/pages/36`
3. Core API
Fantom's Concise and Sane API
is a
Developer's Dream!
Java Collection Framework
Collection
Set
SortedSet
List
Queue
Deque
45 classes in total!
Just the Interfaces!
Java Collection Framework
http://javaultimate.com/java/collection_introduction.htm
Java’s List
Simple View!
Fantom Collection Class
sys::List
• Supports Generics
• Functional w closures
• All the methods you need
• Easy to remember
• Easy to use
Job done.
Java Streams
java.io package has 80 classes!
Fantom Streams
sys::InStream
sys::OutStream
• Functional
• All the methods you need
• Easy to remember
• Easy to use
Read Text File : Java
FileReader fr = new FileReader("file.txt")
BufferedReader br = new BufferedReader(fr);
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
}
String everything = sb.toString();
} finally {
br.close();
}
http://stackoverflow.com/questions/4716503/reading-a-plain-text-file-in-java
14 lines of code!
Read Text File : Fantom
text := File(`file.txt`).readAllStr
Job done.
Character Encoding
“There Ain't No Such Thing As Plain Text.”
- Joel Spolsky
But UTF-8 is pretty darn close!
In Fantom, everything is UTF-8 by default!
http://www.joelonsoftware.com/articles/Unicode.html
2. Concurreny
Fantom
uses Actors and the
Message Processing Model
Java: Mutable State
Data
Thread 1
Thread 2
Thread 3
Java: Mutable State
• Difficult to implement safely
Threads, Locks, Semaphores, Synchronisation, Mutual
exclusion, Memory barriers, Java's borked JSR133, Broken
double locking mechanisms...
• Mutable state
“All state is evil!” - functional programming
• Error prone
See above & 60 classes in “java.util.concurrent”
• Not scalable
More threads = more blocking / synchronising
Fantom: Msg Processing
Actor 1
Actor 2
Actor 3
Msg
Msg
Msg
Fantom: Msg Processing
• Easy to implement
Actors (threads) pass messages to each other
4 classes in “concurrent” pod
• Immutable messages
Compiler enforces immutable messages – Actors have no
access to mutable state
• Safe
See above
• Scalable
Use more Actors to process multiple jobs
1. Language Sugar
Fantom’s
Language Sugar
makes it a joy to program!
Java Getters / Setters
private String greeting;
public String getGreeting() {
return "Hello " + greeting + "!";
}
public void setGreeting(String greeting) {
this.greeting = greeting.trim();
}
myClass.greeting = "Mum";
Vs
myClass.setGreeting("Mum");
Fantom Field Accessors
Str greeting2 {
get { "Hello ${&greeting}!" }
set { &greeting = it.trim }
}
Str greeting2 {
private set
}
Read only field
Str greeting1 Standard field
Java Syntax
StringBuilder sb = new StringBuilder();
Repeat, repeat, repeat…
Fantom Syntax
sb := StrBuf()
Unique loose type inference.
Fantom Syntax
Animal
Cat Dog
Void eat(Cat cat) { ... }
cat := Cat()
dog := Dog()
animal := dog as Animal
eat(cat) ✔
eat(dog) ✗ -> Compile Err
eat(animal) ? -> Runtime Err
Fantom Code Visibility
Internal to Pod
Private
to Class
Public to Application
Honourable Mentions
• Default method parameters
• Everything is an Object
• Nullable types
• No checked exceptions
• Simple reflection
• Dynamic programming
• Human readable object serialisation
• Markdown documentation
• …
0. Cross-Platform
Fantom
for
X-Platform Development
Browser Screenshots
Fanny the Fantom Game
Same code runs in a browser and as a desktop application!
Websites
Fanny the Fantom
fanny.fantomfactory.org
Fantom
fantom.org
fantom-lang.org
www.fantomfactory.org
Fantom
The Developers Choice
SlimerDude
aka
Steve Eynon
Fantom
The Developers Choice
SlimerDude
aka
Steve Eynon
Fantom
The Developers Choice
SlimerDude
aka
Steve Eynon
Fantom
The Developers Choice
SlimerDude
aka
Steve Eynon

More Related Content

Viewers also liked (9)

Resume Venugopal Sampath
Resume Venugopal SampathResume Venugopal Sampath
Resume Venugopal Sampath
 
Koffiedik
KoffiedikKoffiedik
Koffiedik
 
CV Duke_(Marin)_March_2016_CLEAN
CV Duke_(Marin)_March_2016_CLEANCV Duke_(Marin)_March_2016_CLEAN
CV Duke_(Marin)_March_2016_CLEAN
 
Presentación del Sistema Nacional de Facilitadores Judiciales
Presentación del Sistema Nacional de Facilitadores JudicialesPresentación del Sistema Nacional de Facilitadores Judiciales
Presentación del Sistema Nacional de Facilitadores Judiciales
 
DeKubus
DeKubusDeKubus
DeKubus
 
ExpertArtComunication
ExpertArtComunicationExpertArtComunication
ExpertArtComunication
 
LOGO DESIGN
LOGO DESIGNLOGO DESIGN
LOGO DESIGN
 
Marlabs Capabilities Overview: Education and Media - Publishing
Marlabs Capabilities Overview: Education and Media - Publishing Marlabs Capabilities Overview: Education and Media - Publishing
Marlabs Capabilities Overview: Education and Media - Publishing
 
Economy toeic lc 1000 volume 1
Economy toeic lc 1000 volume 1 Economy toeic lc 1000 volume 1
Economy toeic lc 1000 volume 1
 

Similar to Fantom - The Developer's Choice!

Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
kumar467
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
prat0ham
 

Similar to Fantom - The Developer's Choice! (20)

The bigrabbit
The bigrabbitThe bigrabbit
The bigrabbit
 
Java tuning on GNU/Linux for busy dev
Java tuning on GNU/Linux for busy devJava tuning on GNU/Linux for busy dev
Java tuning on GNU/Linux for busy dev
 
Introduction To Java history, application, features.pptx
Introduction To Java history, application, features.pptxIntroduction To Java history, application, features.pptx
Introduction To Java history, application, features.pptx
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_future
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming Language
 
Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
 
Java lab lecture 1
Java  lab  lecture 1Java  lab  lecture 1
Java lab lecture 1
 
The Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidThe Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with android
 
JAVA for Every one
JAVA for Every oneJAVA for Every one
JAVA for Every one
 
Jvm tuning in a rush! - Lviv JUG
Jvm tuning in a rush! - Lviv JUGJvm tuning in a rush! - Lviv JUG
Jvm tuning in a rush! - Lviv JUG
 
Java lab zero lecture
Java  lab  zero lectureJava  lab  zero lecture
Java lab zero lecture
 
Titanium - Making the most of your single thread
Titanium - Making the most of your single threadTitanium - Making the most of your single thread
Titanium - Making the most of your single thread
 
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft..."Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
 
Performance optimization techniques for Java code
Performance optimization techniques for Java codePerformance optimization techniques for Java code
Performance optimization techniques for Java code
 
Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
 
Java notes
Java notesJava notes
Java notes
 
intoduction to java
intoduction to javaintoduction to java
intoduction to java
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

Fantom - The Developer's Choice!

Editor's Notes

  1. Hello, I *am* SlimerDude - also known as Steve Eynon. And welcome my 15 minute talk entitled: Fantom – The Developers Choice So what is Fantom?
  2. Well, Fantom is a Future Proof, Next Generation Language. Now, that’s a bold statement so lets look at some examples of why I think it to be true. But to do so, we’ll have to compare Fantom against a normal, current generation language. For that we’re going to use Java.
  3. I’ve picked Java because it’s a popular language many will be familiar with. But who am I to be making this comparison?
  4. I am Steve Eynon – and I would call myself a full stack, web application developer. I have a lot of experience with: Assembler, Visual Basic, Java, Javascript, Ruby, C#, and of course Fantom. Java in particular I’ve used for most of my career, and in fact I have over 13 continuous years of Java development. But given an option, I wouldn’t use most of these languages. <click> Not that I particularly dislike them, but I do consider them to be: Tedious, limited, complicated, anti-agile, dangerous, and just plain, down right, ugly! Which leaves…
  5. Fantom! For this presentation we're going to countdown the topics of:
  6. Literals, Core API, Concurrency, Language Sugar, X-Platform Development And it’s a programmers countdown because it’s zero based!
  7. Literals - Fantom is a Forward Thinking Language. Let’s see how.
  8. In Java, if you want to represent a number you have a crazy amount of choices! Byte, short, char, int, long… choose your number of bits, 8, 16, 32, 64! And in C# you even have signed and unsigned choices! Woah! I don’t care! I have a number, let’s say 10. Perhaps it’ll change to 2,000, maybe 200,000. I don’t know, I don’t want to pre-calculate the min max range! The thing is, all of this unwanted choice is to deal with legacy architectures from a time when it wasn't efficient to perform 64 bit addition. And that in-efficiency was mocked by C and assembler developers, even if it didn’t matter in the grand scheme of programming. More to the point in today’s world of 64 bit architecture supremacy, it isn't even more *efficient* to process smaller bit numbers! Some even argue it takes *longer* because of the extra masking involved! So what of Fantom then?
  9. It has one Int that’s 64 bits. Job done. Would you ever need more bits? Realistically, for general purpose numbers, probably not. 64 bits is pretty huge! Fantom stores time in an Int – it represents NANO seconds since year 2000, and that gives us +/-292 years at a pretty high precision. Especially as 1ms equals 1 million nano seconds!
  10. When it comes to literals – that is, types understood by the compiler, most languages only recognise numbers, booleans, and strings. So lets talk about a pet hate of mine. What’s wrong with this code? Well, it’s going to print, “This spaceship will self destruct in 10” <click> 10! 10 what!? 10 seconds? 10 hours? What!? Damn it, units are important! Especially if my spaceship is about to explode! But more realistically, I see this a lot in APIs when setting timeouts - it leaves the developer guessing whether to pass in minutes, seconds, or milli-seconds. Get it wrong and your 1 second timeout may turn into 16 ½ minutes!
  11. So Fantom introduces a handy ‘Duration’ literal. Meaning if you add the word ‘sec’ or a ‘min’ to a number, the Fantom compiler doesn’t create an instance of a number. Instead it creates an instance of a Duration class. Now I know exactly when my spaceship will explode!
  12. Which is good news for some!
  13. Fantom doesn’t stop there. It also has a URI literal. Use back ticks instead of normal quotes to create an instance of a URI class. It may seem strange at first, but think about it. We’re in the age of the Internet. The Internet of Things! It not just web pages that have URLs any more. There are images, sounds, REST APIs, databases, and even local file systems! But it’s not just URLs, the Fantom literal is a UR-I (Universal Resource Indicator) meaning, much like how XML is to HTML, you can use it to create your own schemes and IDs! Why use simple numbers or strings as database IDs when you could be using recognisable and hierarchical URIs!? For example, why use the obscure number 36 when you could use an URI that comes complete with useful metadata such as what application it belongs to and what collection it represents?
  14. 3. Fantom's Concise and Sane API is a Developer's Dream! That’s nice! But first let’s look at what’s not a developer’s dream!
  15. The Java Collections Framework! Say you want a simple list of objects in Java. Arrays are fixed and too inflexible, so you opt for a List object. But do you want a Collection, a Set, a SortedSet, a List, a Queue, a Deque? And that's just the Interfaces! From there you have to choose an implementation! It is Array based? Linked? Hashed!? Trees!? The mind boggles! In all there are about 45 classes and interfaces just for Lists and Maps in Java! If you think all this is okay then look at this…
  16. The Java Ultimate website presents this **Simple View** of a List. Boy, I’d hate to see the complicated view! I just want an ordered list of 10 things. I really shouldn’t need a computer science degree to choose the right implementation! So by comparison, lets see what Fantom has to offer.
  17. A List. It handles generics, it has functional methods with closures, and all the methods you need. Especially for a new comer to Fantom, or programming, it’s easy to remember and easy to use. Job done.
  18. Another Java example, this time with Streams. The ‘java.io’ package has some 80 classes! <click> Fantom has 2. An InStream, and an OutStream. Again, they’re functional, use closures and have all the methods you need. Easy to remember, easy to use.
  19. Let’s put some of these 80 Java classes to work and read a plain text file. This is the accepted answer from a StackOverflow question on how to read a plain text file in Java. It’s 14 lines long! How complicated and convoluted is that!? Lets look at Fantom...
  20. One line. It’s that simple! This is not just some handy utility method, this the core API and it is one small example of the thought gone into making common tasks really simple. Note how we use a URI to represent a file on the file system!
  21. On the subject of text files, what of character sets and text encoding? The great Joel Spolsky once said, "There is no such thing as plain text" but lets face it, UTF-8 comes pretty close. And thankfully, Fantom defaults to UTF-8 for everything text related and hence truly becomes platform independent. Note that Java gets Characters Sets very wrong and uses a platform default, meaning (unless you're very, very careful) you end up with incompatible text files on different systems. Even the Maven build tool fell foul of this one!
  22. 2. Concurrency Fantom uses Actors and the Message Processing Model This is quite a technical topic that really deserves its own presentation to do it justice, but it is also too important not to mention. So we’ll just skim over some of the main points.
  23. First we’ll look at Java’s stance on concurrency; it uses mutable state. Mutable state is simple enough to understand. each thread has access to the same bit of data and each thread may update it any time. Unfortunately java tries to be clever and introduces things like thread data caching. And what happens when you need to update 2 bits of data at the same time and don’t want any other thread to access any of it until you’re finished!? (Like the contrived example of crediting one bank account and debiting the other). All this and more, means you need to be an expert in mutable concurrency models just to implement the basics!
  24. In brief, mutable state in Java is difficult to implement safely because to do it properly you also need to fully understand, threads, locks, semaphores, JSR133, broken double locking mechanisms, and more! Functional programming says that “All state is evil!” If that’s true then surely mutable state must be the ultimate evil! Java has 60 classes dedicated to doing concurrency properly. Given all the complications of the above, then implementing mutable state safely is also prone to errors and mistakes. And it’s not even scalable. If you wanted more processing threads then you’re just creating a bottle neck on the synchronised data.
  25. By comparison, Fantom employs an Actor framework and the message processing model. Here threads, also known as Actors, send messages to each other. These messages are just instances of Fantom classes. But not just any classes, immutable classes! This means the message content can not change, hence we don’t have the mutable state conundrum that Java has. Better yet, it is not even possible to compile a Fantom program whereby different threads have access to the same bit of data! Therefore when it comes to concurrency, Fantom as a language is inherently safe!
  26. Actors are easy to understand and implement. It only take 4 classes in the Fantom “concurrent” pod. The *compiler* forces the use of immutable message classes between Actors which makes it safe and less prone to errors. The Actor model is also scalable, allowing you to add more threaded workers as you wish.
  27. Language Sugar Fantom’s Language Sugar makes it a joy to program! There are sooo many little things to mention here I've found it difficult to limit myself – but I’ve picked 3 to share with you…
  28. Java has fields. But if you wanted to alter the behaviour slightly, like trimming and a validating inputs, then you would need a method. And then you’d need to change ALL your code from using the field to using the method. As this is painful, Java programmers usually forgo fields altogether and instead create lots of boiler plate getter and setter methods. It’s tedious.
  29. Fantom, on the other hand, has real field accessors! Something I've missed since my early days of programming Visual Basic! Not even C# properties come close to the real power of Fantom fields! Here, we have examples of 3 Fantom fields. The first is a standard public Fantom field. The seconds has a getter and setter. Note these are optional, any field may or may not have them. It doesn’t matter if they exist or not, all the code that uses that field stays the same. Even better, if you want to make the field read only, just make the setter private! No boiler plate code, no getter and setter methods. Just intelligent fields.
  30. Next a quick look at the Java syntax. Here we create a new StringBuilder class, and we assign it to a StringBuilder variable. Note how we’ve just had to type StringBuilder twice. And this happens a lot in Java. It’s strongly typed and we have to repeat ourselves over and over and over… which makes for long lines of code. Especially when you start adding in generics! <click> Fantom is different. It uses Type Inference to determine what the variables should be. Here we create a StrBuf (similar to java’s StringBuilder) but Fantom knows what it is and hence assigns it to automatically to a StrBuf variable. We don’t repeat ourselves and it cuts down a lot of code. Other languages have cottoned on to the concise expressiveness of type inference, but Fantom gives real power to the programmer and goes one step further. It has a unique “loose” type inference whereby if something *could* work then it assumes it *does* work!
  31. A quick example to explain it. Assume we have a method “eat” that takes a Cat. <click> The compiler will bork if we try to pass in a Dog, but <click> it *will* let us pass in an animal instance, even if it is wrong. That will, of course, cause a runtime error. But in the course of static programming, 99.9% of the time we *know* what our variables are. And in practice, this is never an issue. But what it *does* do for us, is dramatically cut down the amount of casting and type coercion, meaning we type a heck of a lot less!
  32. Fantom Code Visibility This is a such a small thing, but it means so much to me because I write so many libraries and pods for Fantom. Fantom has 3 main visibility types. Private visibility means it is private to the class. Public visibility means everyone can see it. This is the public API that your library exposes to the outside world. <click> Then there’s *internal* visibility that means it is only accessible to the containing pod. This is brilliant because it means you can pick and choose what to share with the outside world and keep all your *internals* hidden from view! For example, the Sizzle pod which performs CSS selectors on XML documents, it has a tiny public API of 1 class and 6 methods. But internally it has 10 classes and countless methods! A common problem in other languages, like Java, is that they expose *everything* which makes it very daunting for users to know which classes and methods they should be using!
  33. Other cool language sugar that I could mention include: - Default method parameters - Everything is an Object - Nullable types - Dynamic programming - and so on In fact, there are just too many to mention! And finally we’ve reached the end of the countdown!
  34. 0. Fantom for X-Platform Development Fantom runs great on a Java JVM, and there's a lot of work gone into a .NET implementation. But annotate any class with '@Js' and it automatically gets compiled to Javascript. That's right, the entire Fantom runtime and 'sys' pod is available in Javascript, and runs in a browser!
  35. If you want to specifically write Fantom that targets the browser environment, then the 'dom' and 'dom kit' libraries give you some kick ass performance. But better yet, the core Fantom graphics library, and the windowing toolkit, initially written for desktops, also runs in a browser! I can't tell you how cool this is! In fact, I can only show you!
  36. So here is a little game I created. I wrote it in Fantom and I wrote the entire game to run as a desktop application. I then set about making it run in a browser. To do that took just 25 minutes, including creating a web site to serve it from! It is called *Fanny the Fantom*, features some retro looking vector graphics, and even persists its high scores to a server on the internet!
  37. If you would like play with my fanny, or read about Fantom then check out these websites. Please do get in touch if you have any queries regarding Fanny, Fantom, or programming in general.
  38. I am Steve Eynon. And this has been why I consider Fantom to be the Developers Choice!
  39. I am Steve Eynon. And this has been why I consider Fantom to be the Developers Choice! We have some 5 minutes left before we get kicked out – so I can either answer questions in here, or at the bar!?
  40. I am Steve Eynon. And this has been why I consider Fantom to be the Developers Choice! We have some 5 minutes left before we get kicked out – so I can either answer questions in here, or at the bar!?
  41. I am Steve Eynon. And this has been why I consider Fantom to be the Developers Choice! We have some 5 minutes left before we get kicked out – so I can either answer questions in here, or at the bar!?