The Qt/QML User Story Redux

A while ago I posted one version of a QML user story. But that term is quite vague, and so here’s the other ‘user story’ which came to mind. Since it uses APIs new in 5.1, it was delayed to allow those APIs to stabilize.

The Qt/QML User Story

Once upon a time, Ada Ziner was sitting at her desk unware that she was about to become… a QML user. That day a typical assignment was assigned to her. The next version of Megatech’s flagship software product was to sport a shiny new cross-platform UI. It was to be as smooth and fluid as butter on velvet, it was to run on every device the user touched, and it had to be such a joy to use that it could be resold as a cure for clinical depression (the core market segment was declining, so the board wants to start branching out). To top it off, her deadlines were:

  • Tomorrow [Tuesday]: Submit concept for management approval
  • Friday: Deadline for management response
  • Monday: Final concept provided to application development team
  • Tuesday: Final graphical asset drop
  • Wednesday: Final audio asset drop
  • Thursday: Final olfactory and tactile asset drop
  • Ada knew of only one way to meet these goals. She would have to learn Qt’s Mythical Language: QML. 15 minutes later she had done so, and began to prototype all of her wild and wonderful ideas. At the end of the day, she showed a colleague her concept application. He was immediately brought to tears by the elegance, the beauty and the simplicity. Then she hit the “run” button. As the application sprang to life gasps of amazement drew the whole office to watch. After receiving a standing ovation, Ada sent it off early for management approval and went home. Late Friday afternoon, an ascii-art thumbs up arrived from the VP of concept permissions. So Ada polishes off the concept app and hands it off to the app dev team. The concept milestone is achieved with ease, but the very next day…

    From: Senior Applications Developer Team Lead Architect Bob Smith
    To: UX Lead Ada Ziner

    Hi Ada,

    Got your concept yesterday, and it looks great! One problem though: your design seems to involve moving pixels around the screen. Our GUI framework isn’t very good at that, so you’ll need to redesign your concept without any pixels changing color while the app is visible.

    Thanks,
    Bob “For Apples” Smith


    The preceding email is proprietary information of Megatech and is not to be shared. By reading this email you are bound by an NDA between you and Megatech stating that you shall not communicate the secrets within this missive in any form, including but not limited to electronic text, song, interpretive dance, and fortune cookie messages. By entering into this agreement with Megatech you also are bound not to assert any patents or other intellectual property rights against Megatech on subjects relating to the content of this message. This message may contain forward looking statements or personal opinions and should not be constructed to be statements of fact issued by Megatech. All jurisdiction of legal challenges against this agreement will take place in the court of Greenland. THE ABOVE EMAIL COMES WITH NO WARRANTY, NOT EVEN THE IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR USE. ANY SECTION OF THIS CONTRACT FOUND NOT TO BE ENFORCEABLE DOES NOT INVALIDATE THE REMAINING SECTIONS. IN SOME JURISDICTIONS, YOUR FIRST-BORN CHILD MAY BE USED AS COLLATERAL.

    Ada was incensed. The movement in that app was choreographed, down to the pixel, against a 1879 Russian ballet by the great Yuri Strogganov. Even when the controls were not in motion, subtle variations in color guided the users attention by forming pulsating arrow heads all over the background.
    Fuming, she went to get a cup of coffee. When she got back…

    From: Senior Applications Developer Team Lead Architect Bob Smith
    To: UX Lead Ada Ziner

    One other problem. I didn’t notice before (BTW: thanks for making it color-blind accessible 🙂 ) but apparently you’re using non-primary colors. Our graphics framework only provides the primary colors of red, blue, and green (no black or white except for text). You’ll have to rework your design using just those.

    Thanks,
    Bob


    The preceding email is proprietary information of Megatech and is not to be shared. Megatech respects the environment, and recommends that you avoid printing this email unless strictly necessary. Please print and file a copy for your records, as technical difficulties will not be accepted as a reason for not being able to reproduce this email upon request. If you have received this message in error, please run our disk wiper at http://megatech.com/utilites/killme.aspx. Due to the asynchronous nature of email, all text in the above email is subject to the following forward-looking statements disclaimer: Under duress, Megatech occasionally makes forward looking statements of a speculative nature, such statements are not known by Megatech to be fact, and should not be construed as financial, legal, or relevant advice. Forward looking statements should not be taken as an indicator of possible company or stock performance in the future, and trading in Megatech stock after receiving this email may be illegal. Forward looking statements may contain reference to events which do not actually happen, take care when making scheduling considerations based on the contents of this email. Forward looking statements cannot be proven to be safe, are for external use only, and reading this email is not recommended if you are pregnant or intending to become pregnant. All jurisdiction of legal challenges against this agreement will take place in the court of MegaTechLandia. Plaintiff is required to pay all court fees, including possible set-up costs necessary to construct the nation of MegaTechLandia. THE ABOVE EMAIL COMES WITH NO WARRANTY, NOT EVEN THE IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR USE. ANY SECTION OF THIS CONTRACT FOUND NOT TO BE ENFORCEABLE DOES NOT INVALIDATE THE REMAINING SECTIONS. MEGATECH RESERVES THE RIGHT TO CHANGE THE TEXT OF THIS AGREEMENT AT ANY TIME. YOUR EMAIL ADDRESS HAS BEEN LOGGED FOR NOTIFICATIONS OF AMENDMENTS TO BE COMMUNICATED TO.

    Ada’s screams of frustration quickly drew a crowd. After explaining the situation, someone within the crowd chimed in: “Your concept app felt really close to a finished product, and the backend team is in our timezone. Maybe you could work directly with them?”
    “Can’t be any worse than redoing it with red rectangles…”
    So Ada looked up the number of the lead backend developer, dialed it in, and heard: “This call cannot be placed due to the administrative policy for this office. Please contact your manager to request an exemption.”

    The next day (her manager required all meetings to be booked 24 hours in advance), Ada was in Phil’s office. It was an austere and chilling place, decorated with nothing but the name: “Phillip Henry Burgersson” adorning the door, desk, and numerous plaques on the wall. Phil started talking the instant that Ada sat down.
    “Great to see you Ada, I’m just here to facilitate your work so please tell me what’s getting in your way.”
    “The phone system says than I’m not allowed to contact Mr. Jensen, and I got a similar message when I tried to email him. Both messages told me to seek an exemption from you.”
    “Who is Mr. Jensen? This is a work-related call, right?”
    “Yes. Jens Jensen is one of our employees. He’s the lead backend developer and I need his help with project Unicorn.”
    “Ah yes, project Unicorn. Mr. Smith has contacted me expressing concerns about your performance on this project. ”
    “Wha…?”
    “Yes, he says a satisfactory concept for yesterday’s milestone still has not been delivered. You being late with your work is having a ripple effect that delays the whole company and costs us billions! Hang on, I have a slide show about that somewhere…”
    “I need to speak to Mr. Jensen to continue my work. Grant me an exemption and I can get the project moving again.”
    “I’m afraid I can’t do that Ada. Strict adherence to process is what keeps us ahead of smaller, less developed companies. Here, I’ll show you the slide show on that…”
    Phil pressed a button on the wall and the slide carousel shelf slid out. But as soon as he turned around to get the slides out of his cabinet, Ada jumped up and slammed the shelf switch again. “I don’t have time to sit through a slide show! I need to get back to project Unicorn and for that I need to speak to Mr. Jensen. Now is there anything you can do to ‘facilitate’ that?”
    Phil leaned back in his chair. “Ms. Ziner, we have processes for a reason. In this case I happen to have chaired an executive seminar on the subject, so I can explain it to you from an expert perspective (since you’re in a hurry, the summary instead of the slides). It is no surprise that the vast majority of internal leaks come from employees. Our plans and our intellectual property are our competitive advantage in the rapidly-shifting paradigm of modern business. To safeguard this advantage, we must control all flows of communication from within the company. This means more than just the 24 hour video surveillance on the premises (don’t worry, I’m not authorized to view the feeds from the ladies room). It also means preventing all communication which is more likely to be subversive than authorized. The work flow at this department is clear: we provide designs to the app dev team. We don’t need to be able to communicate with other units. This ensures that we can’t leak details like what the finished product will look like, as we never see anything remotely near production quality. Nor can we talk to anyone who might. And this helps the company maintain its current market position.”
    “So if I need information from the backend team, I should go through the app dev team? ”
    “Don’t be silly. They probably can’t talk to the backend team either. Only key executives know the full communication map. Of course, they aren’t permitted to divulge this information. ”
    “So what can I do?”
    “That’s what we pay you to figure out. Just be proactive and remember to think outside the box! Now please return to your cubicle.”

    On the way back to her cubicle she had an ‘out of the box’ idea. As she passed the accounting department, she noticed fliers hyping up a special promotion where work-related communications would be reimbursed this month. So Ada crossed the street and called up Mr. Jensen on a public telephone.
    “Hello?”
    “Hi, is this Mr. Jens Jensen?”
    “Yes, backend dev lead for Megatech.”
    “Great. I’m Ada Ziner, Megatech’s UX architect.”
    “You’re another employee? Did you find the back door we snuck into the PBX?”
    “The what? I’m just calling from a pay phone.”
    “A pay phone? Why didn’t we think of that? That hack took months…”
    “Anyways, I’m calling about project Unicorn, have you heard of it?”
    “Maybe. They randomize code names internally to prevent leaks. I’m working on a project ‘Corni-un’ which they said was french for ‘awesome one’. It’s the first mobile version of our flagship app, sound familiar?”
    “Yep, that’s the same project. I’m trying to extend my concept app. Can you help me hook up some real functionality in it?”
    “Sure, I’ll send you the server APIS and a dev token. Which API do you want? We have SOAP, COM, XMLRPC…”
    “Uh… I use QML?”
    “Perfect, I’ll send you our QML module then. It’s our favorite for internal testing so it should work great. I’ll also send you some examples set up with your dev token already.”
    “Great, thanks!”
    “No problem! And just dial 1337 first to get around the internal phone blocks next time.”
    “Okay, thanks again”

    And the very next day Ada had turned her concept application into a fully functioning version that was ready to ship. She had to leave her phone off the hook that morning because Phil kept calling her (apparently the app dev team were now extremely concerned that the olfactory assets wouldn’t make the deadline). After she finished, but before she put the phone back, she started to think about how she could explain a finished application to the company. She had gone against her instructions, against all established process and even against specific orders from her boss, except the “Don’t you dare hang up!” from six hours ago. It was so much that she worried singlehandedly saving the company might not be enough of a boost for her to survive the fallout. So she went to talk to ‘Survivalist Sam’.

    Sam was a bit of an enigma in the office. No one knew what he did, and he never went out to lunch, preferring instead to subsist on the edible fungi and lichens which he grew in his cubicle. All people knew was that Sam had survived every reorganization and layoff found since the office was purchased from a hair salon, and Sam along with it. If anyone knew how to survive the political consequences of this bold move, Sam would. As she approached, she saw Sam practicing his swordsmanship in the corridor.
    “Uh, does HR allow you to swing that around in here? ”
    “As long as it’s safe” he replied, showing off a current electrical testing sticker on the hilt. “Eliza isn’t in her office today, have you tried reaching her in online chat?”
    “Actually Sam, I came to see you. I was hoping you could offer some advice as I take a politically courageous move.”
    “My advice is not to make a courageous move, preferably no move at all.”
    “I’ve already done it, and rewrote the app from scratch, but now I’m worried that it, or I, might not survive.”
    “Ah, you used QML didn’t you? In challenging the status quo it truly is the Quest Making Language. You will now need to fight those who are jealous of your power and covetous of your product.”
    “Literally fight?” she asked, eying the sword.
    “Oh no, I just like using metaphors to make the office exciting.”
    “We wouldn’t need metaphors for that if we all just used QML!”
    “I know. That is the future I hope to see before I retire. But it takes young heroes full of passion and courage, like you, to overthrow the old empire and bring joy to software development once more.”
    “Okay, so how do I fight for this?”
    “The good fighters of old first put themselves beyond the possibility of defeat, and then waited for an opportunity of defeating the enemy. You must go now, secure and backup your source code. Return when it is safe.”

    So Ada raced back to her cubicle on an office scooter. There she found duplicitous IT gremlins disassembling her computer. “What the devil…”
    “Sorry miss, but corporate security believes this computer contains sensitive information. We have orders to take the hard drive for forensics.”
    “But all computers in the office have sensitive information! There are several paragraphs to that effect on every login screen!”
    “I know, but our orders come straight from the grand vizier.”
    “We have a grand vizer?”
    “Actually he’s the senior vice president of the vizering department, but he signs all his emails ‘Grand Vizer’. Ah, there’s the hard disk.”
    Just as his assistant passes him the disk drive, Ada reaches over, grabs it, and hurls it into the adjacent electromagnetics test chamber.
    “Damnit, that door is supposed to remain closed at all times. Okay rookie, take off all your metal and go get it.”
    The IT assistant grumbled something as he started to take off his zipper suit.
    “Hang on”, mused Ida, “that hard drive is now wiped. Why do you still need it?”
    “Orders are to bring in the drive. Nothing was said about the contents, and the last guy to ask questions was sent on a business trip to Siberia. ”
    “Okay, have fun with the blank drive” said Ada. As the IT rookie, now in his underwear, started to remove his piercings, she added “can he do that somewhere other than my cubicle?”

    As soon as the IT guys had left, she raced home and downloaded the backups from cloud storage. But she knew that it was only a matter of time before that service was compromised. “Surely someone else has run into this problem before” she thought and, lo and behold, there was already a thread for this on the Qt devnet. It even had a link to a site that shipped usb key plate mail. So she put her source code on an encrypted usb key, girded in steel, which dangled on a chain from her neck. Her cloud backups moved to a QML based file locker with the tag-line: “The safest place in cyberspace.”

    The next day she returned to Sam. “My code is secure,” she said, one hand tightly clutching the armored-usb-drive-amulet. “What is next?”
    “Is it truly secure?” intoned Sam ominously, as he pointed behind her. Two men in black suits, with black leather briefcases, were waiting behind her. “Ms. Ziner, we’re from the app dev unit. Enforcement division. Is it true that you’ve been doing app development in direct violation of established process?”
    “Maybe…”
    “Ms. Ziner, I need to warn you that unauthorized app development is a serious breach of company policy.”
    “This was authorized, it’s part of project Unicorn.”
    “Impossible. Project Unicorn app development was assigned to the app dev team.”
    “I’m helping them out.”
    “Unfortunately, company policy does not permit inter-unit assistance. I’m afraid you’ll have to hand over your code.”
    “No!”
    “I’m warning you, employee 24601, if you do not surrender the contraband code immediately I will be forced to terminate your participation in the ‘Fun times at work’ program.”
    At the point the second suit jumped in, “You really don’t want that! You’ll no longer be eligible for all the fun-time perks, like casual Sundays, candy apples on Halloween, and your yearly session with Bongo (the corporate clown).”
    “Do your worst”, spat back Ada.
    “Very well. The maximum penalty I can award is a six month suspension from the fun program. But for so flagrant an abuse, I’m going to request an extension… to eight months. Unless you hand over the code now.”
    “No.”
    “Pretty please with sugar on top?” asked suit #2.
    “Still no.”
    “Damn. That never failed before. We need a new plan, but don’t go anywhere. In 16-22 months we’ll return to requisition the code again. ”
    As the two suits walked off, Sam stepped back out of the shadows of his cubicle. “Your project is secure, for now. Next you must defeat the undead, ogres, and hydras to secure your place as champion before the three headed giant.”
    “Those are some pretty colorful metaphors.”
    “I wish. You’ll need the sword now.”

    So Ada took the sword and walked down the road to the center of the corporate campus, where the executives worked in their black castle. After she crossed the plasma moat, the suits of armor at the portcullis advanced and lowered their halberds. These were no ornamental suits of armor, inside were the elite life guards of corporate security. There was an uneasy silence as they examined the hologram on her corporate id badge, but eventually they raised their polearms and allowed her to pass. She had only taken a few steps forward before they stopped her again. “Wait…” echoed out of the metal suit, “let me see that sword.” Ada extended the sword to him, hilt first, but he did not take it. He just peered over at the test tag, “Safety check current, okay go on in.” Once inside she knew exactly where to go, as a map of this building was a task for one of her junior designers last month. She immediately recognized the giant crayon diagram being displayed on the wall, and walked straight up to the office of the Senior Executive Vice President (SEVP) of product development.

    “He should know about the ‘three headed giant’, or at least give me a real description of who I need to show my app to”, thought Ada as she climbed the hundred stairs to the top of the tower. When she approached, an administrative assistant waved her through. “Go right on in, they’re expecting you.” As she entered the massive office, she finally understood what Sam had meant. Sitting behind the largest desk Ada had ever seen was the SEVP, with his three heads. One speaking, one sleeping, one eating. At the table in front of the desk were assembled the other teams who had written a version of the product, and now SEVP Tom-Dick-Harry had to choose which one to take to market. The other teams included Bob Smith, a terrifying ten foot ogre whom Ada did not recognize despite their many emails. The old Unix team, a skeleton staff who had not changed their code since before Ada was born. And the CTO, flanked by his R&D hydras.

    The doors behind her slammed shut. “No one will leave this room”, boomed the SEVP, “until we have decided which project to release”. The grey haired leader of the Unix team got up and walked over to Ada. He was the only member of that team with hair still left, but like the rest his flesh had long since rotted away, leaving only the skeletal body of an undying liche lord. “Surely, you are too young to be a team lead”, he croaked as he approached. “How old are you, child?”
    “My age isn’t relevant here”, snapped Ada, “demonstrate your app or get out of the way”.
    “Patience child,” murmured the liche, “we’re still looking for a phone line so the modem can fetch some more data. Rome wasn’t built in a day you know.”
    “Well, QML was!”, and with this remark Ada raised her sword high. Invisible runes on the surface of the sword began to glow, and they read:

    MagicSword {
        enhancement: 5
        class: "sabre"
        bonusVs: target.subType
        HolyAura { deity: Locale.denomination.deity } 
    }
    

    The glow intensified, until the Quintessential Magical Light turned the liches into piles of smoldering ash. Again the SEVP’s voice boomed out: “Cancel that order to find a 1200-baud modem”.

    Filled with the confidence born of QML usage, Ada advanced on the hydras. While his pets salivated behind him, the CTO remained cool. “Very impressive Ms. Ziner. But a fancy new programming language can’t stop me. Cancel any one of my open-ended research projects, and three more rise to take its place. All claiming to incorporate your new technology. You cannot defeat me.”
    “I don’t need to defeat you. Take a closer look at the sword.”
    As the CTO and a dozen hydra heads peered at the faintly glowing runes, Ada reached her stride. “This isn’t just another new language. This is QML, the Quiescent Modern Language. It will revolutionize your research, and transform the nature of app development. If I, a humble designer, can produce a viable app contender; what else might the future hold?”
    “Oooh, let’s try it!” echoed all the hydra heads in unison. “Go on. Wield QML.” said Ada as she relinquished the sword. As the CTO grasped the sword firmly in his hands, the monsters behind him turned into a pair of beautiful princesses. “Whoa, dude” he exhaled.” I’ve got to try some more of this”. As he turned away, he said “but we’ll be back for the next version.” And without further ado, the three of them sprouted angelic wings and flew out through the window.

    Only Bob was left, and he chuckled with that deep, throaty chuckle that only ogres can do. “Without your sword, how can you possibly hope to defeat me?”
    “I need not the sword, for I have the true QML right here”, and she brandished the usb-amulet. “I’ll face you head on, show both our apps to Tom-Dick-Harry and may the best app win.”
    So the stage was set. The Tom and Harry heads each looked at a monitor, and the Dick head would adjudicate. At the same time, the two apps were launched on their respective screens and the results were dramatic. The Tom head, who was looking at Bob’s “Red Rectangles on a Green Background” immediately poked both his eyes out. It was unclear whether his screams of “kill me!” were from the pain of that violent act, or from the memory of what he had seen on screen. In contrast the Harry head, watching Ada’s app, was still giggling half an hour later as he continued to play with the main menu screen. In the intervening time, the Dick head had easily reached a judgment after a brief Q&A with the developers. “First question to you Bob: Why is there no text? It’s entirely colored rectangles.”
    “Yeah, text is hard. We didn’t have time to do text for this version, but it should be there for the next major release.”
    “Next question is for Ada: Will you marry me… to your application?”
    “Sorry sir, but I’m not ordained.”
    “Very well, then the most I can do is marry the company’s future to it. This will be our next flagship product. In the immortal words carried down in this company for generations: ‘Ship it!'”. And the company rejoiced. But the very next day, Ada received a summons once more to the black castle…

    The knights at the moat kneeled in her presence now, and a giant eagle was assigned to personally fly her straight to the top of the tallest tower, which had no access save flight. There stood the CEO’s office, and he had summoned her for a face-to-face meeting of urgent import.

    The CEO was a confident and strong looking man in his mid-fifties, with a full head of silvery grey hair which was done up in the style of a spiked mohawk. “Thank Goodness you’ve come Ada, I need your help.”
    “It is my pleasure, sir”
    “Please, call me Cee. Like all big multinationals, the goal of Megatech is world domination. Your amazing new app has already helped us greatly, but success is a double edged sword. Our troops now control most of the southern hemisphere and one third of the north. However, a large group of companies have formed a coalition against us. Look out the window.”
    “My god, is that…”
    “Yes, the coalition has combined their headquarters into a giant mech and strapped guns to it. The castle is under siege. If you stopped by your office this morning, you may have noticed that it was now strewn across the continent in scraps of rubble no bigger than your fist. Now you know why. We have only one, last hope…”
    “Of course! With QML, anything is possible.”
    “But where do we start?”
    “Let’s check the docs. May I use your computer?”
    “Certainly.”
    “Okay, let’s see here. QML docs, developer guides, maybe there will be something in these use case guides… Hmmm… writing mobile applications, integrating with system services, remote application loading… Aha! Fighting off giant mechs. That looks relevant.”
    “Wow! The QML documentation sure is complete.”
    “Looks like the primary suggestion is to hack the mech’s control systems. Do you know what software they’re running?”
    “Not exactly, but it’s the combined systems of over a dozen different companies. That means it’ll be running with at least twenty different protocols and we don’t have the time to dig through that.”
    “Okay, then let’s try the experimental space fleet module.”
    “I don’t like risking the company on unreleased software. But it’s still our best chance. Hook it up to the castle’s targeting sensors.”
    “Uh… okay. Let’s see now…”

    import Megatech.BlackCastle.InternalSensors 1.2 as BCS
    import SpaceLabs.SpaceFleet 0.1
    import QtQml 2.1
    
    Flotilla { id: flotilla
        BattleCruiser { primaryTarget: BCS.DefenseGrid.targetsByPriority[0]} 
        BattleCruiser { primaryTarget: BCS.DefenseGrid.targetsByDistance[0]}
        BattleCruiser { primaryTarget: BCS.DefenseGrid.targetsByType("mech")[0]}
        Instantiator {
            model: 3
            EscortSquadron {
                id: bcWingmen
                escorting: flotilla.ships[index]
                Frigate {}
                Corvette {}
                Corvette {}
                Instantiator {
                    model: 10000
                    Fighter { squadron: bcWingmen }
                }
            }
        }
    }
    

    The rest, gentle reader, I’ll leave to your imagination. It’s all there in the simple and readable QML code. But to give you a hint, the battle cruisers had mega-space-lasers and saved the day. So nothing remained to oppose Megatech’s brutal reign of terror. They gave Ada Ziner Australia for her efforts, and at least one QML user lived happily ever after.

    Editors note: Actually not very descriptive of QML, because the development stage is just too quick and easy to describe. Expect more episodes after the next QML (Qt Mandated Lobotomy).

One thought on “The Qt/QML User Story Redux

  1. Mind == blown.

    The threats to take away fun times at work privileges is my favorite part, truly terrifying 😉

Leave a Reply

Your email address will not be published. Required fields are marked *