-
Recently I’ve changed my “old” HTC Diamond running Windows Mobile 6.1 with an HTC Desire running Android 2.1.
Why Desire? Mainly for Android. There are 3 platforms out there which deserve attention: iPhone, Android and Windows Mobile. There is Blackberry two, but I’m not a big fan.
Briefly, I’ve chosen Android for the multitude of ways in which you can write an app.
The native language for Android is Java, but for web developers there are alternatives like: Titanium, Phonegap, PHP for Android or Adobe AIR.
I what to explore these alternative technologies to see what and how easy is to develop whit each one of them.
All I can say at the moment is that my first app took me almost 2 days to build, but the result is interesting.
-
When the optimization should take place
Aug 3, 2010 optimizationThere are whole books about optimization, but few mention when is the right moment for the optimization to take place.
There are several perspectives with fundamental differences:
- during development
- at the end of the development cycle
- never
What is the correct answer? In fact there are only less correct or inadequate.
During development
This answer has the most potential to be wrong.
Even though is the most common method and it shouldn’t be interpreted as being wrong, it has the potential to cause issues.
When it may cause issues? When instead of optimization, micro-optimization is used in excess.
Micro-optimization can come in many shapes, depending on how the project is developed. Some write “bulk” code or procedural code, others use frameworks and ORMs. When your deviating from the general rule of writing code to do optimization you should think about the consequences. It will be harder for the next guy that looks at your code to understand what’s going on, and if you make a rule out of that, with time the project will become indecipherable.
For instance if your using ORM and you start typing SQL you are already losing the purpose of the ORM. In ROM there are several steps for each interrogation:
Building the objectual interrogation -> Parse to SQL -> Execute interrogation -> Parse result -> Loading the resulting objects
vs.
Building the SQL interrogation -> Execute interrogation -> Parse result
The steps may varies depending on the implementation.
A lot of the times the second approach looks simpler and is faster for sure. But why use the first approach? For the architectural advantages! You can set triggers when accessing or setting the properties for instance.
A mature developer is the one that writes “readable” code, not just optimum.
At the end of the developing cycle
The advantage is that there are no architectural compromises during development.
This is usual the best method, because you have the finished product, developed without compromise and you can see which points should be optimized. When you have all the components is much simpler to reorganize them then during the development when changes may appear, which in turn can generate for instance code redundancy.
The disadvantage is that at the end is sometimes difficult to find the week points of the application.
Never
First of all let’s make it clear, I mean “serious” projects.
There is a general rule that’s saying “hardware is cheap, programmers are expensive”. More broadly this means that a lot of the times is easier to scale an application using hardware then doing major compromises in the code.
A lot of companies and projects support this perspective. Correctly applied this principle has the advantage of having a well organized code, easy to read and with few hacks.
The advantage is at development, few hacks make a project more organized (in theory) and easier to extend.
Unfortunately looks like there is also a different interpretation: “if must work, it doesn’t have to be perfect”. Where can this lead to? Basically is the best excuse for dirty code.
The major difference is that you never optimize, and the code will look just as bad as when you do excessive micro-optimization.
Conclusion
In general, project that use excessively micro-optimization, have a great potential to be often rewritten, either partially of full, because there is another rule that says “rather then repair, a lot of the times is easier to rewrite”. Unfortunately projects with bad written code suffer the same fate.
A major disadvantage to bad code is that it slows the development cycle, in other words minor tasks tend to last longer and longer to be accomplished.
Projects don’t have to be always optimized. But when we have to do that, compromises regarding the architecture must be at minimum.
-
After my second little project, I’m back with my opinion on Adobe AIR!
Working with Adobe AIR I had a revelation, in 2004 John Battelle and Tim O’Reilly presented the concept “Web as Platform”. These days, using the Web as a platform we can develop desktop applications. Basically we’ve left an environment to come back to it with a new perspective.
If the first time I had only 3 days at my disposal, this time I wasn’t constrained. During this time I had the opportunity to discover some of the features, like NativeMenu and the support for SQLite.
I believe that SQLite has the purpose of compensating for the storing possibility that are not available on this platform, like cookies. Of course, SQLite is using a database, and the storing is way superior to the traditional Web.
But way choose Adobe AIR compared to other platforms like Java or C#? Because it is simple! I don’t believe that Adobe AIR was intended to be a tool for developing large applications, even though only time will tell if that’s possible. This is a great tool for small to medium scale apps, which can bring something extra to the Web. For instance in my app I had an alert system, I thought what I would like next to what I already have on the Web. With this alerts I don’t have to check all the time what’s new. Just as well I believe features like chats can be implemented or similarly features, after all if it can be done on the Web, it can be done here.
What Adobe AIR has is a very interesting distribution system, basically the platform is distributed with Adobe Acrobat Reader, thing that can make it available even on your computer without even knowing.
What Adobe AIR does not have, and I thing it would be useful, is a system for accessing COM objects for instance, possibility to access different database systems different then SQLite, which is quite simple.
Another feature that I would like is the possibility to access Adobe Flesh features from JavaScript. I know, I should use Flash if there are Flash features, but I prefer JavaScript as a platform. Probably the reason this features are not available in JavaScript is because this language has the HTML 5 features, like: Canvas and Audio, which somehow compensate with Flash features that are not available in JavaScript by default.
Adobe AIR 2 which is in beta version for the moment, will probably solve some of the need to access the system resources.
In my opinion, Adobe AIR is the platform on which a Web developer can develop desktop apps with ease!
-
CodeIgniter is an open-source PHP framework build for RAD.
The book CodeIgniter 1.7 from PacktPublishing, written by Jose Argudo Blanco and David Upton is trying to build an overall image of of the CodeIgniter framework, as an addintion to the user guide.The book is not a reference, and that becomes obvious with every chapter, each time a new feature of the CodeIgniter framework is introduced the user is directed to the corresponding page of the module in the user guide or wiki. Even more, suggestions are made for alternative modules that can achieve a similar task in a different way.
Authors say that only minimal knowledge of PHP is necessary to read this book, a promise that is hard to keep in my opinion, usually books that target novice to medium skill readers are saying something like that. To my surprise they ware right, the reader only needs PHP4 knowledge. And when it comes to OOP not even PHP5 features are required, just the PHP4 object model. In this book even the copping objects by reference is described! Of course copping objects by reference is no longer a relevant issue with PHP5, but taking this in to consideration that is an PHP4 framework it was a good idea to mention and explain it. It seems like there are still PHP4 server on the Internet… that is just sad…
Reading the book flashbacks came to my mind with pieces of code written directly in PHP and the hell of debugging them, trying to understand other peoples code… what times… horribly of course. The reasoning behind this concepts of re usability in a framework is just great: “Possibly you like typing regex. Some people like lying on a bed of nails…”. When a developer, especially a beginner, is reading something like this it makes him understand that you don’t have to reinvent the wheel each time, but just use solutions already developed by others.
Comparing between different available solutions I believe is the most funny part of a book like this. Is difficult or even impossible to compare for instance Zend Framework or even CakePHP with CodeIgniter. After all almost all frameworks say the same thing, just download and start working. Personally when I need to use a module from Zend Framework I just load the autoloader and get to work. The comparison shows CodeIgniter as a winner for most users, as expected, the reasoning behind that claim is pretty honest. Afterall is a small framework and does not have complex features like autogenerating CRUD. I remember a Java book where the author was representing the fact that C++ is faster then Java as a disadvantage, of course was just silly.
I sometimes had the impression that the terms were wrongly defined. The authors are using “small” mistakes in terms to explain what’s actually happening in the background. When you are working with MVC frameworks some of the notions are simple and obvious, but for a developer that’s not familiar with that terms there are quite hard to comprehend.
And to continue with the mistakes in the book, I’ve found a few. Quite a difficult moment when you start learning something new. Fortunately there are quite obvious because they result in errors, and if you read chapter after chapter you’ll know what the issue is and how to fix it.
Examples are pretty consistent and well documented. When a new concept or module is introduced it is fully explained in detail.
The resulting apps are not very complex, for instance at the end of the book there isn’t a full complex app like a CMS, rather modules and the way there are combined is explained. The user will have to decide in the end how will his app look and feel. For instance in chapter 13 pagination and ordering is explained. When pagination is used everything is OK, but when ordering is introduced the pagination begin to slip. It took me about 5-10 minutes to fix the issue, but it would have been nice for the authors to fix the issue themselves.
Overall is a good book, especially for users that have no prior knowledge of CodeIgniter, is just like is presented by the authors, a book for developers that want more productivity in there work or just what to see what other tools are out there. The book does not present full solutions like a CMS or a shopping cart, but rather what this framework has to offer.
An advanced developer can understand from this book the structure of the CodeIgniter framework, possibly to compare it to other popular frameworks, without loosing time with complex and irrelevant examples.
-
More then an year ago I wrote a blog, where I was telling that Google doesn’t know where I live.
The issue was that Goole Maps had a very poor coverage for Romania, and Yahoo! Maps is a way better alternative for this part of Europe. I still believe that Yahoo! Maps is a better alternative but I was surprised by one thing. Occasionally I’ve visited Google Maps to see how things are going with the coverage of Bucharest, basically it was represented a single way to cross the city from highway A1 to A2, and nothing else.
About a month ago, I went back to check what was new because I needed to build an Romanian tourism app and… surprise, surprise, even though the satellite photos are of lower quality now, I could find my street using the search and even the block where I live. Even more I was able to calculate alternative routes to various locations in Bucharest.
It looks like Google has began to have a little more interest in this part of central Europe, now allowing for a real competition with Yahoo!. This is a great advantage for Android phone users who use Google Maps for there GPS app. Few years ago, to user Google Maps in Romania it was completely useless, you could see the satellite images, but that was about all, you could not find useful addresses, and if there ware marked on the map you could not automatically find a route to them.
Eventually I used Google Maps for my app, even though I still believe that Yahoo! Maps is a good alternative, as far as quality and API. Speaking of API, both of them seem ok and I don’t king that’s a criteria to difference them between the two giants.
A thing a little shocking about Google knowing where I live it was on an evening when curios to see if my GPS works on my mobile phone I went on my balcony. Everything was ok, it found me within 50 and 100m on the Google map, using my wireless connection for the data transfer. Another evening a friend came over to tried the same thing, using the same connection to the Internet, same Google Maps app, and he was found within 100m.
Nothing unusual in theory, but everything changed the next day when he told me that his phone didn’t have GPS, and what we ware seeing was the date from the last time I connected my device… so Google now knows where I live… literary…