Over last months of 2010 I was coming to realization that I want to be able not only to make multimedia Flash apps in web but also build HTML pages and services around them. So decided to start slowly learning some. Also with HTML5 making core web stack more and more potent it would make me more prepared for challenges where HTML5 will be a better choice then Flash for rich internet applications.
Not that I don’t know or did not know some. I have basic knowledge of HTML/CSS/JS/PHP/MySQL. Kind of standard stack used today for various cases. But here my knowledge is gather from various small cases and web examples. Probably only part of it where I did get some formal education is relational data bases. What I wanted was to broaden my knowledge in all this.
Asking friends for ideas about good books to start from I was often asked “why books?”. Today you can learn anything from the web, thousands of examples, tutorials and documentation sites and active developer communities allow anyone to learn to program anything.
Thing is that I find it to be a bad way to start. Tutorials and examples often concentrate on solving something specific, are not always made with big picture in mind or sometimes even made badly and teach you bad things. I prefer to start from some book that give a broad and not deep view, showing how it is meant to be done without going too deep in to the details(details I will dig out later if I will need). I need this to get some ground under my feet from where I can start. And then explore the web myself knowing for what to look, what’s good and what’s not so good etc etc.
For starters I picked a little bit unusual direction As I mentioned I more or less know PHP and I wanted to try something new. Also for some time I was curious about Google App Engine. Pocking around GAE I found that probably best languages for that platform right now are Python and Java. Well I knew Java years back and don’t want to return. So I went in direction of Python.
In last December I was ordering some books from Amazon and ended up ordering 3 books on web technologies.
Google App Engine
First book from those I started to read was specifically about Google App Engine. This book covers whole GAE platform as far as I can tell. On programming part it includes both Python and Java specifics, classes and code examples. It helps you trough your first Google App Engine application. Big part of it is Data Store. Then it comes trough various other features of GAE like memory cache, google account integration apis, various other built in apis.
For me most interesting part was Data Store. I am pretty familiar with relational databases and ideas behind them and was always curious what Data Store is, how it works, where better to use it and this books gives pretty good overview on that side. Actually something like 1/3 of this book is about Data Store related stuff.
Some interesting things about App Engine. It was designed with “return answer as fast as possible” ideology for rich web apps. One related to that interesting feature is that app can return result first and then start working on updating data, indexes etc. I guess that possible to do with any stack but I never looked on it from that optimization point.
As far as Data Store goes it reminds me of simple Object Orientated Database. It basically stores entities by unique keys that may have properties and something like classes forced by code. Also Data Store allows building indexes to run queries on some of the property types. As far as I can say there are 3 significant differences from SQL database:
- Query language is simple, does not allow joins and some types of queries that need calculations
- You can retrieve entities not trough queries but directly if you know their unique keys, it is lot faster then trough query
- It is possible to store an array as entity property, it also allows running queries that target content of arrays so you can get entities who have some kind of values in their array typed property, you can store keys in such array making kind of Object Orientated version of one to many relationship between entities
Another thing is that keys are constructed in a way where first part of key is application ID, and you don’t even see it, which means that each app can only get access to entities it has created. Can’t access other apps data directly. Also there are limitations on how many entities you can access at once which along with other GQL limitations makes GAE a bad platform for solutions that for example need t work with large amount of data providing statistical info on it.
I guess that would be it on that book. Overall it gives good overview for GAE providing a good start point if you want to know what GAE can and can not do.
Another topic I was curious about but never was really getting to know it better was CSS.
Basically its something I knew what it was for but did not knew general ideas behind it and how it is really meant to be used. This book claims to be a book for those who have been using CSS for some time but don’t feel they are experts yet. Or people with basic knowledge of CSS. After reading this book I must say that its rather a book for starters. It rather teaches clean and simple CSS/HTML showing where common pitfalls are and all.
This books covers essential parts of CSS, selectors, techniques of layout, advanced CSS3 features and how to do something like that in CSS2.1 using old methods and tricks.
I think best part of this books is that it teaches how it should be done and why. Why HTML part of pages should be designed as meaning and structure while all styling should go in to CSS. Author adds small examples from his experience which make it pretty clear why it should be like that. Or another thing is how using hacking to fix problems is a bad idea as problems are fixed as browsers are updated. So your hacky fix now becomes a bug.
Some 7 years ago coming from Java/C/Pascal background I started to dig in to HTML/CSS/JS and Flash. Flash slowly win me over. It was a way to develop Apps while HTML seemed like way to developer styled text pages along with a bonus of serious cross browser inconsistencies/bugs and limitations. Over these 7 years things seemed to improve especially on JS/CSS front.
Sadly coming from Flash I still find that even CSS3 is insufficient to style things cleanly. Firstly today style is not only about static visuals. Its about animations, reaction to user actions, its about visual behavior of interfaces. Now CSS3 includes animations but that’s not enough. I think big problem is that you can’t reference values in CSS. For example one of examples in the book shows how to make 3 text columns to be of one dynamic height. Thing is that you can have them aether of static height or they all will scale according to size of text inside them. As you can’t reference values in CSS what author proposes is to make all columns of large height, then use container of those columns in “hakcy” way which resizes according its content actual size. Now container is of size of highest column. And now use overflow property to cut out unnecessary height of columns. Of course such trick is possible only with simple column style. Now then all I wanted is to make 3 columns to share same dynamic size. And I end up with doing lot of trickery to get a limited solution. This kind of lets me down…
Another example is vertical content centering on page. Solution looks pretty clear but is limited too. Just make your content top padding 50% which will move its top side to center of page. And then, with different technique, move content up by half of its height. Yay it is centered. Sounds even intuitive and logical in idea. But you can’t target values in CSS. So you can’t target its own height in position style. So you can’t center object vertically if it has dynamic size in HTML/CSS… Or at least it seems so.
Well anyways this all is CSS problems. This books does good work communicating good and correct way of dividing content and style of your HTML/CSS pages. I guess many HTML/CSS problems can be solved with JSS/jQuery filling in position of visual and other behavior for HTML/JS/CSS at least for now.
Python Web Development with Django
Another book I only just started to read is this one. I thought that it is a good idea to learn not PHP/Python language directly for web development(as that I can do myself). What I wanted to learn is how to develop good web solutions too. How to architect your engine, authentication, user content, HTML output components etc. I wanted to know best practices in how to develop your engine/framework for web site building. And what’s a better way then learning some framework and seeing how they done things there.
Another thing with Python books is that Python is a language used for broad number of things. While PHP is mostly used for web development Python started elsewhere as general purpose language like C. As a result majority of books don’t cover Python use as web development language almost at all. And thus majority of those books are of no interest for me in current situation. For that reason picking Python based web development framework book seemed like a good idea too.
Now first chapters of this book gives incremental introduction to Python first which is perfect I knew for a while that Python used spaces and new lines as part of its syntax instead of various braces. I always was finding that it is both good and bad. Good that everyone writes in same style as it is enforced trough syntax, also makes language less bloated with special symbols and more readable. Sadly in some cases it also makes language less readable as you can’t arbitrary style some part of code for better readability.
I just only started this book but so far I must say I really like some features of Python. They make language a lot smaller when performing task with array for example. Here are few interesting examples:
- string – like in any other language it returns strings second character
- string[-1] – here good things start, it returns strings last character, so if index in  is less then 0 array length is added
- string[:1] – now what? Turns out that Python extended this operator to allow ranges. In this case it will return first two characters of this string.
- string[1:3] – now this is full syntax returning second, third and fourth symbols in the string.
- string[1:] – and this will return whole string without first character
Anyways I have still much to read from this one so no more comments on it so far.
Other books and some practice