You are on page 1of 29

The Art and Business of Software Development

DIGEST March, 2010

Editor’s Note 2
by Jonathan Erickson

Truly Random Numbers 3
Researchers use a “flip-flop” to impr ove random number generators.

Team Building Goes Viral 4
by Jerry Tubbs
Ready for an Agile development envir onment? Success depends on making sur e ever yone buys in.
When Teams Break Down, Business Loses 6
by Johanna Rothman
What happens when team members don’t work well together?
Your Own MP3 Duration Calculator: Part 2 7
by Gigi Sayfan
Rolling out Version 2.0.
C Snippet #3 14
by Bob Stout
Sor ting an array of strings.
Java and C++ Socket Communication 15
by Eric J. Bruno
Integrating C++ native Windows applications with Java applications via network sockets.
The Jazz Process 19
by Adrian Cho
What can software developers learn from jazz musicians?
Estimating on Agile Projects 21
by Scott W. Ambler
Upfr ont estimating from an agile viewpoint.

Book Review 24
by Mike Riley
Mike Riley examines the second edition of Erica Sadun’s The iPhone Developer’s Cookbook.
Conversations 25
by Jonathan Erickson
Q&A with Andr ew Stellman and Jennifer Greene on teamwork: It’s all about tr ust and techniques.

Other Voices 27
by Su-Laine Yeo
The Sim Ship Standar d.
Swaine’s Flames 29
by Michael Swaine
Michael takes a spin at Chatr oulette.

Entire contents Copyright© 2010, Techweb/United Business Media LLC, except where otherwise noted. No portion of this publication may be repro-
duced, stored, transmitted in any form, including computer retrieval, without written permission from the publisher. All Rights Reserved. Articles
express the opinion of the author and are not necessarily the opinion of the publisher. Published by Techweb, United Business Media Limited, 600
Harrison St., San Francisco, CA 94107 USA 415-947-6000.

D r. D o b b ’s D i g e s t [ ]
Editor’s Note

Hub-a, Hub-a, Hub-a
couple of weeks ago, the headlines generally read “Microsoft Unveils Windows Phone 7 Series.” More
accurately, they probably should have said something like “Microsoft takes yet another run at mobile
phones.” Of course, that doesn’t mean that the Phone 7 isn’t interesting and newsworthy. What I find inter-
esting about the Phone 7 is the implementation of “hubs,” although I probably would have shied away
from describing them as “unrivaled.” But more on that shortly.
According to Microsoft, “Hubs bring together related content from the Web, applications, and services into a sin-
gle view to simplify common tasks.” The company goes on to say that the Phone 7 Series includes six hubs built on
specific themes reflecting activities that, according to focus groups I suppose, matter most to people:
By Jonathan
Erickson, • People. This hub delivers a social experience by bringing together relevant content based on the person, including
Editor In Chief his or her live feeds from social networks and photos. It also provides a central place from which to post updates
to Facebook and Windows Live in one step.
• Pictures. This hub is for sharing pictures and video to a social network.
• Games. This hub delivers the first and only official XBox LIVE experience on a phone, including XBox LIVE games,
Spotlight feed, and the ability to see a gamer’s avatar, achievements, and profile.
• Music and Video. This hub creates a media experience that includes content from a user’s PC, online music serv-
ices, and a built-in FM radio.
• Marketplace. This hub lets users discover and load the phone with “certified” applications and games.
• Office. This hub enables access to Office, OneNote, SharePoint Workspace, and Outlook Mobile.

