You are here: Home Old redinnovation.com blog python
Personal tools

python

2007-06-20

The mobile future is here

Nokia has launched Mobile Web Server service. Now one can host custom web pages and services in his/her mobile phone.

A new age of information technology has just begun. Nokia released its Mobile Web Server product on 19th June.

Mobile Web Server is a application/service for mobile phones. You can run a mobile web server software in Nokia Series 60 mobile phones. Others can connect to your mobile phone and browse around in items you wish to share.


Some use cases that pop up my mind are
  • Sharing photos in Internet instantly they are taken with your camera phone
  • Sharing your calender with your colleagues
  • Browse your vital contact information if you have forgot your phone somewhere
  • Remote control your phone camera
  • etc.

I believe we cannot yet comprehend all the possibilites with our limited PC - web server mindset. By combining GPS, social networking, accelerometers and service mash ups something exist beyond imagination.

Visit at my mobile webserver in address http://moo.mymobilesite.net. All content is served directly from my mobile phone. I have fixed 128 kbit/s 3G connection so it might be a bit slow. However, WiMax & co. are waiting behind the door, so connection speed problems will be gone in few years.

The best thing is that Nokia offers free HTTP proxy traffic and DNS name for every registered mobile phone. Currently, mobile operators don't assign Internet IP address for their  connections. This seriously limits the Internet-ability of mobile phones. Nokia's proxy server solves the problem by keeping a HTTPS tunnel open from Nokia managed Internet server to your mobile phone.

Also, the mobile web server is based on Apache and Python technologies. Python is a very agile programming language and creating new hacks is easy as changing the diapers. I think I am going to implement something kinky, just to see how cool it can be.

FTW Nokia!

2006-09-09

First steps with Django

Django and Plone are both kind of Python web development platforms. Plone is an old timer, huge mature content management system monster. Django is a light web development platform. Though they don't serve the same purpose, comparing technologies in them might shed light on some issues.

I have been poking around with Django few days now. I have been doing Plone development two years, so pardon me if my comments on Django are inaccurate. Here is a bit mindflow pouring out of my head. Again pardon for not-so-well-ordered content.


On the blue corner...


Django is a web development framework. You can easily implement small site functionality on it. Django has a bit hype around it now when the father of Python, Guido van Rossum, named it as the preferred framework for Python web development.

Plone content management system/(running on Zope application server) is complete content management solutions which ships with tons of stuff like permissions. workflows, complete skinnable UI. Plone has been here for years, there are a lot of real companies doing web development and some developers estimated Plone installation base be several thousands.

Naturally both are open source.

Common for both of these web platforms is that they are based on Python programming language. Currently, Python is my favorite as a wrist saving language. Python has compact, easy-to-read, syntax: You type less - you are more productive.

Test-fix-restart


Plone takes aeons to boot (it loads nearly 10 MB Python code to memory). This makes Python code debugging painful, even on the latest monster machines. (Note: this doesn't concern CSS/HTML development). Plone used to have on-the-fly code replacing, but with the latest Plone/Zope versions it usually fails due to Zope 3 dependencies. Zope 3/Five doesn't support hot replacing code, does it?

Django boots in one second.

The best of both


Django doesn't have a hiearchial content tree which makes things like automatic navigation trees, permission inheritance, etc. difficult. On the other hand, a big part of Plone codebase internals deal with acquistision: you have extra things to worry about.

Django is good when you don't need through-the-web content editing, the content is mostly static and there aren't many people working on your site (permissions).

Also, Django is based on traditional relational SQL databases. Plone's object-oriented Zope database, though is better for hierarchial content like most of CMS deal with, is simply weird. This scares off management people.

Why Zope backend is better for CMS? For example, it has field level automatic permission support, hiearchy (SQL doesn't do trees very well) and built-in capabilities to deal with HTML (e.g in search). The high level of integration is also needed when building very high performance sites - tuning database access on product level à la Plone's Cache-Fu product is the only way to achieve high level dynamic performance for content.

Templates are a big part of web development, since in the end, it alls goes to down to ugly HTML hacking. Django uses its own template language. I wonder what lead to yet-another-template-language decision, since the world is already full of template language engines (Smarty, Velocity, XSLT bunch, Freemarker). Unlike Zope's TAL, Django is a generic string replacement language. TAL co-opereates with HTML tags so that it doesn't break the structure of template document. Though the latter might be more painful to write, I prefer it because in the end it gives you easier toread results.

Hype(r)space


Even though Plone is an old project, it lacks the marketing it deserves. Plone is tons of times more mature than Ruby on Rails & co. but when you mention Plone everyone is like "huh?". People even know Django better. I wonder where Plone would be today if it had buzz around it like RoR or Django.

Common woes


Let's hope that organic growth, one of my favorite topics, don't harm Django codebase as much as it has harmed Plone. Looks like Django already had some mixed styles in its coding conventions.

Organical growth problems in open source codebases

Problems with evolutionary codebases in the open source world

One common feature in nearly all community driven open source projects is that they grow organically - stuff gets added when people need it. People come from different backgrounds, have different principles and goals. You cannot command them into engineering discipline like in big corporation world. This leads to tangled codebase.

I have been working with few Python based open source projects (Plone, Zope, Django and Python itself, all community driven) and then with Java projects (Eclipse, IBM led).
  • Community driven code borns through natural evolution
  • Corporate driven code borns through design and discipline
In my opinion, the strong lead might lead to higher quality code base which is more fun to work with (i.e. gives less headache).
  • If there are big payrolls involved someone is usually paid to create documentation and there might be even useful comments in the source code due to formal reviews. Less try-to-see-how-it-works, less dive-into-source, less headache.
  • The style is consistent. You don't see code like MyClass. my_function(). getAnotherFunction(). isthisreasonable().  Java has standard coding conventions, when Python lacks them. The result is eye hurting soup to read. Since good auto complete is nearly impossible to implement in Python IDEs, double checking function naming is even more PITA.
  • More polish. You won't find XXX, TODO, etc. in code in a critical moment when you thought the subsystem was already working
  • After things are once done without too much thinking, phasing them out is difficult. "This method will be deprecated" warnings may stay in the code many years.


In community driven open source projects, at least code conventions could be forced in the scope of the project itself. Other kind of strict rules might not work. Decrease too much the degree of the freedom and soon you don't have committers at all.

I have myself patched some Plone products. It's very unmotivating when your freshly baked cake gets tossed away when the codebase maintainers point things you are not interested in and thus your patches are rejected.



Syndication
Atom
RDF
RSS 2.0
Available for work
Need Web/Usability/Python/Plone/Django expert?
Hire us!