Feed on
Posts
Comments

Best link of the month…

http://stackoverflow.com/questions/84556/whats-your-favorite-programmer-cartoon

In particular, the best short description of the “difficulties” in a project development

Recently, Google published the Android code  http://source.android.com/.

One of the thing annoying writing an Android project is the fact that it was impossible to have the source code attached to the android.jar, and so was actually hard to look properly at the core framework when coding.

To solve this problem is now possible  to add the Android source automatically to the project and so browsing the sources conveniently.
Here’s a basic list of steps to do:

  1. Create a directory “sources” on ANDROID_HOME directory
  2. Import into this folder the Java sources.
    Is known that Android uses Git as source control system. To import the project so type the following command

    git-clone git://git.source.android.com/platform/frameworks/base android-api

    Then copy the Java folders into the sources directory.
    If should see at the end of the process the following structures of the “sources” directory if you type the command
    ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
    |-android
    |---accounts
    |---annotation
    |---app
    |---bluetooth
    |---content
    |-----pm
    |-----res
    |---database
    |-----sqlite
    |---ddm
    |---debug
    |---gadget
    |---graphics
    |---hardware
    |---inputmethodservice
    |---net
    |-----http
    |---os
    |---pim
    |---preference
    |---provider
    |---security
    |---server
    |-----checkin
    |-----data
    |-----search
    |---speech
    |-----srec
    |---syncml
    |-----pim
    |-------vcalendar
    |-------vcard
    |---test
    |-----suitebuilder
    |-------annotation
    |---text
    |-----format
    |-----method
    |-----style
    |-----util
    |---util
    |---view
    |-----animation
    |-----inputmethod
    |---webkit
    |-----gears
    |---widget
    |-com
    |---android
    |-----internal
    |-------app
    |-------database
    |-------gadget
    |-------http
    |---------multipart
    |-------logging
    |-------os
    |-------policy
    |-------preference
    |-------util
    |-------view
    |---------menu
    |-------widget
    |-----layoutlib
    |-------bridge
    |-----server
    |---google
    |-----android
    |-------collect
    |-------gdata
    |---------client
    |-------maps
    |-------mms
    |---------pdu
    |---------util
    |-------net
    |-------util
  3. Restart eclipse and it’s done, you can CTRL+click on a class an do directly to the Android source Java

screenshot.png

    Browsing the web i found also a PYTHON script very useful to download the Android Java sources and package them into a zip file

    
    
    from __future__ import with_statement  # for Python < 2.6import os
    
    import re
    
    import zipfile
    
    # open a zip file
    
    DST_FILE = ‘android-sources.zip’
    
    if os.path.exists(DST_FILE):
    
    print DST_FILE, “already exists”
    
    exit(1)
    
    zip = zipfile.ZipFile(DST_FILE, ‘w’, zipfile.ZIP_DEFLATED)
    
    # some files are duplicated, copy them only once
    
    written = {}
    
    # iterate over all Java files
    
    for dir, subdirs, files in os.walk(’.'):
    
    for file in files:
    
    if file.endswith(’.java’):
    
    # search package name
    
    path = os.path.join(dir, file)
    
    with open(path) as f:
    
    for line in f:
    
    match = re.match(r’s*packages+([a-zA-Z0-9._]+);’, line)
    
    if match:
    
    # copy source into the zip file using the package as path
    
    zippath = match.group(1).replace(’.', ‘/’) + ‘/’ + file
    
    if zippath not in written:
    
    written[zippath] = 1
    
    zip.write(path, zippath)
    
    break;
    
    zip.close()

    The Big Question


    My friend Hubert posted on StackOverflow the Question:
    How do you ensure code quality?
    Well, not easy to answer and seems that there’s a lot of discussion here.

    My personal opinion here is pretty simple: “Code quality is a matter of continuous improvement and commitment”.

    Generally I would say it’s a matter of:

    • people

    • methodology

    • attitude

    • realism

    The team is the first step. A good team is made up of at least one very senior experienced guy capable of leading the enthusiasm of the youngers.

    Methodology.
    I like Agile approach, even if sometimes there’s a big mistake here. Agile doesn’t mean lack of documentation and architectural overview on the project!

    Attitude
    Man, motivation is for a developer is simply necessary. The more motivation you have, the more you’re capable of overwhelming the technical difficulties.

    Realism
    Don’t reinvent the wheel! Don’t loose the focus on your objectives. First get you code working and then take your time for a full re-factoring.

    New Blog, new Life

    Yes, I moved back to Italy, after a wonderful life and professional adventure in Amsterdam working for Tom Tom.

    At the moment I am living in Rome an I am working, mainly remotely, for Italian an English companies.

    Of course this blog is just for me and just to track my thoughts in the time.

    Main arguments will be of course related to technologies, but I could use it to express some ideas about the actual situation of the Italian society and politics, so hard to understand for a foreign eye (well, even for me sometimes).

    Why in English? I consider this one the natural language of Internet…so a natural language for a blog

    « Newer Posts