Again these are the six out-of-the-box Microsoft hubs, with the suggestion that more can come in the future, both
from Microsoft and third-party developers. This will likely require special tools, of course, and an SDK will be made
available this month.
Microsoft isn’t the inventor of the hub concept, and in fact, hubs aren’t even new to the world of Windows developers.
Infragistics ( for instance, provides a Hub and Spoke pattern as part of its Quince pattern library
All of which prompted me to get in touch with Tobias Komischke, Director of User Experience at Infragistics, who
told me: “I like the idea of the hub concept, because it helps to consolidate and organize various content into just a
few, manageable access points — and that’s just what is needed for a phone in times of convergence, where you have
most information and data available anywhere and anytime.
“The hubs thus help greatly to provide a welcoming first impression when starting the phone experience: non-clut-
tered, clearly segmented information, and access points that still allow for customization.
”It appears to me that the hubs are the reloaded portals that we saw on the Web 10 years ago. Back then, there was
a website — a portal — that allowed access to an entire world of related information. But we had to go there — we
had to dare entering the portal to access this information. Now, the hub concept not only provides 6 and not only one
“portal”, but the hub tiles live and show updated information (e.g. new emails), so the transition between seeing a hub
and entering it feels more natural.”
According to Infragistics, the hub and spoke pattern is most commonly seen on phones and other small devices
where having global navigation (and even the ability to interact with it were it displayed) is difficult, or in situations
where there is an open plug-in model for applications, such as Facebook, where the hub is more of a facilitator for dis-
parate services and applications to come together in one place. The iPhone and now the Phone 7 fit both of these con-
straints. Other classes of software solutions that warrant this approach include games — people expect to and usual-
ly want to be immersed in them. Sensitive tasks that require a person’s full attention could be another.

Retur n to Table of Contents

DR. DOBB’S DIGEST 2 Mar ch 2010

DOBB’S DIGEST 3 Mar ch 2010 www. Essentially. it is many times more difficult to predict with any degree of certainty the next Marketing Services number in a sequence compared to current random number generators. it is unfeasible to generate a sequence that is totally unpredictable Tony L. potentially making private and sensitive transactions on the Internet more secure. according to researchers writing in Brandon Friesen the International Journal of Critical Computer-Based Systems. 94107. So this true random TechWeb TV number generator can protect systems against third-party snooping. twitch randomly between its two John Siefert. then systematic errors will creep into the models and make Strategic Development and Business Administration the predictions unreliable. the “quality” of a random number is a measure of how truly random the number is.ddj. Uphoff Chief Executive Officer by computational means. in 600 Harrison Street. CA. Content Director. In reality. this means that the bigger the array the better the quality of random Network Scott Vaughan Vice President. quality affects significantly any security or simulation in which it is ber is not truly random. Marie Myers Senior Vice President. Herb Sutter WEBMASTER Sean Coady A new approach to generating truly random numbers could lead to improved VICE PRESIDENT. In such a sequence there is no way to predict what digit will appear next. climate change. economists. Human ous to a simple statistical analysis as — depending on the type of attack — either the whole array Resources Fritz Nelson Executive Producer. Technology Network The team adds that the efforts of a cracker attempting to influence the array will be wholly obvi. InformationWeek The researchers’ experiments with an array of flip-flop units show that for small arrays the extra Global CIO layer makes the random number almost twenty times more “random” than conventional methods. or single elements will be . Financial improve everything from climate change models to stock market predictions.” that Manufacturing a good random number in computer binary would usually comprise discrete and uniformly distrib- uted ones and zeroes. whereas these are again selected randomly. climate sci. DOBB’S According to Bernhard Fechner of the University of Hagen. Beth Rivera Vice President. VICE PRESIDENT GROUP SALES Martha Schwartz Random numbers are a critical part of computer and Internet security. Such simulations can test theories of hurricane formation. DR. The degree of randomness possible depends on the size of the array and so a bigger array could be Light Reading Communications even more effective. If a so-called random num. At the end of the metastable state. and epidemiologists also use random numbers to generate simulated data for MANAGER their predictive models.D r. or the spread of disease and Pat Nohilly Senior Vice President. Therefore. the TechWeb number is thus random. numbers. e-commerce sites or secure government websites. Return to Table of Contents DR. They allow websites and AUDIENCE DEVELOPMENT browsers to encrypt the data sent between them using a session key. physical means are used to generate true random numbers. the contents of the memory are purely Technology Network Bob Evans Senior Vice President and random. 415-947-6000. This Francisco. Fechner and Osterloh explain in their paper. then someone could predict a security key and crack the Internet encryp. UBM LLC tion on bank accounts. San Germany. the flip-flop is in a “metastable state” where its behav. “A Meta-level True Random Number Generator. climate. CFO The German team has now developed a true random number generator that uses an extra layer David Michael. This could be used to John Ecke Vice President. Joseph Braue Senior Vice President. if the random numbers used in scientific models of the weather. John Slesinski and the spread of disease epidemics. Similarly. Weather forecasters. D o b b ’s D i g e s t [Techno-News ] EDITOR-IN-CHIEF Jonathan Erickson Truly Random Numbers EDITORIAL MANAGING EDITOR Deirdre Blake COPY EDITOR Amy Stephens German researchers use a “flip-flop”to improve random number generators CONTRIBUTING EDITORS Mike Riley. economic boom and bust are predictable. 6th Floor. John Dennehy. InformationWeek Business iour cannot be predicted.ddj. GROUP PUBLISHER Internet security and better weather forecasts. www. for instance. Immediately prior to the switch. a flip-flop. CIRCULATION DIRECTOR Karen McAleer entists. CIO of randomness by making a computer memory element. As such. and Andre Osterloh of BTC AG. Publisher. for instance. Senior Vice President and states 1 or 0.

effectiveness. compre- Eclipse.D r. it quickly so we could continue developing and petitive. We also boosted Scrum master. from quality control. For the three pilot projects. Development teams complained regularly The Right Approach about the tools they had to work . Processes broke down. business with each. and This situation became a serious problem as we Serena. we switched last year to the Scrum Agile was moving. involved Excel spreadsheets or Word documents. But to make it work. because they had to tion life-cycle management (ALM) products. DOBB’S DIGEST 4 Mar ch 2010 www. It’s a mature. were. and source code control parate tools and manual processes kept Scrum systems. and someone developer productivity by at least 20%. changing the tires while the car gies. D o b b ’s D i g e s t Team Building Goes Viral Ready for an Agile development environment? Success depends on making sure everyone buys in D by Jerry Tubbs ST Systems’ large development group But getting there wasn’t easy. In a short time. Running Scrum of about 1. We So after decades of using waterfall methodolo.ddj. It considered about a dozen applica- status of a particular asset. Some tools worked in realized that we needed an easy-to-use. process management and workflow software that’s Cost-effectiveness and ease of adoption were been around for nearly 20 years. a from 24 months to 6 months. Many processes were tools and data within easy reach of everyone on manual and time consuming. reducing the software release cycle cal Scrum team that included a project owner. we assembled a typi- tor of four. software development methodology. ately accessible. and our dis- processes. Our From Chaos To ALM developers accelerated software releases by a fac.200 people over the years sprints with our existing tools caused immediate adopted a hodgepodge of tools. We then replicated source DR. To remain com. We knew for source code nor one developer toolset shared that Agile was a team-based approach to software across the organization. Healthcare organizations use it to process were packaged in a way that made them immedi- insurance claims. a business analyst. supporting products in a competitive market. others were standalone. as well as several open source options. especially if they the team. Managers We put together a product evaluation team to had difficulty answering basic questions about identify the right development environment in who was working on what and determining the mid-2008. But moving it through a make use of each feature without extensive train- traditional waterfall methodology — from design ing that would impinge on productivity. We also examined feature- es companies use AWD to process financial trans. It didn’t have a single central repository teams from reaching their objectives. to coding to testing to integration — was taking Whichever product we chose. MKS. problems. in effect. key selection criteria. We wanted to be able to easily uct with lots of features. others didn’t. we achieved some impressive results. sophisticated prod. IBM. including tools from CollabNet. we needed to adopt two years for each major release. look in so many places to get answers. looked to accelerate the development cycle for We settled on three finalists and ran pilot projects DST Automated Work Distributor. we needed to speed things up. Moving between hensive development environment that would put tools was cumbersome. Financial servic. Some teams used Serena development. we quickly PVCS. assessing whether the core features actions.

Sh ar e kno wledg e an d i nf or mation the new environment. ready to move aggressively in our markets this year. established some Agile use cases. Have adequate r esour ces at the outset so owners to Scrum masters to developers and testers to business team can focus on the project. as well as the overall business.D r. Co m mu ni cat io n. and has earned the endorsement of senior answers and building reports. under the sun. 2. Based on our experience. strive for viral adoption. When evaluating but instead. Everything the developers need is in After several months. because the senior developer team was development work. including: involved. We’re not hearing complaints about tools adopt it on their own. port engineers with better visibility into our product. our core development team was up and running in 5. criteria. includ- ing new features under development and relevant test results. but — Jerry Tubbs is systems development manager for DST be wary of complex “Cadillac” offerings that promise every feature Systems. The switch has made development teams more effective. Establish trust because it's mandatory even when CollabNet’s TeamForge as our ALM platform. adoption going on. We 4. • Happier developers. would let us meet the requirements we had set. If you’re software group is struggling with old. My team no longer spends hours looking for meets people’s needs. and has earned the endorsement Lessons Learned of senior developers. keep it simple. put together a team of senior developers who’ll ask Eclipse. and Effective Development Teams Start Here staged a dress rehearsal to test the day-to-day interaction with the tool. single. If you’ve selected a product that solves problems. Trust. They’ll adopt it on their own. I’ve learned that Cadillac-style prod- ucts generally give you higher costs along with all those features. We’re also using Agile templates included with the cal or business decisions. We can now answer management’s questions Finally. you won’t have to force it on your developers. Master the tools and processes completed the transition to TeamForge in just less than 10 weeks. here’s adoption is easier — and more fun. we already have more teams on the new TeamForge and Eclipse. what to look for: First. Now. Over the years. The combination of dous weight with the rest of the organization. They’ll is readily available in the new development . Now all members of the development team — from product 6. you won’t have to force it on your developers. They’re going to trust other developers before they trust a bunch of managers who went off by themselves and then came • Competitiveness and market readiness. Focus on what you really need. Your developers will Agile development and TeamForge has delivered benefits for our have faith in the decision. Understand The Process. TeamForge to manage our processes and workflows. Resour ces. about people and products immediately. developers aren’t struggling to move files among disparate tools. D o b b ’s D i g e s t code into the tool’s repository. It’s part of our adoption by our development teams. not the tools. rather than mandating change. The new ALM platform provides sup. All of the information we need developers. We have visibility into Find a platform that’s so compelling that people will adopt it with- project status and can drill down to the level of individual out coercion. Leadership. and processes. and it’s almost always cheaper. Retur n to Table of Contents DR. before coding begins. We’re delivering new down from the mountain with product brochures and a purchase features every six months instead of every two years. and don’t fall for showy vendor pre- sentations. inadequate toolsets. the evaluation team chose 3. Common Purpose. Viral it’s time to evaluate ALM options. with Subversion as a you don't always agree. constantly. Involve key players every step of the way. Simpler is better. culture now. We allowed time following each pilot to assess how the tools 1. analysts — have what they need for all phases of the application 7. While it would be tempting to give Agile practices all the cred- it for these results. Ensure leaders are in place to make techni- life cycle. 7 Key Factors created processes within the tool to model the use cases. if you’ve really selected a product that solves problems. Their endorsement of the final selection will carry tremen- We’ve met and probably exceeded that goal. Get everyone on the same page. Commitment. Once the pilot phase was over. The tool’s ease-of-use has led to viral tools and processes than used our previous ones. • Transparency. It’s that compelling. they do all their work within the ALM platform and ALM options. By June 2009. Find a product that meets your needs. assets and users. Developers aren’t complaining about tools anymore. centralized repository for all development projects.ddj. Do what's necessary to get the job done. DOBB’S DIGEST 5 Mar ch 2010 www. and we’re order. Mandating change is hard. meets people’s needs. There’s a groundswell of • More effective support. People don’t question it. vendors hard questions and give you excellent advice on selection Our goal was to increase productivity by 20% in one year.

losing business.D r. too. two senior managers couldn’t agree on an approach to access the database. sales were down. a company that makes data visualization software. Business Loses What happens when team members don’t work well together? W by Johanna Rothman hat happens when team members don’t work well together? A decade ago. D o b b ’s D i g e s t When Teams Break Down. and AVS’s product was inconsistent. so the program manager mandated that each team move to two-week iterations and synchronize their work. DOBB’S DIGEST 6 Mar ch 2010 www. So they simply kept creating new calls. there were mul- tiple ways to access its database.000 per business day that the system was late. Likewise. Customers depend on companies to be consis- tent with their products. When we don’t pay attention to teams and how they work. The project teams at first refused to synchronize their iterations. It now has new management and a new look for its legacy products. The competing teams contributed to AVS’s . when I consulted at AVS.ddj. the developers were unhappy because it was difficult to incor- porate new features into the existing. so they formed two competing teams and implemented their respective ideas. and a high price to pay for teams that couldn’t agree on iteration length. I’ve also done some consulting at a large insurance company that has a huge Agile program aimed at unifying all products under one umbrella to let agents sell anything. some wanted three-week ones. the multiple library calls were entrenched in the product. That’s a cost of $2 million for a one-month slip. anytime. — Johanna Rothman is a management consultant and author of Behind Closed Doors: Secrets Of Great Management (www. Some teams wanted two-week iterations. anywhere. and the company was trying to recreate itself. Sometimes it’s difficult to separate technical teamwork from bad architectural and requirements decisions. When my engagement ended. and customers weren’t happy because the calls to the database were different. and being unresponsive to the rest of the organization.a month late. After several itera- tions.jrothman. it was clear the program wouldn’t meet the first deliverable. A senior VP estimated the company lost up to $100. By the time I arrived. staff was reduced. Think about it — a database-oriented product with multiple ways to get and put.html).com/Books/behind-closed-doors. disparate calls. They finally released the first chunk -. Retur n to Table of Contents DR. we risk alienating customers. Several years before. But those decisions are part of teamwork.

find the song. New Requirements Before launching into full-blown development. Finally. all the songs were there and it was time to burn the CD. Collecting the track information can take a while for folders with tens or hundreds of songs. She was marginally pleased with the interface but complained that the total duration text box is a little obscure. it was time for Version 2. she had to manually select them again in Windows Explorer to burn them. Liat was upset and reselected all the songs again.0 so the user could simultaneously select and play songs while collecting more tracks. So. Obviously. Your Own MP3 Duration Calculator: Part 2 Rolling out Version 2.0 I by Gigi Sayfan n “Your Own MP3 Duration Calculator: Part 1” (http://www. and click on it to bring up the Windows Media Player. a weekly e-newsletter focusing exclusively on content for Microsoft Windows developers.) and her class was sched- uled for 8:00 a. D r. MDC allows Liat to quickly select different song ands see the total duration of all the songs. That was pretty late (about 2:00 a. Finally. This process was tedious and broke the flow of song selection. Then something terrible happend! Liat had already selected a bunch of songs when she accidently clicked without holding control on another song. That’s when we discovered that we had run out of blank CDs. Liat ran into a few other issues.m. After selecting all the songs. Liat brought several commercial CDs to her first spinning class and swapped them manually. The good thing is that there was a lot of room for improve- ment. we sat down and compiled the following list of require- ments for MDC 2.ddj.0: • Make total duration more prominent • Check boxes for selection (one-song toggle) • Show # of selected songs • Play songs from within MDC • Copy selected songs to a new folder • Export song list to a CSV file • Remember last folder One of the main features of MDC 1. Dobb’s M-Dev. Liat also wanted to print a list of all the songs and their duration. She had to go to Windows Explorer. You could always do all the selection operations you wanted on the available subset of songs and MDC displayed the total dura- tion. Alas. DR. Liat was excited and started browsing her music collection and selecting songs for her first spin- ning class. Her entire selection was gone and replaced with the single last song. she sometimes didn’t recognize the song’s name or just wanted to listen to it to make sure it was an appropriate .drdobbs.m. I wanted to preserve this capability for MDC 2.0 was its interactivity. When selecting songs. I presented a program called “MP3 Duration Calculator” (MDC).com/embedded/222500141). Spinning instructors need to create CDs with music for each class that matches the class content. MDC was never blocked.0. which I wrote for my wife Liat who recently completed certification as a spinning instructor. DOBB’S DIGEST 7 Mar ch 2010 www. D o b b ’s D i g e s t Click here to register for Dr. it wasn’t the best software debut ever.

<DockPanel DockPanel. But making the checkbox of each item in the list reflect the Figur e 1 Figur e 2 DR. it appears in the top strip. <TextBox Height="22" Name="status" MinWidth="100" Margin="3" /> </DockPanel> designed application. </TextBox> ing functionality. then you will have a hard time accommodat. <TextBox DockPanel. adding new functionality should be straightfor- ward and have little impact on the existing code. LastChildFill="True" tion more prominent and changing the way songs are selected. If your design had too many implicit assumptions about </Button> what it should support. Remember that WPF and XAML are all about composition and nesting. Converter={StaticResource DurationConverter}}"> there are two types of requirements that are difficult: changes to exist. which is a perfectly <TextBox Height="22" Name="tbTargetFolder" MinWidth="258" Margin="3" valid point of view).Dock="Right" Margin="3" Height="22" text box. the total duration text box was at bottom of the win. Text="{Binding Path=Self.0 is usually where you discover if your system is well Click="UnselectAll_Click"> Unselect All designed..0.D r.0. LastChildFill="True" Height="30" > Margin="0" VerticalAlignment="Stretch" Check Boxes for Selection (One-Song Toggle) <Button DockPanel.cmpnet. Note that the font size code and related files for MDC Version 2.Dock="Left" Margin="3" Click="SelectAll_Click"> Adding the check boxes is straightforward (see Figure 3). That was trivial to do in the properties pane of Visual ulator_v2. The complete source In Version 2.Dock="Left" Height="22" Name="total" Width="60" Margin="3" ing the changes and new requirements for version 2. and continues to work just fine. Height="30" Margin="0" VerticalAlignment="Stretch" > Make Total Duration More Prominent <Button color is blue. In general. and the addition of new functionality. Studio.Dock="Left" Height="22" Name="btnSelectFolder" Width="84" Margin="3" In Version 1. it moved to the top-right corner of the window Width="60" Text="{Binding Path=Self. D o b b ’s D i g e s t Select All MP3 Duration Calculator 2. where you VerticalContentAlignment="Center" > move elements around and modify properties without any code </TextBox> changes (unless you think of XAML as code. see Figure . Foreground="Blue" TextDecorations="None" FontWeight="Bold" FontSize="14" Background="White" TextAlignment="Center" WPF was designed to support this kind of change.Dock="Left" Margin="3" Version 2.. DOBB’S DIGEST 8 Mar ch 2010 www. Converter={StaticResource DurationConverter}}" and its text became blue and bold.0 are available at is 14 (compared to 11 for all the other controls) and the foreground http://i.0. In a well. In this case.0 </Button> <Button DockPanel.0. Name="total" In Version most of the requirements are for new functionali.Dock="Bottom" care about its location or font. I only had to modify the XAML a bit.Dock="Top" ty. see Figure 1. Click="btnSelectFolder_Click"> Browse. The changes to existing functionality are making the total dura. Here is TextChanged="tbTargetFolder_TextChanged" > the code for the bottom strip in Version 1. dow squished between the select/unselect buttons and the status </Button> <TextBox DockPanel.0: </TextBox> </DockPanel> <DockPanel The data binding that populates the total field doesn’t really DockPanel.

. If the check box is clicked and becomes “checked. // Update the status line Converter={StaticResource DurationConverter}}" var st = String.Format("{0}/{1} files are selected". > . Eventually. Here is the data template: tus bar for that). It sounds elegant. ered that it requires a data template in XAML (of course.Text = st.. I could have a status object bound to <DataTemplate x:Key="FirstCell"> the “status” text box. but the basic problem remained: If you select an item without holding control. but that seemed like overkill just to change <StackPanel Orientation="Horizontal"> <CheckBox IsChecked="{Binding Path=IsSelected. The first one is /> </StackPanel> when the collection of tracking info is complete.ddj. during the lifetime of the application (I probably should add a sta- tion. but the arcane incantations it changes. } were nicely synchronized with the selected items. Once the collection is complete..Columns> status. . which is the bad behavior... Figur e 3 Here is the XAML if you must: selection state is not trivial. This is a classic use case for two-way <ListView MinHeight="223" binding. DR. you can </ListView> do anything in code too). I tried various solutions with ever more desperation but I couldn’t fully override the selection behavior of the list view (I tried hooking into the routed event pro- cessing and directly manipulating the selected items). The MSDN documentation is a little confused and doesn’t mention it. it makes a new column to GridView. which is exactly the behavior I was after. to update the status object from the code). D o b b ’s D i g e s t all your previous selections were replaced by the new item. you want the check box to PreviewMouseRightButtonDown="files_PreviewMouseRightButtonDown" become checked (the other way).Columns (the first column): sense to display the current number of selected songs. it is simple to extend the list their total duration. but it required some code ListViewItem. You define the data template in the resources section of the main window and bind the isChecked Show the Number of Selected Songs property of the check box to the isSelected property of its This was another trivial request. I use String. The “status” text box displays various status messages requires can’t be discovered easily just by reading the documenta.D r. The check boxes didn’t enforce the behavior I wanted (item select/uns- elect toggles just the current item). /> _fileCount). I noticed that the list view has a little property called SelectionMode. So. DOBB’S DIGEST 9 Mar ch 2010 www. During the collec- </DataTemplate> tion process. the user may select already-collected songs and view Once the data template is defined. the contents of a text box every now and then (you would still need Mode=TwoWay. but it also has a value of “Multiple”. Here is the Header="Filename" DisplayMemberBinding="{Binding Path=Name}" first usage in onTrackInfo() when there are no more tracks: Width="Auto" /> void onTrackInfo(TrackInfo ti) { <GridViewColumn if (ti == null) Header="Duration" { DisplayMemberBinding="{Binding Path=Duration. the SelectionMode is set to “extended” by default. My nifty little check boxes .SelectedItems. In theory.Format() to construct the message.” you Name="files" want the item to be selected (one way) and if the item is selected MinWidth="355" Background="White" through some other mechanism like the user navigating with the SelectionChanged="files_SelectionChanged" SelectionMode="Multiple" arrow keys and hitting the space . AncestorType={x:Type ListViewItem}}}" songs should be displayed in two separate cases.Columns> case is of course when the number of selected songs is changed.Count.. } That wasn’t good enough though. There is a “Single” value that allows you to select at most one item at a time. Width="Auto" files. All it takes is adding the collection process. <GridViewColumn CellTemplate="{StaticResource FirstCell}" The code is just two lines so I didn’t even bother with a special Width="30" /> method to update the status and just used the two-liner in both <GridViewColumn places. The number of selected RelativeSource={RelativeSource FindAncestor. </GridView. I set the SelectionMode to “Multiple” and my work was done (including seamless integration with the check boxes). but the status text box displays the progress of view to have a check box next to every item. but it does mention that it’s a property of a list box (a list view is derived from list box and just extends it with a view). Anyway. After some “binging” I discov. The second <GridView.

then I set the extracts the duration. so it can be placed anywhere. tion process. plays audio in this case.SelectedItems. selected all the files she select- events and bubbling events. created a new folder. but this causes no harm). So. The act of playing a song doesn’t change its selection state. You MouseButtonEventArgs e) { may play selected or unselected songs. you select a bunch of songs out of The code to enable play/stop is simple. Bubbling events start at the child and bubble the files list view: up to parents.Combine(tbTargetFolder. files. if (x is GridViewRowPresenter) The player media element is an invisible element because it just { var ti = ((GridViewRowPresenter)x).Text. This is behavior I want to suppress.0 it was a grueling manual process. song) or anything other than the current clicked item. There is a somewhat Okay. I set the Source to null for and stop playing a song by right clicking with the mouse. If some control handled the tunneling event. here is a feature with some substance.Source == null || player. var x = ((FrameworkElement)e.. I need to fig- process. Height="0" } Width="0" else Name="mediaElement" { LoadedBehavior="Manual" player. and closes the file. Source property to the new song and iy starts playing. next to the original media element in the Grid container of the player.IO. The routed events travel in pairs. succeeds. It just opens each file.Parent. Of course. In MDC 2. There is cleanup purposes. and now you want to burn them. it sets the Handled property to true so the list view } will never get a chance to process it. it means that the right click was indeed on one of songs ment used for collecting track info for playing tracks because I in the list and not just a click in an empty area. the parent of the list view so it gets first shot at handling it.Source. into the current song. status.Source = new System. WPF uses ferred to have all the selected songs in a dedicated folder so she routed events. rearrange them. the right mouse button on the files list view. songs solves the problem. This is a very important feature because the collection ure out the path to the song file. ti.ddj.” button (see Figure 4) that opens a folder selection dialog.. Note that the media element I use for Then. and any control along the way can handle the event and it will not With MDC 1.. Another dedicated media element for playing TrackInfo object. I placed it string path = System. it is not a good idea to reuse the same media ele.. // Update the status line Down event is a tunneling event that’s fired when the user clicks var st = String. First.. If the player Source property is null (no ment because it never tries to play anything. Otherwise I decided to go with a very spartan interface where you start (clicked on the same playing stop). and copied the files child and allow the parent to handle the event on behalf of many there. Note that the Content property of the clicked item is a dreds of tracks). . The main window is _fileCount).Handled = true. /> } <MediaElement } Height="0" } Width="0" Name="player" LoadedBehavior="Manual" /> .Content as TrackInfo. could rename songs.OriginalSource). DR. Routed events travel through the control hierarchy. e.Count. during and after the . It is all located in the your source directory. D o b b ’s D i g e s t The second usage is in the selectionChanged event handler of process them further. Tunneling events travel form parent to ed previously in MDC.. <MediaElement player.D r.Stop(). Liat fired up be passed further.Path. this task can be done directly. First.Name). The reason is that the right mouse button click will toggle the selection if allowed to rich the Play Songs From Within MDC list view. which I retrieve from the clicked process can last seconds (even minutes if a folder contains hun.AbsolutePath != path) { <Grid> player. The media element is complex check to find the parent of the original source of the right fully capable of playing tracks and we already have one in our main mouse click and see if it’s a GridViewRowPresenter.Format("{0}/{1} files are selected". that’s want the user to be able to play tracks during the collection when we want to play or stop the current song. Immediately. I stop the player in case it was playing (it may be stopped collecting track info doesn’t interfere with the player media ele. Liat pre- event handler for the PreviewMouseRightButtionDown. DOBB’S DIGEST 10 Mar ch 2010 www. item. the PreviewMouseRightButton- . tunneling event called PreviewXXX followed by a bubbling event SelectionChangedEventArgs e) called XXX. However. there is a void files_SelectionChanged(object sender.Source = null. If this check window. There are two types of routed events: tunneling an Explorer window next to MDC. main window: if (player. and examine previous CDs.Uri(path). no way to pause or skip ahead and no way to see how far you are private void files_PreviewMouseRightButtonDown(object sender.Play(). the bub- { bling event will NOT be fired.0... so you play with MDC. Copy Selected Songs To a New Folder </Grid> Okay. I added a “Make children or do some global handling and then let the children CD.Text = st.

. The ‘Unselect All’ and ‘Make CD.SelectedItems. The button is enabled/disabled based on the selection state of Liat can edit it later in Excel and add her class program next to the the files list. t. DialogResult r = _folderBrowserDialog.Count > 0. DOBB’S DIGEST 11 Mar ch 2010 www.SelectedPath. Duration for each selected item (see Figure 5). dst). the selected items are copied to the target operations: folder. The MakeCD_Click() event handler implements two requested features: copying selected files to a folder and also exporting the song list to a CSV file.’ buttons are enabled if at least one item is selected. Now. Many of these operations are implemented as static methods.Copy(src.File..Show( "Target folder is the same as source folder. the selected songs.IO. t. D o b b ’s D i g e s t string savedPath = _folderBrowserDialog.IO namespace several classes to help with path manipulation and file operations. just one line. In order to remember the source folder. makeCD.Count < files.Copy that don’t have any state worth remembering for future Once you select a folder. and I handle enabling/disabling and the ‘Select All’ and ‘Unselect All’ buttons in the same place.SelectedItems.Combine or which allows you to browse an existing folder or create a new one. The ‘Select All’ button is enabled if all the items are not selected.SelectedPath.Name).SelectedItems) docked to the right side of the bottom panel. unselectAll.ddj. return.Combine(savedPath.Forms.SelectedPath = savedPath. is disabled initially (you can’t make a CD before some songs are var dst = System. It is just a two-col- </Button> umn list of Name. it has a tooltip and it { var src = System. RoutedEventArgs e) Figur e 5 { DR.IsEnabled = files.D r. System. then acceler- case to use imperative code in the files_SelectionChanged() event ate for 8 more minutes and when you can’t go any faster. private void MakeCD_Click(object sender. MDC displays a message box and takes no action (no point in copying the files to the same fold- er. no action taken"). If the user selects the same folder as the source folder.Count > 0.SelectedItems..OK) { string path = _folderBrowserDialog. but I opted in this songs. if (r == System.Name)..Path. } // restore selected path _folderBrowserDialog. increase handler that’s being called whenever the selection changes.Windows. it’s time to actually copy all the selected files to the target folder. XAML makes it easy to add a button. I reuse the _folderBrowserDialog for selecting the source folder. The Click event is hooked up to the MakeCD_Click() } event handler: <Button Name="makeCD" DockPanel. The button is foreach (TrackInfo t in files. File.MessageBox.Dock="Right" Margin="3" Exporting the Song List To a CSV File ToolTip="Copy selected songs to a new folder" This is another feature Liat requested and it is also implemented Click="MakeCD_Click" IsEnabled="False" > in the MakeCD_Click() event handler immediately after copying Make CD. selected). I save it in a temporary variable and restore it after the user selected a target folder.ShowDialog().IO. selectAll.ShowNewFolderButton = true. It goes something like: go fast for 5 minutes.Count. The . The first step is to select the target folder.IsEnabled = files. Figur e 4 which makes a lot of sense for operations like Path.IO.NET Framework provides in the System.Combine( . This can be done with data binding. _folderBrowserDialog.DialogResult. It is the resistance until you start crying.Items. // check that the target folder is different than the source folder if (path == savedPath) { System. The format is very simple. // copy selected songs to target folder As usual.IsEnabled = files.Path. there are already there).Windows.

CompilerGeneratedAttribu { te()] var d = new DateTime(t.Properties { // This class allows you to handle specific events on the settings class: // The SettingChanging event is raised before a setting's value is changed. namespace MP3DurationCalculator.ApplicationSettingsBase. } folder. public static Settings Default { Programs that remember where the user left off are much nicer to get { return defaultInstance.CodeDom.SelectedItems) [global::System.GeneratedCodeAttribute("Microsof System. // The PropertyChanged event is raised after a setting's value is changed. There are several other issues you have to take into account ports a lot of functionality.Path. The Settings.Runtime. //--------------------------------------------------------------- --------------- The using statement creates the track_list. igner. Visual Studio takes care of adding two files: together with all the songs.0. These files together define the correct use of IDisposable objects.Configuration.Diagnostics.Configuration. DOBB’S DIGEST 12 Mar ch 2010 www. the selected items in the } } current session and more. The Settings.wikipedia.IO.VisualStudio.Compiler. foreach (TrackInfo t in files.WriteLine("Name." + d. "track_list. //--------------------------------------------------------------- --------------- // Create CSV file with track list var filename = System. The . // the code is regenerated. which is // <auto-generated> guaranteed to be closed properly at the end of the block.cs and Settings.0. tings (especially in Visual Studio). "9. t. uncomment the //lines below: Figur e 6 // DR.Path. D o b b ’s D i g e s t The Excel native file format is very complicated because it sup.SettingsSingleFileGenerat sw.csv and it is stored in the target folder settings tab.50727.UserScopedSettingAttribute()] [global::System.Configuration.WriteLine(name + ". I only use it to remember the last source get { return ((string)(this["InitialFolder"])). } use. just for importing tabular data into when thinking about persistent application settings such as write Excel you can use a CSV (Comma-separated values) file.Name). but it can be extended to store any number of things like set { this["InitialFolder"] = value.cs. internal sealed partial class Settings { public Settings() { // To add event handlers for saving and changing settings.csv"). // Runtime Version:2.CompilerServices. per-user settings.cs file contains a static instance of the default settings and I like to think of it as the C# equivalent of the C++ RAII design pattern get/set properties for each setting: (http://en.Duration.cs file contains optional event handlers you can implement to respond to a change in settings and to intercept the saving process: namespace MP3DurationCalculator.NET Framework provides standard infrastructure to [global::System. // The SettingsSaving event is raised before the setting values are saved. // The SettingsLoaded event is raised after the setting values are loaded. But.Configuration.Synchronize d( Last Folder new Settings()))).3603 using block the code writes a header “Name”. Inside the // This code was generated by a tool.ddj.DebuggerNonUserCodeAttribute()] persist application settings and it’s well integrated with Visual [global::System. You have to be careful to make sure Once you figured it out. It is very access and shared settings between all users vs. These objects have a Dispose() sealed Settings class (via partial classes in each file) under the method that should be called to ensure proper cleanup and the using MP3DurationCalculator.CreateText(filename)) { sw.0")] } } internal sealed partial class Settings : global::System. You define your properties in the The filename is track_list. simple to create such a file.Ticks). // </auto-generated> ting to make it look .ToString("mm:ss")). it is pretty easy to use application set- your values don’t contain a comma (I don’t do it here).Duration").Combine(path. I utilize the using statement that ensures Settings. var name = [global::System. “Duration” to the sw // // Changes to this file may cause incorrect behavior and StreamWriter object and then iterates over the selected TrackInfo will be lost if items and writes each item’s name and duration with some format.Des- statement does it at the end of the block even if an exception is thrown.Editors.Designer.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings) Remember the (global::System.0.GetFileNameWithoutExtension(t.Properties namespace.DefaultSettingValueAttribute("")] public string InitialFolder { Studio (see Figure 6).Properties { using (var sw = File.csv text file. } } the size and position of the main window.SettingsDesigner. or".D

the settings are loaded automatically and requested functionality with minimal changes to the XAML and are available in the MainWindow constructor.Settings.. } Retur n to Table of Contents Windows 7 Libraries Windows 7 libraries are explored and the Sensor and Location platform is explained.SpecialFolder.Properties. DOBB’S DIGEST 13 Mar ch 2010 www. } track_list. but with // the food comes the appetite. I was able to extend MDC with a significant amount of user- When MDC is loaded.SettingsSaving += this. If the initial folder the code..0 subsided.Default.SettingChangingEventArgs e) { • Make CD from multiple source folders (will require merging of // Add code to handle the SettingChangingEvent event here. It is designed well and supports both } } enterprise-grade applications as well as small.D r. There are only two types of pro- namespace MP3DurationCalculator grams: the programs that users complain about and the programs { they don’t use. • Maybe a little database to manage prepared CDs and mark } } songs that were used already.SettingsSavingEventHandler. Dobb’s Microsoft Resource Center.MyMusic).SettingChangingEventHandler.Exists(initialFolder)) initialFolder = Environment. // // this. if (!Directory. doesn’t exist.NET Framework and WPF are a superb platform for develop- } ing rich client applications..Default. He is currently trying to build intelligent . Liat was pleased with all the changes and new features.Save(). Click screen to watch a video about Windows 7 libraries on Dr.CancelEventArgs e) • A seek bar that allows skipping and also displays the current { position of the song // Add code to handle the SettingsSaving event here. Once the initial excitement over MDC } private void SettingChangingEventHandler( . . The . stop object sender. Click screen to link to video DR.. public partial class App : Application { protected override void OnExit(ExitEventArgs e) { Conclusion base.SettingChanging += this.InitialFolder. Give Me More.Configuration. System. fun utilities like MDC. var initialFolder = machines inspired by the brain at Numenta (www.OnExit(e).. Properties.Settings. MP3DurationCalculator.. D o b b ’s D i g e s t // this.numenta. System. } MDC saves its settings in the OnExit method of the App class: I guess this is a good sign..csv files) private void SettingsSavingEventHandler( • A full-fledged media control bar: play. } .ddj. then the user’s MyMusic special folder is used as an initial folder: public partial class MainWindow : Window — Gigi Sayfan specializes in cross-platform object-oriented pro- { public MainWindow() gramming in C/C++/ C#/Python/Java with emphasis on large-scale { distributed systems.ComponentModel.. Liat wanted more features: object sender.

ddj. a pointer to the string array to sort and the number of strings in the array. tmp = *a. . One of the most common is simply sorting an array of strings. DOBB’S DIGEST 14 Mar ch 2010 www. *a = *b.h> #include <stddef. *b = tmp. if (j < gap) . b = a + gap. ) gap *= 2. Thanks to all who have contributed to this collection over the years. CO */ #include <string.Shell sort an array of string pointers via strcmp() ** public domain by Ray Gardner Denver.drdobbs. ++gap < array_size. } } } } More C Snippets • Determining a file’s size ( • Sorting an array of strings (http://www. Unless the array is very large. In such situations.drdobbs. I hope Dr.drdobbs. Call it with only two arguments. for (gap = 0. you might consider the Shell sort presented in this • Computing the wind chill factor (http://www.j -= gap) { a = array + j. i++) { for (j = i . **b. In most cases.D r. j. /* ** strsort() -.drdobbs. size_t array_size) { size_t gap. i < array_size. *tmp. while (gap /= 2) { for (i = gap. —Bob Stout • Timers and default actions (http://www.h> void strsort (char ** All the code in C Snippets is either public domain or freeware and may therefore freely be used by the C programming community without Retur n to Table of Contents DR. char ** • Rounding floating-point values (http://www. *b) <= 0) break. i. he or she will be identified. the standard qsort() function is often inefficient for such tasks. Dobb’s readers will find these useful. D o b b ’s D i g e s t C Snippet #3 Sorting an array of strings Q by Bob Stout : HOW DO I…sort an array of strings? A: Sorting jobs come in all sizes. if (strcmp(*a.drdobbs. if the original author is someone other than myself.

you can maintain a degree of platform and lan- guage independence. Although these approaches are good with each full message delineated by a NULL — in the right situations. this article. a weekly e-newsletter focusing exclusively on content for Microsoft Windows developers.ddj. Java Message System (JMS). Bruno erforming all of your application devel. D o b b ’s D i g e s t Click here to register for Dr. and with no code changes. With XML as the message protocol between them. see the “Conclusion” section at the end of data and read bytes from the network stream. there may be times where or ‘\n’ — character. Java and C++ Socket Communication Integrating C++ native Windows applications with Java applications via network sockets P by Eric J. Figure 1: A Java application can communicate ples (scenarios a and b). calling into native code from Java via JNI can be complex. here we show that a C++ applica- tion that uses Windows sockets can communicate with a Java application that uses Java IO (scenario c) just as easily as in the two homogenous exam. There are times when a Java application uses to communicate you may need to integrate a new application with with a C++ Windows application that uses a legacy one. For instance. and web serv. Potential Solutions but in reality they may be requests for data only In the past. and configured. both the client and server wait for ices. The Socket opment with a single language on a sin. . you may desire ports three simple requests for the following data: to isolate the two applications so that the new application’s design isn’t compromised. (JNI). and communication between the Windows sockets. installed. Dobb’s M-Dev. And a web service requires significant development and web-based infrastructure. directly with a C++ winsock application. Another solution is to use socket-based net- work communication directly between the Java and C++ applications. Using JMS requires a JMS provider be licensed. DR. D r. The Windows application sup- two can be an issue. Figure 1 illustrates this in a very simple way. and the • The Windows host name • The amount of memory installed older one can be upgraded later without impact. time-consuming. Solution gle platform may be ideal. All requests and responses are C++ applications via the Java Native Interface formatted as simple XML character strings. and error-prone. • A pseudorandom number ing the newer application. I’ve explored distributed computing available from a legacy application or a native solutions that have discussed integrating Java and platform interface. these solutions are too complicated or just not ideal. For instance. but it’s not Let’s explore a sample integration solution where always practical. it’s still an effective solution. DOBB’S DIGEST 15 Mar ch 2010 www. Although this is a relatively low-level approach. These requests are simple for illustration only.

requestHostname(). obvious changes. to the server. // sends responses public boolean connected = false.. and a list view to display the server responses (see Figure 2).. which listen for requests and send </Request> responses. you have the choice to run face. Let’s begin to dive into the implementation of public void requestMemory() { the solution.. static final String MEMORY = . <Name>MemoryResponse</Name> // . Example 1: The XML request messages sent from the client. <Number>20173</Number> } </Response> public boolean isConnected() { return connected. the XML can be The heart of the application is the Java network and IO code. } computer it’s run on. Example 2: The XML response messages sent from the server. As a result. <Response> static final String RANDOM_NUM = .. This class contains two embedded classes <Name>GetMemory</Name> <Type>Physical</Type> called Listener and Sender. arate computers. respectively. but you can change this to any valid reference to an object that implements the ServerResponses inter- hostname or IP address.. shown par- <Request> tially in Example 3. <TotalPhysicalMemory>1073201152</TotalPhysicalMemory> } </Response> public SocketClient(String IPAddress.. The main differences are the XML public class SocketClient { private Listener listener = null. or on sep- one or more XML elements to the request message.. There’s A connection to the server is established when a SocketClient also a button labeled Connect. sender. without issue. shown in Example 4. <Name>HostnameResponse</Name> } <Hostname>MyServer</Hostname> </Response> class Sender { static final String HOSTNAME = . We’ll examine the sample C++ if you want to change the GetMemory message to indicate the type server application later. in ServerResponses viewer = null. } In this sample implementation.D r. class Listener extends Thread { <Response> // . response to client requests. and the inclusion of the data being requested. <Request> <Name>GetHostname</Name> </Request> <Request> <Name>GetMemory</Name> </Request> <Request> <Name>GetRandomNumber</Name> </Request> Figur e 2: The sample Java client application user inter face.. <Response> ServerResponses viewer) { <Name>RandomNumberResponse</Name> // . } } which includes a user interface with buttons to make requests. The address of the server to connect to. beginning with the Java client application. of memory (physical or virtual) to request. the client object is created.requestRandomNumber(). The sample Java client is written as a Java Swing application. with only the request name differing between them. the actual data (bold in public void requestHostname() { Example 2) returned in each response will vary according to the sender.. SocketClient.. DR. changed to look like the following: which is encapsulated inside one class. // listens for requests response types. and the second parameter is a address defaults to . DOBB’S DIGEST 16 Mar ch 2010 www. see Example 2. and when pressed. simply add both the client and server applications on one computer. For example. Example 3:The SocketClient class implements all of the code to The response messages are similar to the requests with some send requests and listen for server responses. The first parameter of the constructor is the attempts to connect to the server at the supplied address.. D o b b ’s D i g e s t The simple XML request messages are in Example 1. } The Java Client public void requestRandomNumber() { sender. If you need to send data along with each request. Each mes- sage has the same basic XML structure.. private Sender sender = null.ddj.requestMemory().

io package. which is used to send data.. the complete perform non-blocking IO (beyond the scope of this article) in implementation. } } } The code is simple: As stated earlier. } As a result. while ( true ) { this. to Let’s examine the C++ Windows server a request message is sent to the server. This solution is simple and ele- connection to the server at address 192. communicate over many socket connections. the appropriate method message. catch ( Exception e ) { // process the XML . but in summary. each time you press one of the blocking read() methods in the Thread.Socket("localhost". The code to listen for network messages is similar in that it also Number() — when the associated button is pressed. view (see Figure 3). http://i.180. This implementa- stream. or any other an Exception is thrown.cmpnet. public interface ServerResponses { public void onHostnameResponse(String msg). To send a network message using this active socket. BufferedOutputStream bos = class is created (Listing 3 and the complete C++ server are available at new BufferedOutputStrean( socket. C/C++. and makes its call to one of the In this sample Java client.cmpnet.cmp- net. but for applications that need to the Java network communication code in more detail. The The C++ Windows Application Sender class encapsulates this implementation. and the Executing this code in a separate thread ensures that the rest associated response message text is displayed at the top of the list of the application is able to execute (and respond to user input.write( xml. For The is called on the ServerResponses reference provided. request due to the nature of waiting for a response is received from a prior request.168. subsequently displays the server response messages in a list view. When a uses Java IO streams. and • If the connection attempt fails. The use of XML further the message’s bytes to this stream: ensures that the communication will succeed. 8080). new BufferedReader( inputReader ). or When the SocketClient class is created (Listing 1. and later calling any of its public meth- ods — requestHostname().com/ddj/images/article/2010/code/JavaCppSockets. bos.readLine().getBytes() ).com . the user interface code drives the connection and request process by instantiating the SocketClient class when the Figur e 3: The Java client displaying some server r esponses. an instance of the ServerSocket String xml = "<Request><Name>GetHostname</Name></Request>". DR.ddj. creating a thread per socket may not scale well. which contains this implementation and the complete to the Listener and Sender classes to perform the real work. and then write Java.getOutputStream() ). However.D r. the active socket is passed Listing 2.getInputStream() ). java. public void onMemoryResponse(String msg). you need to use Java IO streams.0. public void onRandomNumberResponse(String msg). which are part of the java.printStackTrace().flush() . you also see that the display has been updated to show a an unpredictable length of time. the Java Swing code controls the sending of request messages as the user clicks on the appropriate buttons. This code looks similar to the public void run() { // Create a reader to wrap the socket's InputStream following: InputStreamReader inputReader = try { new InputStreamReader(socket. i. DOBB’S DIGEST 17 Mar ch 2010 www. Connect button is pressed. D o b b ’s D i g e s t Example 4: The ServerResponses interface methods are called as response messages arrive. which also send a network message you need to begin with the socket’s output uses sockets to communicate over the network. e. In summary.Socket socket = BufferedReader bufferedReader = new java. // readLine blocks until a message arrives } String xml = Let’s examine gant enough for this application. we wrap this tion is unaware of whether the client connecting to it is written in stream in a java. Java client application and related files are available at http://i. you typically perform this task in a separate and requestRandom. Alternatively. requestMemory(). The code in the Listener class that performs this task is similar The code in the constructor attempts to connect to a server at to the following: the given IP address on port 8080. for instance) while the blocking read() method waits for data for Here.sender = new Sender(socket). Listener class extends class Thread.listener = new Listener(socket).BufferedOutputStream object.. // writes to the buffer bos. you can specify a Java Network Programming timeout on the read() method and call it periodically (polling).run() method when started. When the server application and related files are available at http:// those • If the connection attempt succeeds. // writes the buffer to the network which listens on port 8080 for new client connections. this.

sprintf_s(buffer.drdobbs.. Conclusion You should now have a basic understanding of how Java and C/C++ applications can communicate via network socket programming. Bruno is an author and professional technology con- sultant. such as with JNI. and then listen on it and accept new client connection requests as they arrive: // Start winsock and create the socket WSAStartup(. while ( listening ) { // Accept a client socket ( clientSocket = accept(listenSocket. listener->startThread(). } } Each request is further processed in HandleMessage(). listenSocket = socket(. C++. ..drdobbs. NULL). In fact. and XML Processing (www.). listen( listenSocket.D r. take a look at the following articles: • C++.).. 184401817) • The Java Message Service (www. To learn about other application integration tech- niques. the SocketListener class executes the Windows Sockets recv() method. while ( true ) { bytes = recv(clientSocket. the resulting code is similar to the Java socket implemen- tation in that objects are created to handle sending data over the 200001958) • Java. ). num). 0). Retur n to Table of Contents DR. Combined with XML. send( clientSocket. a comparable Linux application can be devel- oped to work equally well with the Java client presented here. 0 ). BUFFERLEN... // null terminate the string HandleMessage(recvbuf). although the sample server application explored here uses Windows sockets. DOBB’S DIGEST 18 Mar ch 2010 www. buffer. D o b b ’s D i g e s t this class uses Windows Sockets to create a network socket. which blocks until data arrives. or web services. and SOA (www. listener = new SocketListener(clientSocket). "<Response><Name>RandomNumberResponse</Name>\ <Number>%i</Number></Response>\n". int bytes. } Given that the call to accept() blocks until a new client con- nects. if (bytes > 0) { recvbuf[bytes-1] = . // . as with the Java socket code. and listening for data to arrive: // Setup the socket sender and listener sender = new SocketSender(clientSocket).drdobbs. and the appropriate response is sent back to the client: int num = rand(). NULL. in its own thread: char recvbuf[BUFFERLEN].com/cpp/184401849) — Eric J. this code is executed in its own thread. Once a client does connect. this should provide a suitable solution in some cases. listener->setSender(sender)... JMS. strlen(buffer).ddj.. // TCP bind and listen bind( listenSocket. recvbuf. SOMAXCONN). Again.

The Jazz Process and intricate. high-quality ets. often ply crash-and-burn before reaching their goal. Change may be generated from within an competitive situation. These people will be the first to inspiration is jazz performance. improving collaboration. and in the case of developed by Colonel John Boyd. While such things can is a framework for wave of programming interfaces. gist. sales. and competitors (those we work against). Yet none of syndrome. (those we work for). ing orders. innovation. finance. blow out budg. and the many other cognitive these groups can succeed without effective collab. while applying laws of sociology. and agility toolkits. technology. underwhelm or disappoint users with offerings that will attract and retain customers. consumers skilled in various aspects of combat while follow. grating strong individual contributions from pas- ly? For decades the practice of software develop. or a group of jazz musicians. management. business methods such as Plan-Do-Check-Act tors are examples of external change. They may even try development. and aircraft designer. and support. Tactics used in Desert Storm organization or externally. Teams deliver late. Wave after (http://www. the not-invented-here and adhere to a development process. testing. based on the OODA loop ( development team is similar to a basketball team. They must deliver on-time and in real-time. marketing. cycle. They do this by inte- Why do some projects and teams perform so poor. DOBB’S DIGEST 19 Mar ch 2010 www.S. heavyweight processes. sionate and committed practitioners and ensuring ment has focused intently on tools. D o b b ’s D i g e s t The Jazz Process What can software developers learn from jazz musicians? S by Adrian Cho oftware development projects fail all the Like software developers. under continuous scrutiny.jazzprocess. physics. music. ogy.D r. Boyd believed that agili- tions while constantly reacting and responding to ty was the key to winning dogfights or any other . In software development. instruments and navigate through a musical form.html) are similar to his method. military operations. • Observe: Acquire all potentially relevant data Basketball players must be able to handle a ball including that which originates from collabo- and implement game strategy. Air Force fighter pilot. erick U. psychol- make a difference. rapid manner. design. A software (PDCA. multidisciplined The execution method of the Jazz Process is teams must collaborate and innovate with agility.ddj. or as • Act: Execute on the decision in a correct and it sometimes happens. the process draws tell you that failed projects are a result of using the on examples of excellence in business. work in synergy to deliver unique. and systems theory. Soldiers must be rators (those we work with). a legendary mav- software products. frameworks. and to sell you the right one.valuebased- Disciplines of requirements analysis. or sim. While its primary ous practitioners. jazz musicians must time. • Decide: Make the best decisions while Software developers must be able to write code avoiding groupthink. in the absence of a plan. Changing business were patterned after Boyd’s theories and many conditions or the actions of partners or competi. The name This may be surprising since each activity has “OODA” comes from the four phases in the loop: completely different domain-specific practices. ty/project-planning-tools/over view/pdsa- a squad of soldiers. software wrong technology or process. biases that can skew good individual or group decision-making. oration and the ability to execute on a plan.html) development. each with a method for execution and 14 best princi- accompanied by a horde of evangelists and zeal.asq. there is an easier way to fail. see http://www. and methods have come and gone. missing or deficient functionality. biology. ples that act on that method. Jazz musicians must be able to play • Orient: Interpret that data as useful information. success with best principles. military strate- must work in concert to produce creative solu.

Build Trust and Respect ity and correctness. INNOVATING for greater future success. allow process- es to be defined and customized in a way that tools can enact and enforce the process and guide people to do the right thing. Lead on Demand Individuals. Commitment wills iterative software development methods. it increases convergent thinking. and so forth. this can only happen when organizations decentralize leadership and — Adrian Cho has worked in the software development industry give people the power to make decisions and act. the must have some friction. ly be exploited by your competitors. Commit with Passion tation (reconsider what was observed). This is the essence of allows people to contribute without fear. Use Just Enough Rules 2. DOBB’S DIGEST 20 Mar ch 2010 www. it’s not really practical. ed. Exchange Ideas Concert ( Employ Top Talent The goal is to do all of this more rapidly than the competition. but without any such controls individual. the Artistic Director of the Impressions in hence the success of open source projects and IBM’s Open Jazz Orchestra. You can contact Adrian at jazzprocess. people to push through in spite of challenges. In software development. In support of executing are three principles. COLLABORATING thing before committing to a decision) may increase cycle time while 6. If one jazz musician remarks that another jazz Finally. • Employ Top Talent focuses on hiring and retaining the best • Reduce Friction is actually about optimizing friction. 3. Maintain Momentum people the autonomy to get things done. who were most objects would slide off even slightly sloped surfaces.” it’s a compliment that means the per. 2. and impact of everything we do. He currently manages the development of • Act Transparently focuses on open and honest communica. The team succeeds together and absorbs mistakes an organization exposes itself to intolerable risk. 14. Friction people possible. There are five principles in support of working. which enables more possible solutions to be generat- sense is acquiring all relevant data to understand what’s hap. At the same time. build health is everything • To Listen for Change is to know what’s going on at all times. jazz musicians place great importance on the skill of listening. 4. It also discourages people from consuming or participating — the Broken Window There are four principles in support of collaborating. Processes must be continually improved by being honest about problems and 12. A son is constantly aware and ready to respond to change and that team with diversity in technical experience increases divergent they are open to exchanging ideas. Left untended. Jazz Process Principles D r. Trust enables everything to happen more quickly. which pening in the team. for more than 20 years. Act Transparently The principles of the Jazz Process affect the execution of the . Infectious passion • Stay Healthy alerts us to the fact that injury to a project or excites and motivates others to participate and consume. 7. and anything that is will most like- Concert makes team awareness a high priority. • Exchange Ideas is the key to innovation fueled by diversity. a freelance jazz musician. together. teams. Retur n to Table of Contents DR. meetings. Listening in the abstract thinking. WORKING 1. Not surprisingly. Adrian is also them to collaborate. Put the Team First although it’s important that execution speed shouldn’t sacrifice qual. lishing regular cycles and rhythms for such tasks as planning.000 others failed. Aim for quality and not quantity. It helps avoid conflicting and duplicate efforts and undertake tasks that are free of risk. controls such as legal and finance are often seen as impedi- • Put the Team First places the team’s goals before those of any ments by software developers. D o b b ’s D i g e s t 1. Make Contributions Count loop. While it makes sense to only together. 5. Respect software Without it we couldn’t walk and project’s scientific and engineering geniuses. Take Measured Risks built on IBM’s Jazz team collaboration platform. value. Paths of reobservation (look twice). and this is espe. team can impair performance. hood that it could provide you with a competitive advantage. Reduce Friction enough process to avoid chaos and confusion while affording • Making Contributions Count is to carefully consider the book/). Theory. IBM’s Rational Team Concert and Rational’s Collaborative tion. One genius is resistance that can increase the difficulty and/or time taken may succeed where 1. Stay Healthy less-than-optimal execution and updating rules and practices 4. reinterpre. and what improves selection of the best possible solution. Tools such as IBM’s Rational Team 13. • Maintain Momentum promotes continual progress by estab- • Build Trust and Respect and Commit with Passion are essen. and broken builds must be repaired immediately. innovating is pursued through two principles: musician has “big ears. Collaboration. and the author of upcoming The Jazz Process: Commercial Software Development taking place at jazz. The Manhattan to complete a task. 8. Listen for Change feed-forward (predict by guessing or experience) may shorten it. Team awareness is vital to working • Take Measured Risks is reality. EXECUTING • Use Just Enough Rules is right-sized governance with just 10. Some causes of friction don’t seem like a Project’s race to develop the atomic bomb employed more than problem until you have to perform that task frequently. competitors are doing.000 people but it was a small group of individuals. Few facilitates synergy from complementary efforts. tial. • Lead on Demand is about taking initiative. and organizations all execute in OODA loops. When others can see what’s going on it makes it easier for Application Lifecycle Management project at jazz. 3. Customers also appreciate openness. poor health may degrade to a total loss of stability. and evaluation (try some. thereby reducing the likeli- cially important for geographically-distributed teams. what customers are thinking.jazzprocess. Yet you 130. It only takes one careless contribution to break a software development build. Business vital to the project. Rational Team things that are truly risk-free. Innovation and Agility (www.

This the fact that many people still cling to very seri. and due in part to the mating the cost and schedule of an IT project. some of which recommends a far greater the detailed use case/user story point counting range. reflect the amount of uncertainty in the informa. than 19%. dropping seem to struggle with how esti. Early in the specifications and vary mostly on algorithm project there is greater uncertainty so the range is minutiae (yes. I the original estimates at the end of the project to suspect that this is due in part to better align with the actual results (yikes). we need to give ranged estimates that and in the factors addressed by the algorithm. the Dr. then I describe the process of initial through your estimation algorithm of choice. is given a point rating. n200907. the for- throughout the agile lifecycle.ambysoft. the points practice. If we’re actually getting +/–19%. case points and user story points vary mainly on Sadly. as you’d expect there are raging greater. rhetoric within the agile community around the but they all boil down to the same basic idea: “evil practices” of traditional project manage.ddj. I start with a brief discussion ments. matting of those requirements. DR. both of them unfailingly unable to learn from previous experi. ever optimistic and the format of the requirement. ous misunderstandings about estimation. it is the other hand. due to the inherent uncertainty. On of a project. Dobb’s July 2009 State of the IT Union Survey.” At the beginning into their complex estimation algorithms. D o b b ’s D i g e s t Estimating on Agile Projects Upfront estimating from an agile viewpoint M by Scott W. This holds require fairly detailed requirements and design for both cost and schedule estimates. then are merely added up and multipliers applied to why am I recommending +/–30%? In addition to give cost and time estimates. decreasing the tion community). and then I The individual strategies will potentially vary by describe how to accurately update your estimates the level of detail in the requirements. Both techniques require you uncertainty and therefore the range in your esti. again. Dobb’s survey also found that to get step and go straight to educated guess(es) from +/–19% project managers often had to do a fair bit experienced high-level requirement. asks for a +/–11% range on average (see the relying on the ability of the team to guess at the Dr. Ambler any people who are new to agile of fudging such as padding the budget.D r. use case. do some thinking about the potential for the need for realistic expectations for initial solution(s). DOBB’S DIGEST 21 Mar ch 2010 www. senior management. being able to predict up front with precision what There are many strategies for initially esti- the cost of a project will be. scope once the budget ran out. to analyze your detailed specifications to count mates . the amount of As Barry Boehm has shown us again and detail of the architecture/design specification. COCOMO II and SLIM both tion on which our estimates are based. Other estimation the rather large body of knowledge about estima. but as the project progresses the quality religious debates about this within the estima- of the information improves. Gather some information about the require- ment. This is something that Boehm certain functional and technical aspects to plug calls the “cone of uncertainty. In this article. strategies go even further in that they skip over tion. size of the individual requirement. and then put this information estimating. estimation strategies around use reasonable to give estimates in the +/–30% range.html) and on average gets +/–19% in respectively. such as on average. estimating from an agile viewpoint. Once each http://www. requiring significantly less specification but ences. implies that we need an initial range far greater. or user story. or even updating mating occurs on agile projects. For example.

You’re a member of an agile proj. Including the four Let’s work through an example.000 ((32 + 6) weeks * $5000 * 4 people).” something esting because there are two options for your burndown rate: the that varies throughout the project for several reasons. Arguably the only thing that these complex estimating tech. There is also an work. naive belief that this will improve the team’s motivation to . your team projects will require 15 sprints that people aren’t good at. You’ve been asked by with the detailed approaches. Your sprint little guesses should balance out and the overall error should be length is two weeks.ddj. But. on the ability of the estimator(s). something we know down rate of 20 points. or the net velocity. which is September 24th. You spent the month of January team will deliver in 32 weeks (14*2+4) on November 5 for a total in “sprint 0” — which is also called iteration 0. your team feels that it’s possible that they specifications because of the amount of effort put into calculating can deliver by the end of August as requested. sprint you delivered 24 points of functionality. obtained support for the project. even though this estimate was based on guesses you’re going to do so.000 * 4 people). You analysis. mating because at the beginning of a project someone is going to In the end. The change in Now the estimate of the delivery date becomes a bit more inter- remaining work to do is called the “burndown rate. the guesses based on detailed information still have expected labor cost of $680. sprint you still identified six points of new functionality. and the burn down rate. At this ty is something called a “burn down chart”. senior management takes your August estimate as a ask you to indicate what you think you’re going to deliver. your guess at your initial velocity is 20 points much smaller as a result. you’ll need to give ranged answers at first and then describes tech. our intuition is pretty much wrong on this shared vision. Burn down charts point in time you now have 320 points of functionality due to the show the amount of work on the project along the vertical “Y” influx of new requirements. the gross velocity is 24 points and the net all labor portion of the expected cost of the project (non-labor velocity is 18 points (24–6). travel costs. In the previous project. which is the num- ily project when you expect to be done. ered by the team each sprint.D r. and using net velocity the to be guessed). In theory. the errors in each of the senior management to deliver the system by August 31. because you’ve been getting great feed- methodology (http://www. Then. So. software delivery projects regardless of paradigm). a bit better than you en up your answers as the project progresses. sprint. architecture rate than the techniques which rely on the best guesses of the peo. In short. access and time along the horizontal “X” axis. weeks required for release. on the ability of the people doing the to complete construction (300/20). also believe that it will take an additional four weeks to release the tecture. D o b b ’s D i g e s t On the surface of things.000 (34 weeks * $5.agilemodeling. the gross velocity indicates that the ect team that started on January 1. you think it will take. All of the little guesses are dependent on the ability of the have 300 points of work on your product backlog. The challenge is that there is still a lot of guessing going on team. and obtained a working environment. put together the issue. and in the third A common progress reporting technique in the agile communi. your burdened labor costs are $5000 per week per were independent of each other. with an expected release date of 34 weeks knowledge of the skills and ability of the people doing the actual from February 1st. which is 30 weeks (15*2). construction phase is 18 sprints (320/18). Because of the inherent uncertainty in the Let’s move ahead to March 29. you can eas. and so on will still need tion phase is now 14 sprints (320/24). and how long about the scope and the ability of the team to deliver functionality. and DR. such as hardware costs. DOBB’S DIGEST 22 Mar ch 2010 www. Let’s explore how to tified a lot of missing requirements (this is a common occurrence on address the questions about the cost and schedule estimates. which is the number of points of functionality deliv- how much work is left to do. developed a ple involved. envisioning to identify a realistic technical strategy. Sadly. labor cost of $760. because them. you can estimate the over. the beginning of the fourth sprint information that you have available to you at the beginning of a where you’re doing sprint planning that morning. the warm up phase. how much it’s going to cost. In this case. you think you need four people on the team. given the expected ber of points that the product backlog shrank by the previous end date and your current labor costs. This would be true if the little guesses per sprint. ment simply forces the team to commit to the lower estimate in a The reality is that you’re going to need to do some initial esti. The Agile Modeling had initially guessed. of cultural dysfunction within your organization. sioning to identify the initial high-level requirements. yet they Because you’re also overly optimistic and unable to learn from appear to be less risky than the estimates based on less-detailed previous experiences. how commitment. the team chooses niques are doing is putting a “scientific facade” over an activity not to give a ranged estimate because in the past senior manage- that is still mostly an art. intuition tells us that the estimation or the inception phase — where you performed requirements envi- techniques based on detailed specifications should be more accu. an incredible amount of uncertainty built into them. and you not. on the ability of the people developing the detailed archi. Worse yet. Using the gross velocity the construc- costs. with a burn- stakeholders to describe their requirements. Based on gross velocity. and on the estimator’s system into production. but the problem is that they’re employee. back from your stakeholders in the first and second sprint you iden- niques applicable to the first two questions.

In this case the top end of your estimated range would be infinite. applying agile strategies in the complex You can see where the scenario is going. to make a delivery date of August 27 (the last “Introduction to the Agile Scaling Model” (https://www. you can have intelligent conversations based on actual The most realistic thing to do is to take the conservative data. Now the expected delivery date is between 30 weeks At www. • First. Great Lies. with 22 points around how detailed specifications can increase. • Third. which is November 20 Project team. problems as early as possible instead of letting them fester ule based on our actuals. a problem which will correct itself once your stakeholders have a better understanding of what they actually want.000 (40 * $5000 * 4) and $ you can see the project dashboard of the Jazz (285/22*2+4) and 36 weeks (285/18*2+4). I examine the tra- the team. velocity. Technology Practices” page (http://www. Adding people to the team runs the risk of running afoul ditional strategy of EVM for monitoring your project actuals of Brook’s Law (http://en.ambysoft. I just wanted to My Agility@Scale blog discusses strategies for adopting and leave you with a few more points. • Fourth. even when the status is bad. which could include letting In “Questioning Earned Value Management (EVM) on IT Projects” the delivery date slip. uct 22) points of work — so you need to drop between 131 (285–154) which provides advice for scaling agile strategies to meet the and 159 points of functionality from the existing product backlog unique needs of your project. we now have an easy strate.html) explored shouldn’t be a problem. although more accurate. the delivered the previous sprint and four points added to your prod. You should discuss Hot Links strategies for rectifying the problem. • Second. talk about. The Danger of Detailed Speculations summarizes the evidence There are now 285 points on the product backlog. Time for another dis. the important thing is links to the results of all the implying that you can do between 126 (14/2 * 18) and 154 (14/2 * led_speculations?lang=en) summarizes the ASM framework. but either way it doesn’t look like this like what they’re hearing. risk on your IT projects. would be to use average rates for your velocity calcu. Dobb’s 2009 State of the IT Union Survey (http://www later. or increasing the size of (http://www. Alternatively. but the numbers speak for them- team will make its date. respectively. it is common to have a negative net velocity in the first — Scott Ambler is Chief Methodologist/Agile and SOA at IBM few sprints due to an increase in requirements as your stake. Dobb’s July 2009 State of the IT Union Survey.ambysoft. senior management tells you to project management and governance issues. selves. given your current gross and net velocities. Sadly. . including the burn down chart that is automatically and December 31. If your project is in . about the situation. The project status goes red and (http://www. “Lies.drdobbs. cutting functionality. project teams must be as open and honest about their current sta- tus as possible. We could have also given a ranged esti. Dobb’s surveys that I’ve run over that it is relatively straightforward to update your estimates as you the years. not decrease. Retur n to Table of Contents DR. progress throughout an agile development project. The “Surveys Exploring the Current State of Information cussion with senior management. you should inform senior management mented tooling it’s possible to automate these calculations. DOBB’S DIGEST 23 Mar ch 2010 www.000 (46 * $5000 * develop Jazz.jazz. it’s better to correct the gy for giving a realistic ranged estimate for both the cost and sched. results of the Dr. which states that adding more people to a late project makes it The Dr.D r. the beginning of the sixth sprint. holders see the working solution at first. stick to the existing date with the existing team and still deliv. Move forward to April 26. Rational.wikipedia. For your IT governance strategy to be effective. a slightly more complicated approach. against the plan. although the team is still early in the lifecycle so this . not on wishful Friday in August) you have only 14 weeks of construction left. 4).ddj. and Software Development Project Plans” er all the required functionality. doing these calculations by hand is part of the hidden mate at the very beginning of the project by estimating the initial bureaucracy in agile software development that we don’t often velocity as a range. Interestingly. over D o b b ’s D i g e s t the net velocity in 40 weeks (18*2+4) on December 31st for a total lated over several sprints instead of just the previous sprint’s labor cost of $920. The good news is that with integrated and instru- At this point in explores the team morale goes down.000 ((40+6) weeks * $5000 * 4 people). Senior management might not approach with net velocity. The cost is now estimated to be generated by the Jazz-based development tools used by the team to between $800.

Erica’s explanations and code deconstructions are clear the shortcomings of the original. loads and even building a simple web-based server. the iPhone Developer’s Cookbook services for reading and interpreting the iPhone’s built-in GPS. and tricks for iPhone application developers than other iPhone introductory texts by detailing the procedures spanning the spectrum of experience.0 language to programming the latest The book’s sample code can be downloaded from Erica’s iPhone capabilities like gestures and push notifications and learn.0 SDK. To respond to these additions as well as address al level. making the journey toward iPhone SDK mas- doubled in its page count by adding new chapters on everything tery a knowledge-rich and memorable one. touches and multi-touches. dling gestures including shake events. These chapters cover such diverse topics as working with tab bars. for both aspiring and experienced iPhone developers. and the Objective-C language. Reading the book from and considerations of purchasing an iPhone developer’s program cover to cover will elevate both the breadth and depth of knowl- to deploy iPhone applications to actual hardware devices as well edge needed by iPhone and future iPad application creators as to Apple’s App Store. compass. more polished and profession- to the platform. fading and flipping views. everywhere. A sample Overall. tributions from the readers toward future editions. writers. After the new 50+ page crash course chapter on Objective-C. Core Data. installing. It goes further ful routines. the Core Data and In-App Purchasing and Accessibility Plus services book was even considered for a Jolt award during that timeframe. playing and recording audio and the rescue with the publication of her second edition of the video. the second edition has more than and easy to follow. dealing with text entries. this second edition of The iPhone Developer’s Hello World project helps familiarize readers with the IDE. Return to Table of Contents DR.ddj. a 30+ page chapter on working with push notifications fol- iPhone Developer’s Cookbook. a practice that is gaining favor among tech book ing and leveraging the Accessibility Plus. D o b b ’s D i g e s t [ Book Review ] The iPhone Developer’s Cookbook Reviewed by Mike Riley The iPhone Developer’s Cookbook: Building Applications with the iPhone 3.D r. 2nd Edition Erica Sadun Addison-Wesley Pr ofessional $44.x release of the iPhone tions that will provide iPhone developers with the tips needed to operating system adding GPS. Other recipes Fortunately. Indeed. han. DOBB’S DIGEST 24 Mar ch 2010 www. faster graphics. alerts and table views. using core animation for view transitions. chapters on interacting with the iPHone’s Address . tips. Read on for my review. lowed by a chapter on using the new Core Location and MapKit Originally published in 2008. e-mailing pictures. author and iPhone hacker Erica Sadun has come to include monitoring battery state. over a dozen network- Objective-C/Cocoa framework combination. cap an amazing volume of valuable code snippets and explana- Since then. was immediately recognized as a treasure trove of tips and tricks Finally. renewed interest in the iPhone SDK has gar. and configuring the Xcode environment. Apple has rolled out its major 3. leveraging nered accelerating exploration into the GameKit for data transfer and voice chat. ing recipes for dealing with synchronous and asynchronous down- Learning the nuances of this platform can be challenging. the numerous code sample recipes are presented in the remaining 18 chapters. Github account. munity feedback aspects that help refine code examples and con- The book begins with the usual SDK introduction of obtaining. Cookbook represents an outstanding collection of immensely use- iPhone Simulator. The Github hosting concept works because of the com- and StoreKit In-App purchasing services. from the Objective-C 2. and more take their applications to a higher. GameKit. live camera overlays.99 W ith the impending release of the Apple iPad.

Dobb’s: Why do we see more ugly team than is that team members aren’t afraid to fail. helped us see that the whole exploration of how All of us have been on at least one. it will help you make mistakes faster. Dobb’s: What qualities define a “beautiful” was built by great teams before these things had team? even been invented. just adding a tool won’t fix the problem. then when one person goes out bosses who sink your project. stage for an effective — even “beautiful” — team Dr. and constant communi- Dr. Most of the — people who don’t get along. Finally. It’s the nature of above” or something else? working on projects. But if you’ve got a team that’s deeply can figure out a way to get past the obstacle. things. One thing that can set the techniques. sunk by its obstacles. problems with on a limb. A team beautiful teams? that’s afraid of failure is a team that isn’t going to Stellman: Because it’s very easy for a team to get take risks. of Stellman & Greene. If a team can get past its Stellman: Teams that might be considered flawed obstacles. and risk-taking is how innovation hap. team permanently. unremarkable teams muddle through the projects or their companies or the world in gener.D r. They recently spoke with continuous integration. DR. obstacles and deliver something. We’ve gotten so used to ly. Another quality is trust. are the editors of Beautiful Teams: Dr. either. problems with the time. D o b b ’s D i g e s t [ Conversations ] Q&A: Teamwork It’s all about trust and techniques A by Jonathan Erickson ndrew Stellman and Jennifer Greene At best. great software is Stellman: There’s no single magic formula to still being built by teams that don’t use agile make a team work. a complete lack of those great qualities that we that “ugly” as much as “plain” — not beautiful. Indeed. This was a realization for us because it There are definitely truly ugly teams out there. Dr. everyone else won’t have a knee-jerk buildings and facilities. Stellman: Absolutely.ddj. and those obstacles come in pens. have a shot at turning ugly into beautiful. it bonds them together. a great you can’t and principals Agile practices like test-driven development. The funny thing is that if the team be better. Dobb’s: Can teams thrive in non-agile envi- Inspiring and Cautionary Tales from ronments? Veteran Team Leaders (http://oreil. The ugliest teams are the into a beautiful one? ones with the biggest obstacles that don’t manage Stellman: A good team tool can help a good team to get over them. If team members many forms: people who can’t work together. We wouldn’t call al. Dobb’s editor-in-chief Jonathan Erickson. cation between the team and users that we have trouble remembering that a lot of great software Dr. or the project that lots of contradictions and messiness. Maybe it’s the teams work and what makes them tick is more one with the boss who yelled at the junior team complicated than we thought at first. trust each other. Dobb’s: Can tools alone turn an ugly team celed at the last minute. Dobb’s: Is an ugly team simply “none of the Every team faces obstacles. just talked about — can still accomplish great but not too unattractive. they . you worked 70 hours a week on only to see it can- Dr. There are member until he started crying. Sometimes they can break up a team has great leadership. bad product ideas that reaction and pull him or her back. DOBB’S DIGEST 25 Mar ch 2010 www.

NASA has some very good examples in its past. We built a really high quality piece of soft- ware: It was used to do many thousands of calculations (some runs lasted for weeks at a time). bringing the users right onto the team) — we’ve gotten so used to these as part of our day-to-day work that we have trouble remem- bering that a lot of great software was built by great teams before these things had even been invented. continuous integration. a lot of great software is still built by teams that don’t use agile techniques. there’s a lot in common with the teams and team- work that Peter described at NASA and a good agile team. D o b b ’s D i g e s t This is exactly why in our book that we wanted to talk to Peter Gluck. in the best case. we’re really pleased that it’s possible to ask a question like the one you asked about whether or not teams can thrive in non-agile envi- ronments.D r. That said. in our opinion. In fact. We were working on a great project that was interesting. the best team either of us have been on was the team that was just the two of us. and. That’s not exactly some- thing that you can automate and run continuously. Retur n to Table of Contents DR. That’s something that we really credit the agile move- ment with: making quality the developer’s responsibility. and we never had to fix a single bug after the software was . Dobb’s: What’s the best example of a software development team you’ve run across? Stellman: To be honest. user stories and other agile requirements techniques. As Peter showed us. Agile practices like test-driven development. We had great rapport as a team and with our client. The biggest one is that everyone on the team takes quality very. and we got a lot out of working on something that was going to actual- ly help peoples’ lives. very seriously. He pointed out that their integra- tion process generally involved putting a rover or satellite in a clean room and loading software onto it. challenging. constant commu- nication between the team and the users (and. important.ddj. We were building software for public health researchers who were studying the effects of herbicide exposure on Vietnam veterans. like continuous integration. DOBB’S DIGEST 26 Mar ch 2010 www. Indeed. who manages software teams at NASA. and most importantly. well-planned time-boxed releases with high enough quality that they can actually ship. We specifically asked him about tools and techniques you’d find on an agile proj- ect. Dr.

the formatting is automatically generated according to a style sheet. for each language and each deliverable. just as important. and more important for sim shipping. • Third. D o b b ’s D i g e s t [ Other Voices ] The Sim Ship Standard Meeting the growing expectation of simultaneous shipment with XML I by Su-Laine Yeo n the global economy. speak 20 or more languages. at the same time. and all of the formatting work is automated. BusinessObjects faced huge translation costs. industry watchers and others who.D r. employees. DOBB’S DIGEST 27 Mar ch 2010 www. effectively generating 40 to 50 DR. regardless of the target language into which that document is being translated. a writer is going to sort content in one language. it prevents translation duplication. Often. Before adopting XML. XML supports content reuse to drive significant cost savings. XML saves time by separating content and formatting. • Second. Companies are expected to deliver their messages to a global audi- ence. in the form of news. analysis or other con- tent.ddj. Without XML. It’s a huge manual effort that’s now automated by XML. Any given product description could be used in marketing materials. Content reuse prevents content duplication. With XML. partners. No matter how many revisions the content goes through. XML enables automatic information sorting based on the target language. weeks can pass before a company is ready to sim ship. a document includes sections that are supposed to remain in the native language. The mar- keting organization alone supported 12 languages in print and on the Web. on the website. And XML is the most efficient way for companies to meet that expectation. XML lets companies mark what parts of a document should be translated and. What took so long? Formatting the content for each language. the computer — not the writer — sorts content that’s alphabetized. • . Regardless. each one of those busi- ness units had to retranslate the description into 12 languages. its build times have shrunk from days to minutes. That’s what happened at BusinessObjects. Basically. or HTML file look good and read correctly in the given language. Without XML. or the message might be the product itself. minimizing content redundancy saves a lot of money. content is formatted with the push of a button. in tech support materials. XML brings other advantages to companies that sim ship or want to do so. Of course. in a wide variety of languages. Now. as well as product materials. together. Whenever a product description changed. That’s a huge advantage in the world of sim ship. Nobody has to manually refor- mat for each revision. The audience may be customers. The message might be about a prod- uct. content would come back from the trans- lator. The ability to mark such sections “do not translate” eliminates the errors that occur when content is accidentally translated. Since BusinessObjects moved to XML. sim ship is expected for even rapidly and fre- quently updated messages and content. and then translators have to resort that content into each language. what parts should not be translated. and somebody on the documentation team would spend a day or two making that FrameMaker. The company writes content in English and localizes it for up to 10 other lan- guages. “sim ship” — simultaneously shipping in multiple languages — is becoming the new normal. Word. such as a glossary. When a company pays by the word to translate content. and its build times were as high as two days per deliverable per language.

indeed. JustSystems and an active member of the OASIS DITA Technical ferent translation firms and end up with essentially different con. the same target language.ddj. to all of the target formats. Nothing those systems do. as a . And each time somebody has to manually edit that The product description is translated into the target lan- r.yeo@justsys- tent. Committee. supported. Whether a company is try- lation is yet another way to drive down translation costs. it reduces the risk of errors companies committed to sim ship. They take the — Su-Laine Yeo is a solutions consultant for XMetaL at same English content and get it translated. XML streamlines that process. XML dramatically acceler- lifecycle. more effectively in multiple languages. XML has been around for a while. DOBB’S DIGEST 28 Mar ch 2010 www. For XML doesn’t just reduce costs. Same input. • Fourth. And while guages. And they generate different content Retur n to Table of Contents DR. XML is the new normal. D o b b ’s D i g e s t projects for each change. For example. but sim shipping is translate only those portions of a document (or other content) driving more organizations to embrace XML and deliver content that have changed since the last translation. XML supports incremental translation — the ability to Sure. different outputs because even though they use tems. Incremental trans. take two different departments in the same organization. Now. and then the business units format the con- tent for their deliverables. adding can be released until the content is published in all of the target XML to the mix helps reduce costs across the entire content languages. manual and redundant processes are crippling. reduce translation costs. Companies also use translation memory systems to reduce the sumers or messaging documents to employees in multiple lan- number of words that need to be re-translated. that are magnified by multiple languages. You can contact Su-Laine at su-laine. the translation firms use different phrases and word structures. ates time to message. but they use two dif. offering an alternative to days and weeks spent formatting. sorting and performing other tasks by hand. the risk of error is magnified by the number of languages guages one time. ing to sim ship products (and product documentation) to con- XML isn’t the only technology that supports this feature. Now.

The part about Larry Ellison sniffing glue is a total lie.” You click “Next. That’s one of those catch questions. Pretty nearly. You click “Next. You see some guy with a beard thrusting his face into the camera: “You’ve got Cloud A and you’ve got Cloud B and there’s storms and rain. DOBB’S DIGEST 29 Mar ch 2010 www. I choose “What is cloud computing?” Since this is a text-only article.” This is the main attraction of Chatroulette. You see a folk singer: “LANs and WANs and endless cords. It’s really popular. so I’ll have to make it up. there isn’t anything to describe.” You click “Next.” You ask yourself why you’re doing this. He doesn’t. Who then either disgust you or reject you.ddj. word-for-word. (All of these snippets can be found. And since we don’t yet have Themed Chatroulette. “As they age.right? W eb technologies like Facebook and Twitter go through stages as they mature. You just change a term and they think you’ve invented technology.” You click “Next.” You see an IT guy looking mystified: “I have no idea. Anyway.” Sometimes the people are scary.” You click “Next. It’s spirichal. except you don’t remember offhand just what he did to get marginally famous. even an iPod Shuffle can provide degrees of randomness.” You see Marc Benioff of SalesForce smirking: “.com/magazines). I’ll piece it togeth- er from found video on the web.” You click “Next..” So isn’t it reasonable to assume that Chatroulette (http://chatroulette.” You see Adolph Hitler surrounded by his senior officers: “You n00bs! You fell for a bunch of marketing and slick glossies from some tradeshow booth bimbo! You outsourced all our data to a Cloud Computing provider that hosts in Leningrad?” That one seems staged. ‘Let’s call that cloud. the ability to dismiss annoying people with the click of a button. Rather than seeing the same random people every- body else sees doing the same random things. That ought to produce a fair test of my theory. I think we’ve all learned something from that experiment. it seems to me. Retur n to Table of Contents DR. by looking for “cloud computing” on YouTube. here we go.” You see Larry Ellison sniffing glue: “Yeah. Kshhh! And in that bolt of lightning you get one tera peta flops of information!” You click “Next.. change ‘internet’ to ‘cloud’. Okay.” You click “Next” and say. Although your experience may be different from mine.” Chatroulette presents you with plenty of annoying people to feed your need to click them away.” You see a gentleman of the redneck persuasion: “It’s like a angelic kinda — ..D r. Perfect. it’s a website that connects you via webcam with random strangers. You see Rafe Needleman wearing a namebadge so you know who he is: “Yeah.” You click “Next..” You know Matt Mullenweg is somebody.. in an will go through similar stages? You know about Chatroulette. You see Larry Ellison waving his hands and ranting: “What is cloud computing? Take Microsoft Word.” You see a random rock star: “You’re tryin’ to trick me.pragprog. I think that the Chatroulette phenomenon is bound to evolve. amen. You click “New game. Dobb’s and editor of PragPub (http://www.) — Michael Swaine is a senior contributing editor to Dr. right? It takes more time to explain it than for you to follow the link. So let’s see how this might play out. That’s not far- fetched. you’ll customize your random selection by keying in a theme or phrase.” You see Matt Mullenweg: “It should be like Care Bears. this year it’s puce.. You wait to see if he will elaborate. maybe “mature” is not the word I want. That’s why I’m asking Wikipedia.” You see some guy with a Giant Pac-Man hanging over his head: “Cloud computing is a bit like Liquid Paper.” You see Larry Ellison waving an Evian bottle: “Our industry is so bizarre.” You see Larry Ellison leaning into the camera: “. You click “Next. You disconnect.’ Sure beats innovation. You click “Next.and if you can understand that then you’ll know why cloud computing is what it is. And then light- ning goes between the clouds.SalesForce became cloud computing for the same reason Chanel last year was fuschia.” You click “Next. brother.. and I’m betting that the next stage will be Themed Chatroulette.. That’s cloud computing. Happy. What I’ll do is. Anyway. D o b b ’s D i g e s t [ Flames ] Variations on a Meme Social media maturing? You’re kidding. but for those who like some telling along with their showing. As our example theme. give it back to these nitwits on Sand Hill Road.” You click “Next.” You’ve had enough. you’ll have to imagine the video.. Well. It’s a experience. anyway. Or whatever it is we’re doing here.