Category: tech

  • Sixth Sense Technology

    Just unbelievably impressive – “I want to tell you that you’re one of the 2 or 3 best inventors of the world right now” coming from a TED conference of global thinkers! Not only is this man intelligent, his wisdom is inspirational, he just wants to open source the whole thing, and wants it to be not just secluded in some lab but to reach the masses!

    ‘SixthSense’ is a wearable gestural interface that augments the physical world around us with digital information and lets us use natural hand gestures to interact with that information.

    ~ Sixth Sense project by Pranav Mistry

    (more…)

  • simplest ways of drawing UML sequence diagrams

    A picture says a 1000 words. This is quite true even of UML, the Unified Modeling Language that’s used as a diagrammatic representation of software artifacts. One of the key advantages of having a diagram is to convey a lot of ideas with a simple glance. Diagrams usually simplify one’s perspective, and can give a holistic view of the entire system where one may can instantly and intuitively see how different aspects are related.

    For some engineers, career growth may mean getting into people management – leading bigger and bigger teams of people. There are some of us who like to stay rooted in technology, and even as an individual contributor, growth of course is still inevitable. Apart from being fun, it is a fundamental necessity to avoid the decay of stagnation.

    In any case, one of the key areas we need to grow is in our ability to communicate ideas to others.

    UML provides an effective means to help us do just that. The diagrammatic notation enables engineers to communicate aspects of the entire software lifecycle, and is intuitive enough to give even those unfamiliar with the notations a fairly good idea.

    Sequence Diagrams are one of the types that depict a time based flow of events. Here’s a nice tutorial by IBM Developerworks, and another one on the agilemodeling site.

    Long long ago I used to use Rational Rose, that was a pretty cool and intelligent tool to work with UML. This usually was purchased with a limited floating license, which meant that one of us on the network had to close it in case another one wanted to use it 🙂 Once it was taken over by IBM, an organisational policy discontinued its use. An alternative we had was Microsoft Visio. This was a very very far cry from the intelligence and flexibility offered by Rose, and our average quality of diagramatic representation deteriorated to convenient block diagrams. Visio did provide good templates and support for UML, but seemed to usually be completely out of sync with any kind of understanding of what I wanted to do and quite a few times I found myself fighting with it esp for Sequence diagrams with dragging the mouse around resulting in items elusively moving around! (I found that changing some of the default settings made things easier, more info on the arcane topic available on request)

    Anyway currently I have a license for neither Rose nor Visio, so to create some sequence diagrams now, I needed to look for something new. As I’m short of time, before that I first gave Microsoft Word drawing a try (aaack even though I could find workarounds like grouping text boxes and making everything I need in one place, and kept making copies of them, this approach was still horrible!)

    Then I tried umlet( heh heh almost sounds like Omlet 😉 ) This was an excellent piece of software, I particularly liked the Eclipse integration. The amazing thing about umlet is that it converts simple text into a sequence diagram. So, all the intelligence of putting in the arrows and objects and lines is built into the software 8)

    But I got stuck with having no control of object lifelines. The diagrams could be exported as JPG, and I was almost prepared to get into jpg editing using something like Paint (ugh) but luckily found another tool on the net: Quick Sequence Diagram Editor (sdedit).

    This was conceptually similar to Umlet, where we enter text and it generates the diagram. But this one was soooo amazingly cool and elegant, using it made me feel like I was literally falling in love all over again! What a lovely piece of software, it definitely saves me tons of time and effort, and especially provides a lot of maintenance and flexibility!

    It could be added as an Eclipse plugin as well, I’m sure lots more people would benefit from that added convenience (just a thought, though its good enough for me right now as it is as a standalone).

    Try out both these tools, and see which one you like. What follows are just some more details.

    One roadblock I hit in sdedit was what seemed to be an inability to specify something that’s being returned – but after a while looking closer at the comprehensive example, it turned out I could use an = sign to display that text. Another problem was that export to JPG resulted in a red tinge (I even tried to explicitly set a white background going to options while exporting, still same output). But export to GIF was perfect (white background). Calling a self-message is forcing an additional return value that comes at the end.

    When I’d compromised on that minor annoyance and settled down for this one, I was about to close my umlet window when I suddenly figured out the reason for the lifelines. With every line of text, one needs to put the lifetime of the object to be extended for that one line in a comma seperated list (in the examples there were only two values).

    It looked like Umlet is more sophisticated and customizable, while Sdedit text is more lightweight, elegant and readable.

  • a bit of refactoring

    In software engineering, “refactoring” a source code module often means modifying without changing its external behavior, and is sometimes informally referred to as “cleaning it up”.

    In particular, adding new behavior to a program might be difficult with the program’s given structure, so a developer might refactor it first to make it easier, and then add the new behavior. Refactoring is also a tool for removing bad code smells that exist in code.

    ~ Refactoring

    what is refactoring?

    Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. Its heart is a series of small behavior preserving transformations. Each transformation (called a ‘refactoring’) does little, but a sequence of transformations can produce a significant restructuring. Since each refactoring is small, it’s less likely to go wrong. The system is also kept fully working after each small refactoring, reducing the chances that a system can get seriously broken during the restructuring.

    ~ Martin Fowler’s site on Refactoring

    Sometimes code gets messy over time, and investing some time not developing something new, but simply refactoring what already is there, really reduces a lot of time in maintenance results in a significant boost to productivity.

    But the most common obstacle for refactoring is “I’m too busy to do it!

    And so, given a programming task on some old complicated source code, there are two options. One is to straightaway start with the task – wrangling with timelines, struggling to debug and decrypt the code in order to complete a given task. An other is to spend time in refactoring and sorting things out first (with test cases) and then actually start with the given task. Of course there’s no ‘best’ solution but it depends on the situation.

    The first one seems to be the easiest. The second option may require some courage – because there seems to be the somewhat overwhelming risk that it might affect the entire system, introduce new bugs, end up as a dead investment if the refactoring cannot be completed succesfully… all kinds of difficulties!

    Socrates had said…

    An unexamined life is not worth living.

    Not sure exactly what he might’ve meant, but one guess is that he could be talking about refactoring one’s life.

    I’ve actually done that gradually over the past year or so, and have found that it has tremendously improved the quality of my life.

    For example, a lot of time was being occupied in driving around in traffic. I took up a new job (not the only reason of course) and moved to a new house to live in. Now my new workplace is just 15 minutes drive from home. This is not a single drastic event but happened gradually over time.

    One more thing is I gave up ambitions of climbing the corporate ladder gaining a better and better position, to lead other people and so on (and earn higher and higher salary of course!). Instead, I decided my priority was simply to become a “good developer”. Btw this is below the dignity of a lot of software engineers, because compared to a construction industry, programming is like the basic cementing job which freshers from college do. At first this seemed to be a total lack of ambition. But this makes me happy, and I have any interest in impressing anyone with a sophisticated designation 😉 And my new job respects this attitude.

    Another idea is that 4 to 7 PM is the most beautiful time in the evening, best spent roaming around in a park or on the terrace watching the sunset with my son, instead of sitting in front of a computer. Since I have an option to work from home (depending on the project team situation), I often leave for home around 4 PM and really have a nice outdoor evening either on the terrace. continue working from home when it gets dark. This balances working with the rest of the team in the office, and has an added advantage that it also gives me some extra overlap time with my American colleagues.

    The above ideas worked well for me. There are some other things I tried which didn’t work out. But I’m glad I did give them a try, and experimented with life.

    Maybe you may not have the same opportunity (to work from home, for example) but you may have other even better possibilities, if only you would examine with a fresh perspective. I would love to hear your experience if you’ve want to try/have tried out anything new.

    One thing that this speaker he himself is a world traveller travelling all over the place meeting so many people all over the world… had said “I pity you, you meet the same people – same family members – same colleagues – day after day” But I disagree (and also possibly disagreement was a reaction the speaker hoped to provoke). As long as one manages to avoid getting caught in a mechanical daily routine, one can see the newness in every day and in every person around them! 😎

    It made a lot more sense to begin with whatever I have, instead of wishing for something else. I started becoming more sincere about whatever I was doing, including my job. So rather than begin by changing external circumstances, I looked at how I could change the way I was handling them. The external changes happened as a natural consequence, without too much effort.

  • grails – hasMany does not generate dynamic properties

    This is a technical post, I should probably create another site for such things.

    Just want to document some problems I came across while trying out some examples from The Definitive Guide To Grails…

    class Bookmark {

        static hasMany = [tags:Tag]
       
        URL url
        String title
        String notes
        Date dateCreated = new Date()
    }

    class Tag {

            static belongsTo = Bookmark
           
            Bookmark bookmark
            String name
    }

    b = new Bookmark(
            url: new URL(‘http://grails.org’),
            title:’Grails’,
            notes:’Groovy-based web framework’)

    b.addTag( new Tag(name: ‘grails’) )

    b.save()

    These simply did not work, giving the error MissingMethodException, and basically the dynamic methods just weren’t being generated.

    To cut a long story short, here are some things that solved the problem:

    – In the Groovy plugin for eclipse – Eclipse->Project->Properties->Groovy Project Properties->Turn of the Groovy compiler.

    – Disable automatic build in Eclipse, which generates unnecessary classes, that overwrite the groovy dynamically generated classes.

    A cryptic error while running from Eclipse :

    Cannot execute native2ascii failed.
    This can be resolved by running grails runapp once, which does the conversion of native to ascii initially.

    Most of the above solutions were at nabble.com though it still involved quite a bit of searching!

    If these issues are not sorted out in the development environment,
    then one may consider using Eclipse only as an editor, using the command line for grails!

    A key point is that the hasMany relationship has been revised as described in GORM – Defining relationships, making addTag deprecated, changed to addToTags

    In case anyone has just typed in the code into a groovy console, it might not work as the classes should be defined as proper domain classes using create-domain-class target.

    Having programmed for over 10 years in C, C++, COM, DCOM, STL, MFC and .NET right from its pre-beta stage of evolution, as well as Java right from 1.0 in college days, I find Groovy on Grails defining the future of technology. Its based on a very impressive solid foundation (of JVM, Hibernate, Spring) Want to write in more detail later sometime but anyway there’s already enough available out there already!

  • the future of work has arrived

    A hotel is not just a place where travellers sleep, but a United Nations in miniature.

    ~ Theodore Zeldin’s muse on The Future Of Work

    I’ve found the same applies to a software company as well, and I’ve found it more in my own company nowadays – this happens to be one of the key reasons why I’ve enjoyed working here for over 5 years so far. I’ve been able to actually put the above into practice to a reasonable extent, as a lead for a global project where I interact with different people around the world every day. Of course there are some tough exchanges as well when things don’t go well. I’ve found that honesty and openness go a long way in establishing trust and relationships both in professional and home life.

    Not sure if what I’m saying sounds over-idealistic, but to highlight that it actually can happen, here’s an example… (name obliterated for privacy reasons)

    discussion

    The above analogy for a waiter in a hotel could apply to an engineer as well, an engineer could be a peace missionary, promoting global happiness –
    how cool is that!! 😎

    The future of work has arrived, is now here! 🙂

  • software architecture revisited

    This is a very old writeup from a few years ago from my older website, which I came across recently again, and am reposting here… Now I have a lot more to say about this topic… but just putting in the old one for now…

    Once in a way, I feel software might be a career just to make money while the opportunity is there and then retire and do something else. Especially when we consider the well known related problems such as RSI, eye strain, back injuries, etc. not to mention the vast environmental pollution (plastic CDs, DVDs… esp now with rewriteable use and throw ones).

    After all, its sometimes hard to answer the question: how is this helping anybody or improving anybody’s quality of life? How does it make it matter to be involved in this application to keep track of a warranty of some printer that some customer had bought whom I personally dont even have a clue about. Surely there must be more worthwhile investments of time than this? Especially when you compare this with something like for example the medical profession, where doctors cure people’s diseases – or physicists who study about the our universe itself, or come up with something tangible that people actually do something with rather than sit glued to a computer monitor all day…

    In “Black Holes and Baby Universes and Other Essays” by Prof. Stephen Hawkings (reknowned scientist and author of A Brief History of Time), he says after a disease and a surgery he was paralyzed, speechless and completely immobile. He still wanted to continue his research.

    His communication was reduced to a person flipping through alphabets, and he would raise his eyebrows for the required one. He would write sentences this way – very very slowly.

    Then a software programmer sent him a device which would act similarly, and he could use his finger to indicate when the letter was reached.

    This was such a breakthrough that its evolution was inevitable… a laptop was replaced by a PC embedded into his wheelchair making him mobile. A screen was eventually replaced by a voice synthesiser – allowing him to speak again!

    This man written off by medical science, has been able to go on giving countless speeches all over the world!

    Ultimately it does come down to people who actually using whatever we are working on, who could be adversely affected at some other point in time and space in a manner in which we simply cannot imagine now, if we treat what we are doing right now even with the slightest negligience or indifference. But we get so bogged down with the technical details or stress or distractions or so on, that this very key aspect often gets totally forgotten.

    Incidents like the one related by Hawkings was a kind of a reminder to me on why I joined this industry in the first place… a belief that software, like everything else, does have its own place in the great scheme of things! 🙂

    ——————————————————————————–

    Some links… (with thanks to those who sent these)

    The Software Pyramid

    Its interesting what it says about Architects : “A few thousand visionaries sketch out entire systems to handle complex jobs.”

    Anyway on a different note… this is a beautiful relevant article … a MUST read for anyone with technical aspirations 🙂

    .NET Brings the Architect to the Fore
    As .NET helps advance Microsoft technologies in the enterprise, the role of the software architect becomes increasingly important.
    by Eric Lynn

    Other links…

    This article from Deccan Herald I particularly liked :

    Upgrade yourself from the world of coding
    How does one build a successful technical career? SUBROTO BAGCHI gives nine key factors.

    Passion at work by Prof. Arindam Chaudari

    The following I’ve meant to read but havent actually really read till now 😉 But have gone through them, they look quite promising, maybe worth bookmarking…

    Thoughts and experiences from an enterprise software architect – Jorgen Thelin

    Microsoft Architects Journal

    Independent analysis of Microsoft

    It all comes down to 1s and 0s

  • agile development links

    Having worked mostly in the waterfall software development cycle and just venturing into the agile world – these were quite interesting links…

    Refactoring database

    Agile Model Driven Development (AMDD): The Key to Scaling Agile Software Development

  • develop debugging skills playing Mastermind

    This was one of the really cool tips from Steven’s presentation. I used to play this game in my childhood when my cousin sister had gifted us this from the US. Now I am sometimes apalled when I see developer’s struggling to find simple problems in any code, and was wondering how I could help them improve this skill.

    As Steven (SQL training program) highlighted, this game really develops one’s debugging skills, and he strongly advocated this for every developer to play even at company time 😉

    You can give it a try – it’s simple, and I could find a nice one online.

    Below are the rules from google…

    —–

    Object of the Game
    The computer picks a sequence of 4 pegs, each one being one of any of six colors.
    The object of the game is to guess the exact positions of the colors in the computer’s sequence in as few guesses as possible. After each guess, the computer gives you a score of exact and partial matches.

    Rules
    1. The sequence can contain pegs of colors: red, yellow, green, blue, white, black
    2. A color can be used any number of times in the sequence.
    3. All four pegs of the secret sequence will contain a color – no blanks/empties are allowed.
    4. Each guess must consist of 4 peg colors – no blanks.
    5. You have 8 guesses to find the secret sequence.

    Scoring

    For each of the pegs in your guess that is the correct color and in the correct position, the computer will give you one small black peg to the right of that move. If you score 4 small black pegs on a guess, you have guessed the secret sequence.

    For each of the pegs in your guess that is a correct color in an incorrect position, the computer will give you one small white peg to the right of that move. Together, there will be no more than four small black and white pegs for each move.

    If none of the pegs in your guess is of a correct color, you will see no small pegs to the right of that move.

    Sample scoring:

    If the secret
    sequence is…
    And
    your guess is…
    Your score
    would be…
     
     
       

    Some detailed instructions if you like:

    http://www.pressmantoy.com/instructions/instruct_mastermind.html

  • Steven Feurstein's PL/SQL resources

    Steven may not have been a rock star but his presentation on PL/SQL Best Practices definitely ROCKED! Its been the most entertaining, informative and positively INSPIRING tech talk I’ve ever attended (and believe me, with 10+ years in the IT industry I’ve attended quite a few and given some of my own as well) 🙂

    I really really wanted his slide set to convey all those high quality ideas to my team mates in office, and was delighted to see he’s so generously put them on the net: SQL Training and presentations (Unfortunately I had some trouble downloading a couple of them) Though I took down a lot of notes, I just cant wait to get my hands… er mouse… on the main thing! 🙂

    His presentation really changed my perspective of PL/SQL programming, and the best part of it was packed with so many invaluable insights beyond the core topic!

    What really impressed me was the huge contribution he was making to the industry in terms of books, open source tools, presentations and other material which he’s made freely available on his website – enriching the quality of his own life as well as everybody else’s. At dinner time I asked him for an autograph, and he wrote me some very nice words “Dear Sanjay, May your code bring peace and satisfaction” 😎

    —-

    Also see: His younger sons art website: Chris Silva and don’t miss the artistic statement – just to appreciate the quality of life that’s possible.

  • SQL code generators

    The below are excerpts from a couple of websites…

    ——–

    We all know the drill: Don’t reinvent the wheel. Re-use code. Rely on libraries of pre-built code. And yet so few of us do it. One way to avoid “deja code”, that feeling you’d written this algorithm before, is to generate code rather than write it manually. Code generation offers tremendous promise, in terms of both productivity and code quality.

    Improve productivity and code quality with QCGU

    PL/SQL developers spend lots of time writing the same kind of code over and over again, much of it based on the underlying tables, views and programs with which we are working. To save time, we frequently take a “quick and dirty” approach, which is often incomplete and error-prone.

    QCGU offers a new approach: choose a template from the QCGU repository (or build your own) that reflects the pattern of code you want to write. Then run that template for a particular database object (usually a table or a program). QCGU will then generate the code in a fraction of the time you would need to write it yourself.

    You can think of QCGU as a “design pattern factory,” allowing you to generate virtually any sort of code you want (not just Oracle PL/SQL!). But of course most developers aren’t going to sit around writing patterns. You will most likely take advantage of QCGU in one of the following ways:

    1. Generate table API packages (packages that contain procedures and functions that perform most commonly-needed SQL operations). Specifically, QCGU generated three packages: the Change Package ([tablename]_cp) to perform DML; the Query Package ([tablename]_qp) to perform queries; and the Type Package ([tablename]_tp) to provide pre-defined declaration types. You then call the appropriate program in your application code and skip writing the SQL!

    2. Utilize the QCGU error management framework. QCGU utilizes in its table API packages a standard error management package named qd_runtime, which in turn writes to the log table (qd_log) and error tables (qd_err_instance and qd_context). You can use this same generalized error management framework in your own applications.

    QCGU is FREEWARE! Quest Software invites you to take advantage of this powerful tool, but it offers no support for this product. Instead, press the Support tab on the top of this page and follow the link to the online community, where other users of QCGU will help you.

    http://www.qcgu.net/

    Also see:

    http://www.stevenfeuerstein.com/puter/gencentral.htm

    Cheers,
    Sanjay

    PS: Note that installing qcgu creates a lot of tables of its own in the schema.