"From Zero to Grails" is a series of programming books written with the beginner, with absolutely no programming experience, in mind. Volume 1 explains how to reason about code by stepping through loops and thinking about the program pointer. It explains what functions are and it introduces object-oriented concepts.
Volume 1 starts by teaching HTML; building a simple website. Then, it covers Groovy, a programming language similar to Java. Then, it moves on to Grails. Grails is a combination of Groovy and HTML. The same site that was built in HTML is built again. This time, with additional functionality enabled by Grails.
The first volume is streamlined, teaching only what you need to know to get your first Grails site up and running. Subsequent volumes, coming in 2015, will go back and cover topics in more detail to round out your knowledge of Groovy/Grails.
There is also a forum at forum.ZeroToGrails.com for readers of the books to ask questions and get answers about HTML, Groovy, and Grails.
If you don't already have a copy, you can purchase one from buy.ZeroToGrails.com.
The picture shows some Groovy code and some arrows to help you reason about it. This code is the solution to one of the example in the book. It is an example about scope.
Scope determines what variables are visible where. Different variables are "active" based on where in the code they are defined-- local variables defined inside functions stay inside functions.
Follow the arrows to see where the numbers start and how they travel through the code to get to the output at the bottom.
This book is divided into 3 sections: HTML, Groovy, and Grails.
HTML is the language of the web. It’s been around since 1989 and is used to define web pages. If you already know HTML, just check out the HTML site that we are building to verify that you know all the HTML tags that will be used later in developing the Grails website. Then, skip to the Groovy section.
Groovy is a programming language. It is a lot like Java. Java is a very popular programming language that is "write once, run anywhere." This means that you can write a program one time and it will run on Mac, Windows, or Linux without any changes. Not all programming languages are like this. Microsoft has a series of languages called .Net which are designed to run only on Windows machines. An Android app can only run on an Android phone, etc. Java is “write once, run anywhere” by having something called the JVM, or Java Virtual Machine. The JVM is the program that runs Java programs. So, the JVM is written once for each operating system (Windows, Mac, and Linux are examples of operating systems) and any Java program will run on any JVM.
The JVM doesn't understand Java as the programmer writes it. Java must be translated to something called Java Byte code during a process called compilation. To compile just means to translate a programming language to another form. Groovy has a very close relationship to Java: Groovy code compiles to Java Byte code as well. So, they look the same to the JVM. Java code itself is valid Groovy code but not vice versa. Groovy is considered more concise and flexible than Java and is an alternative to the classic Java language. Java and Groovy are used for general purpose applications, not necessarily related to the web.
Grails is a “convention over configuration” web framework. Convention over configuration means there are conventions that, when followed, allow the Grails framework to do a lot of work for you. It uses Groovy to create HTML pages in a dynamic way that ends up being easier to use and maintain than plain HTML development.