1 - Introduction
Learning Objectives :
- Learn how this book is organized
- Learn what this book covers
- Learn who this book is for
- Learn what the Fantom programming language is
- Learn Fantom’s History
- Learn why you should use Fantom
Welcome to Programming Language Fantom 1.0. If you are reading this there is a good chance you fall into one of the two following categories of people. Either you’re new to Fantom and want to learn the language or you have some knowledge of Fantom and you want to learn more. If you are one of those two people, then this book is for you. It is aimed at people of all skill levels. It can be a guide to those who are new to programming and want to learn the Fantom language. It can also be a guide to novice programmers who have experience in another language but are new to Fantom. It can also be a reference to experienced Fantom programmers. Either way it is a great resource for Fantom programmers and Developers alike.
This book is split into three parts. Part one will go over the fundamentals of Fantom. We will be exploring the many wonderful features that Fantom offers us. We will be making many Command Line Applications. We will also look at real world problems and how we can go about using Fantom to solve them. It is crucial that you’re proficient in the topics and concepts covered in part one before you move to any of the other parts in the book.
Part two will cover more of Fantom’s advanced features. We will be expanding and utilizing concepts covered in part one. We will be exploring Fantom’s core APIs. We will be making more advanced Command Line Applications and basic GUI Applications.
In part three we will explore the advanced features of Fantom. We will go in depth of how Fantom as a language is designed. We will be making more advanced GUI applications. We will learn how to effectively utilize skills learned in parts one and two. We will also learn how to design and develop software systems using different methodologies.
As you can see this book covers a lot of information that can not only be applied to Fantom but to programming in general. Each chapter contains a section that goes into deatail about some of the topics covered in that chapter. This section is aimed at more experienced programmers. Newer programmers can skip these detailed sections. At the end of each chapter you will be given exercises to make sure you understand the concepts covered in that chapter. I recommend you do the exercises to help improve your skills. There aren’t many exercises and most of them should be easy to do. You will find the solutions at the end of the book. Next we will meet Fantom.
According to Fantom’s official website
History of Fantom
Brian Frank got the idea for Fantom in 2005 when he decided he wasn't going to choose whether to develop for Java or .NET. The original name of the language was Fan. He picked Fan as the name because it was the name of the neighborhood he was living in at the time and it was a short name. On September 2, 2005 Brain started programming the original compiler for Fantom. This original compiler was written in Java.
Fantom was ultimately trying to solve the lack of portability between the Java and .NET platforms. The original design was more akin to multiple embedded languages. In the original design Brian tried to avoid boxing objects like
Str with a Fan wrapper - instead Fan types were aliased to the Java / .NET counterparts and had direct support for primitives.
December of 2005 was a major time for Fantom. It was the launch of the fantom.org website that Andy Frank, co-founder of Fantom, wrote in PHP. As well as a redesign to language. The language was now using the Pure OO system in place today - everything was boxed in a Fantom specific wrapper including numbers. Getting rid of primitives and aliased classes drastically simplified the compiler although it had some performance tradeoffs.
In early 2006, the compiler had two back-ends: one for Java bytecode and another for .NET IL. In order to make this work, the compiler itself was written in Java such that it could use J# to run inside .NET and access their emit APIs. But there were a couple of problems. The approach required shipping a Fan module in two formats: Java bytecode and .NET assembly. So although you got source portability, you didn't have deployment portability. To Brian, tying them to J# for .NET support didn't seem like a very safe move. So in Feb 2006, Brian undertook a major redesign to use intermediary fcode. The compiler backend was rewritten to generate fcode and pod files. Brian refactored the Java runtime to load fcode and emit bytecode at runtime. Andy started rewriting the .NET runtime in C#. So by the spring of 2006, the architecture was pretty much as you see it today.
In July of 2006 Brian started rewriting the compiler in Fantom itself and by August it could do basic compiling end-to-end from source to fcode. By October 2006 the compiler could compile itself - a pretty monumental milestone. By the end of 2006, Fantom had a simple Fantom script build system and development had switched over to the Fantom version of the compiler.
From 2007 onward, Brian and Andy were shooting for a milestone they called Thompson (named after the western most street in the Fan area). Thompson had two main objectives: getting .NET to run the full test suite and getting fandev.org up and running using Fan. They wanted enough documentation and functionality that newcomers could actually play around with Fan rather than coming to the site and finding vaporware.
It took well over a year to get the language and runtime mature enough to deploy a production site like fandev.org. In April 2008, they finally reached the Thompson milestone. Since then a fledgling community has started participating in various Fantom language debates which have been of a remarkably high caliber. After gaining some popularity members of the community raised concerns about the searchability of the name. In November 2009, the name of the project was officially changed to Fantom.
Why use Fantom?
Main reason to use Fantom is because it was designed to make protability between the JVM and .NET Platforms easier. It has a very familiar syntax which makes it learning curve very thin. Its Purely Object Oriented making suitable for implementing OO Designs. It also supports function programming and function implementations. It has elegant APIs and a strong standard library. It has a good actor-based concurrency model. It has an astounding community. Best of all it is open-source, so you can see its internals, modify its source code to your needs or even contribute.
If you have made it this far then I have sparked your interest. In the next chapter we will be setting up our environment and we will run some example code to make sure we have everything set up.
1. Visit Fantom's website ( http://fantom.org/ ). Become a member of the forums and say hi.