Wiley.Mobile.Python.Rapid.prototyping.of.applications.on.the.mobile.platform.Dec.2007 (779889), страница 4
Текст из файла (страница 4)
Throughout the book, examples arecross-referenced with each other, so the book can also be ‘dipped into’and not necessarily read from cover to cover.Besides many examples, Chapters 3 to 6 contain some Python language lessons. These lessons, spanning at most a page, introduce you tothe basic concepts of the Python programming language. They provideyou necessary knowledge on the language, so you can follow examplesand extend them by yourself. Even though the lessons cover the basicconcepts in Python, they omit many of its interesting and useful features.As the lessons deal with Python in general and not specifically aboutPython on the mobile platform, you can easily find more informationabout the topics in many books and Python tutorials on the web (see theReferences section).However, you will be surprised how far you get with 14 one-pagelessons on Python!WHO IS THIS BOOK FOR?51.3 Who Is this Book For?Since Python is easy to learn, you do not need to master any advancedcomputing concepts before touching this book.
You only need an understanding of some basic programming principles or a scripting language,such as PHP or JavaScript, to get started with programming in Python forS60.Because of the steep learning curve of most mobile platforms, thecreative community and novice programmers have been excluded fromdeveloping their own ideas for applications for mobile phones. Webelieve that Python for S60 remedies this problem. Therefore, this bookis primarily aimed at people who are new to mobile programming, wholack the time and enthusiasm to learn C++ or Java or who cannot afford tospend weeks or months on development. Rapid prototyping with Pythonfor S60 gives them a fast entry ticket.
At the same time, many experienceddevelopers find Python a refreshingly agile alternative and may enjoy theadditional sense of elegance and freedom that it provides.We think the following groups of people will benefit from this book:•Lead users and ‘prototypers’If you want to gain knowledge and practical skill for quickly programming working prototypes of innovative mobile applications, you mayfind Python for S60 your toolkit of choice. It is open source, so youwill not be hindered by closed, proprietary platforms which severelyrestrict your freedom to experiment. If you are an enthusiastic mobilephone user who has many ideas on new ways of using your phone,we show you how to realize your own novel concepts in practice.•Mobile artists and mobile interaction designersPython for S60 will open the door for you to the world of programmable mobile phones.
As a creative media artist or interactiondesigner you might be less constrained by conventional thinking thana typical software engineer – and this is your opportunity. By usingPython for S60 to combine several smartphone features, for instance,camera, sound recording, SMS and Bluetooth, you can explore newfrontiers of art and design. If you are a designer who has worked withActionScript for Flash or Director’s Lingo and want to start creatingmobile applications, you will find Python for S60 already familiar toyou in many respects.•Web developersIf you have worked with PHP or JavaScript but haven’t used Pythonbefore, start today! Python for S60 allows you to quickly write mobileclient applications that can be part of your website or service.
Youcan also create novel mashups that combine information from a webservice with that from your physical surroundings.6INTRODUCTION AND BASICS•Experienced mobile application developersConverting to Python for S60 makes development feel light, happy andproductive while retaining your old powers. Whenever a colleaguecomplains that Python is slow or it misses feature X, sit down andwrite a C++ extension for Python in a few hours. This way, you getthe best of both worlds.•ResearchersPython for S60 is a perfect platform for doing various kinds ofresearch. It is the easiest way to collect rich empirical data withmobile phones and you can prototype novel applications quickly.Since it is open source and easily extendable in C++, you can evenperform some demanding computations on the device.
Moreover, youcan get started right away, since Nokia smartphones are ubiquitous,off-the-shelf products and Python for S60 is freely available.•Teachers and studentsIf you are teaching introductory programming classes in Python, thisbook might serve as a source of motivation and inspiration for yourstudents. The smartphone is a rich and ready-to-use platform withmany built-in functionalities such as networking, camera, graphics,image handling, GUI design, Bluetooth, telephony and more, so aplethora of concepts can be demonstrated and experimented on it.Nowadays, many students are motivated by the mobile phone, whichis an integral, personal part of their lives, rather than by a PC.
Beingable to easily ‘pimp up’ the mobile phone and learn programming atthe same time is a strong incentive even for younger students.•Python communityIf you are one of the hundreds of thousands of Python programmersand want to enter the mobile space using completely free and opentools as well as open-source code modules, Python for S60 is an idealpath for you to take.1.4 What Are Symbian OS, S60 and Python for S60?Symbian OS is an operating system designed for mobile devices. Itincludes associated libraries, user interface frameworks and referenceimplementations of common tools. As a descendant of Psion’s EPOC,it runs exclusively on ARM processors.
Symbian OS APIs are publiclyavailable and anyone can develop software for Symbian OS.S60 is a software platform for mobile phones based on Symbian OS.It is Nokia’s user interface framework that runs on all Nokia S60 deviceson top of Symbian OS. S60 is one of the leading smartphone platforms in the world. It is developed by Nokia, which licenses it to otherPYTHON TERMINOLOGY IN THIS BOOK7manufacturers including Lenovo, LG Electronics, Panasonic and Samsung. S60 consists of a suite of libraries and standard applications basedon Symbian OS APIs.Python is a dynamic object-oriented, open-source, computer-programming language.
It can be used for many kinds of software development,for instance, to create stand-alone programs, scalable server software orsmall scripts – Python’s roles are virtually unlimited. Python was createdby Guido van Rossum and is distributed under an OSI-approved, opensource license that makes it free to use, even for commercial products.Python is often used for prototyping and teaching introductory programming classes. It can be learned in a few days and offers strongsupport for integration with other languages and tools. Python comeswith an extensive standard library, thus its slogan is ‘Python – batteriesincluded’.Python runs on most common and legacy platforms, for example,Windows, Mac OS X, Linux/Unix, OS/2, Amiga and Palm OS. It alsoruns on Nokia S60 2nd and 3rd Edition mobile phones – that is wherethis book comes in.
Python has also been ported to the Java and .NETvirtual machines. It is an interpreted programming language that combinesremarkable power with clear syntax; it has modules, classes, exceptions,high-level dynamic data types and dynamic typing.Python for S60 brings the Python programming language to the S60platform. Python for S60 is based on Python version 2.2.2. It supportsmany of the Python Standard Library modules but also includes several modules specific to the mobile platform, for example, native GUIelements, Bluetooth, networking, GSM location information, SMS messaging, access to the camera, and more.
The full range is described indetail throughout this book. Nokia makes Python bindings for SymbianOS APIs that are publicly provided on S60 devices. All examples in thisbook were made using Python for S60 version 1.4.0.1.5 Python Terminology in this BookIn this book, the term ‘Python’ may refer to three different concepts (seeFigure 1.2).Figure 1.2(a) shows the Python programming language, which is thesame both on a PC and a phone, although the PC cannot access thephone’s functionalities.Figure 1.2(b) shows Python for S60, which runs, or interprets, thePython language on the S60 smartphone platform and provides interfacesto the phone’s functionalities.Figure 1.2(c) shows a Python interpreter that is used to run Python ona PC.
In some examples of this book, you need that as well.8(a)Figure 1.2a PCINTRODUCTION AND BASICS(b)(c)Three meanings of ‘Python’: (a) Python code, (b) Python for S60 and (c) Python interpreter onIn practice, almost always in this book we are talking about Pythonfor S60 and thus we use the abbreviation ‘PyS60’ for clarity. The Pythonlanguage lessons talk about Python the programming language, so theyapply on a PC as well. On rare occasions we need to run the Pythoninterpreter on a PC – in these cases we state this clearly in the text.1.6 Democratizing Innovation on the Mobile PlatformEric von Hippel, Professor and Head of the Innovation and Entrepreneurship Group at the MIT Sloan School of Management, discusses in his book([von Hippel 2005]) the phenomenon that users can generate innovationif a toolkit – based on a platform product – is provided, that allows themto create user-developed modifications that suit their own needs.
He callsthis ‘distributed innovation’ by ‘lead users’. Lead users have the followingcharacteristics:•They are ahead of most users in their population with respect to animportant market trend and so are experiencing needs today that willlater be experienced by many other users.•They know and understand their own needs well.•They are close to ‘real situations’, so the products they develop willappeal to others too.•They may innovate if they want something that is not available on themarket.Although his empirical data is collected from other fields, his argumentsaround his lead-user theory matches well with what we practicallyexperience from outcomes of workshops with creative students learningDEMOCRATIZING INNOVATION ON THE MOBILE PLATFORM9Python for S60.
We see that they innovate instantly, creating unusual andnovel applications based on their own ideas, fulfilling their own needsand enabling them to share their innovations.Can Python for S60 democratize innovation on the mobile platform?We have the vision of a big garden full of beautiful flowers, eachrepresenting a novel mobile application created by a lead user fittinghis or her own needs. Will you help to grow these flowers? Distributedinnovation on the mobile platform is possible and perhaps this book canbe a starting point to help trigger it.Let’s look now at some of the topics and arguments that [von Hippel2005] states and how they map to Python for S60.1.6.1 User-Centered Innovation Process[von Hippel 2005] explains that users that innovate can develop exactlywhat they want, rather than relying on manufacturers to act as their (oftenimperfect) agents.