Category: Business Process

  • Who Has Time for Unit Tests?

    A couple months ago, I read about dpUInt, yet another unit testing framework for Flex. I got it from reading the docs, it seemed easy to add to an existing or new project, and I’m all gung ho for giving it a try. If it sucks, I know I have both FlexUnit and VisualFlexUnit as back up frameworks.

    Test Driven Development practitioners are very passionate about what they do. They give off this air that my early OOP mentor’s also did, “Once you go TDD, you never go back”. The funny thing about OOP in Flash is how quickly it dies a pathetic little death when a deadline rears its head.

    The amount of sustainable OOP in Flash is proportional to the deadline length. If I have 2 months, classes & framework for the win. If I have 2 days, screw you, on(press) { copyPasteCodeOnObjectsAndInFrames(); } and then show client early ’cause you know they’ll have massive changes.

    Is unit testing like this? When I read Peter Bell’s blog, and other unit testing scenarios, I get the sense that an existing solid software base is used. Templates are modified, run through tests to ensure the new code & design works, and then the code is deployed. This cookie cutter pattern repeats, and can repeat, because the original software is solid, is customizable for a wide variety of common customer needs, and unit tests ensure everything keeps humming along.

    The other sense I get is developers already know what they’re going to write.

    I’ve never been in either scenario. Either I’ve had to build from scratch, re-write from scratch, or build atop of crap because the client heard “re-write” and thus freaked out (thus re-writing from scratch). Even in the best planned waterfall based projects with good IA’s, and somewhat flexible deadlines, it’s always been a process of discovery, modified requirements, and re-factoring/re-coding. This is in partly why I enjoy programming in Flash & Flex. Not only do I get to do that stuff with code, but also with design.

    Therefore, it’s really hard for me to imagine how I could START writing test cases first in my project. The closest I’ve come to writing “tests” is when I create a new FLA to test a component that’s acting weird. Instead of testing the entire project, I’ll just boot up a new FLA in Flash, import the component, create it, throw some fake data at it and see what happens. In this way, I can more quickly find the problem, AND re-use the testing FLA (70% of the FLA’s anyway) at a later date if the component acts up again. This is after the fact, though.

    The same thing in Flex. If I inspect the HTTP traffic through Charles, and see that the webservice is returning everything fine, and debugging doesn’t reveal anything obvious, I’ll set up a test file that instantiates controls in a really simple environment. Instead of a large app, it’s 2 controls that interact with simple fake data. Again, this really helps me isolate problems and more easily find them. It also makes it easier for me to not only test later, but quickly test smaller portions of my code.

    Granted, sometimes I don’t like “going to all that trouble” and keep doing risk debugging; where you swear that in just 1 more compile you’ll find the bug and fix it… yet this is the 4th time you’ve said that and you could of already been well on your way creating a test harness to more quickly and assuredly find and fix the problem…

    Again, though, after the fact.

    Like everything in programming, I’m still reading more sources to get a better idea, it’s just hard to get a good feel for who in the Flex & Flash community is doing unit testing, and how. With the influx of traditional developers in the Flex world, I’m seeing more talk about it, yet not enough case studies with good details on how the work flow actually works from requirements gathering to sitting down and coding. Flash devs’ll try anything, just point us to the right way!

    People would ask me to justify the time it takes to actually use Cairngorm. In their example code, all they really did was neatly wrap 1 line of code setting 1 variable on a single ModelLocator in a Command. I’d respond that either they wait 3 months, and compare the newest Command in SVN with the one they emailed me to get their answer. If that didn’t make any sense, or they just didn’t want to have faith in JXL, I’d instead point them to a lighter weight framework.

    Am I in the same predicament? Are my deadlines, lack of hardcore requirements, and/or inability to easily articulate a base design preventing me from really benefiting from formal unit testing or do I just need to read more?

  • When Do You Let Go of 8?

    When is the right time to stop publishing to Flash Player 8 and start publishing to Flash Player 9? I’m struggling with this at work right now. All of my peers at work say “now” from engineering, design, and upper management. Engineering says it mainly from the variety of benefits Flash Player 9 gives us on the video player front:

    • run-time skinning more easily coded
    • easier to generate SWF’s server-side
    • ActionScript 3 is a better language for engineers to contribute

    Just because you move to Flash Player 9 doesn’t mean you have to use ActionScript 3. However, there isn’t much of a point if you have a team of engineers. If you’re alone, sure, you can stop getting compile warnings for Stage.displayMode, and run h.264 run-time video with confidence, all using AS2 or AS1. You can even upgrade legacy content with a simple re-compile.

    Design says it mainly from lessons learned in the past. By designing for the hear and now vs. the future, you limit your scope of what you can accomplish. By the time your efforts are done, the future is already here. Meaning, choosing not to take advantage of Flash Player 8’s design features because of your most recent Google Analytics & other tracking mechanisms was not necessarily the best choice because by the time the endeavors were done, customers were already massively upon Flash Player 8 adoption. Ease of run-time skinning helps as a motivator as well. Both Design and Engineering agree that you are not “excluding the 25%” that doesn’t have 9. Rather, the majority of them are on IE, and those that are can use Express Install without rebooting their browser. That means that those potential customers actually do the upgrade, and thus you don’t lose a whopping 25%, rather you only potentially lose a small amount OF that 25%. I’ve never seen Express Install work on my Mac, but it does work on PC, and that’s what’s important, hehe.

    Management bases it on the short life-cycles of existing content. Clients typically want new additions to existing players. Modifying the code bases to these players already underway, with new features being added, why not upgrade them to the new stuff while your adding new features anyway? Customers will soon start asking for h.264 for valid reasons (the video quality isf’ing sick and doesn’t cost the unreasonable bling that On2 asks)… and start asking for “Flash Player 9” for unreasonable reasons. Either one, however, is a valid business reason (for the most part). Customer wants, customer gets.

    So, I pretty much stand alone in my stance to remain, at least for the next 4 months, using Flash Player 8, ActionScript 2. We have a lot of legacy content that is in Flash Player 8 and below that will never go away and will continue to be supported. New stuff, however, created for a better future based on lessons learned is contentious right now since soo much is at stake. Therefore, it deserves multiple discussions, pro’s and con’s to be laid out, and ultimately up to management to drive the version decision to a conclusion. My stance is that:

    • Flash Player 8 still is king in viewership, 7 much more so
    • Clients who use our API(s) and/or component sets may be at the AS1 to Flash 6 level of coding skills; we need to provide for those customers
    • Clients who are at the ActionScript 3 and/or Flex level, we can support that code base in tandem

    Though my reasons are few, I think they are valid enough to be a strong argument, or at worst a decent devils’ advocate. For the first, the latest numbers of 86% of Flash Player 9 viewership aren’t enough to compel me.

    For the second, most blogs I read and most Flash devs working in the agency world or doing small RIA scope work keep repeating the same thing: “I can’t wait till I get an AS3 project.” Meaning, they aren’t getting AS3 projects. Meaning, those clients they work for aren’t deploying Flash content on Flash Player 9 AND ActionScript 3. The key here is Flash Player 9 AND ActionScript 3. Any Flash user who doesn’t know ActionScript 3 can easily publish for Flash Player 9 in ActionScript 1. It’s the dual requirements here that clearly set the tone. In my opinion, most Flash devs will get AS3 no problem. Package & class name instead of just class name, addChild instead of attachMovie, and stricter strong-typing. Woop dee doo; for some, 4 days, for others, 3 weeks. Both to me are reasonable time frames to get up to speed, especially in the faster paced worlds a lot of Flash devs live in. Let me ad the caveat that I think those are the few, and the rest won’t use ActionScript 3. Either that, or they won’t know that their timeline code is magically being converted to classes. :: shrugs ::

    So, by satisfying that market of customers still using ActionScript 1 and 2 code bases as well as also providing a solution for the ActionScript 3 + Flex world, the only cost is that we have 2 code bases targeted at different needs. Remember, they aren’t the same code bases; 1 written in ActionScript 2 and 1, whilst another written in ActionScript 3. Rather, 1 targets the programmers, and 1 targets the hybrids and designer crowd. To me, that seems the most conservative approach.

    To buttress this argument, Flash’ success was built on it’s scripting being added to support minor interactivity in animations. While ActionScript 1 allowed us to create full blown applications, that was a tipping point for Flash development where a lot of paths diverged. Animators, Developers, Designers… we all used the same product, but in different ways. The one thing we all had in common was lightweight scripting helped us accomplish our goals. Over the time, the developers were the ones who demanded more, especially when the scope of the projects increased, as did expectations, which in turn increased the scope. Awesome cycle.

    If you look at what Microsoft is doing with Silverlight, they are providing the very same scenario, only for a version 1 product. I can’t honestly say what Flash had in 1 and 2 in terms of scripting, but I do know it was enough. If you’ve seen anything in Silverlight 1.0, it’s more than enough. It’s JavaScript, it’s approachable, and it’s strictly targeted at the same market a lot of us Flash Developers came from. The “my animation needs some minor interactivity” market. The download API Sliverlight has is exactly like AJAX on purpose. Both Adobe and Microsoft realized (Microsoft sooner than Adobe) that they couldn’t fight the AJAX market, so instead embraced it. Microsoft knows that while a lot of the hardcore .NET guys who do full-time C# or VB aren’t going the touch the 1.0 version of Sliverlight with a 10 foot pole, there are tons who will. JavaScript never stopped the Ruby on Rails revolution, nor the rest of the swathes of AJAX programmers out there, a lot who also do heavy server-side development.

    The point is, non-strongly typed languages who support animation & rich design systems are a valid run-time environment. They are worth building tool sets and frameworks around as a business model. People will purchase them, and use them in projects. Aka, they aren’t going away. ActionScript 2 and 1 aren’t going away anytime soon, regardless of how many people upgrade to Flash Player 9. While the counter point is that it’ll be easier to find a Java chick and train her on ActionScript 3 vs. finding a Java chick and training her on ActionScript 2, this isn’t a cut and dry argument on just language semantics; it’s about target demographics, and how that demographic uses and perceives code in contributing to their projects.

    All the Flex guys have moved on from Flex 1.5 to 2. With Papervision3D’s (I am Jack’s desire for brrr) success, agency’s are using that as a hopeful tipping point to move to Flash Player 9 (Flash Player 8’s font engine was the tipping point for 7). Programmers from a variety of backgrounds are building ActonScript 3 libraries like crazy. However, I still argue Flash Player 8 to Flash Player 9 migration isn’t as cut and dry as it was in the past.

    1. I was in high-school, didn’t use computers.
    2. I was in high-school, didn’t use computers
    3. I played with it, went back to fabrication & Ultima Online…
    4. I was using Director
    5. I was using Director, but then saw Expert mode, and dropped Director like a ton of bricks; attachMovie vs. sprite channels? Um, no brainer. == yes
    6. Dude, built-in FLEM (aka, dynamic attaching of events to MovieClip’s via code) == hell yes
    7. Uh… middle mouse, fake CSS, and TextSnapshot only for FlashPaper? Well, they DID optimize XML for the 3rd time, has external FLV loading, and it has getNextHighestDepth, so… == yes!
    8. MOTION BLUR!!! Hot fonts, and new Garbage Collector. == yes
    9. Er… faster code? Less RAM usage? Run-time exceptions? I hear programmers like those things, not me, hrm. Dude, why can’t my 9 SWF talk to my 8 SWF? == no …but in Flex, my code actually scales on projects == yes!

    Obviously this entry is skewed toward my job, and my target market. Regardless, I still think the 8 to 9 bridge isn’t cut and dry. It’s complex, and more of a dramatic jump. I think we all agree it’s worth it, it’s just that you can’t assume you’ll never see F8/AS2 & AS1 content ever again, nor have to support it. If you develop API’s for other developers, this is a big deal.

    Are you a Flash Developer that’s let go of 8? How? Why?

  • Implementing Coding Standards in Your Workplace?

    Every time someone blogs about the way they code on a blog, the comments always have one person who writes about how their company/department/group has the described technique as a coding standard in their company. From using a new line for squiggly brackets, to no code on the timeline in Flash files, all the way to using a specific coding framework (Rails, Mach-2, Cairngorm, etc.).

    What I want to know is, how does one “implement” said standards? How does one enforce them?

    Reason I ask is that in my new job, I’m taking the ball with formalizing a variety of projects and code bases to fit a road map. I work with a team, and that team is on a variety of projects, each of which has their code base. My concern for the client side Flash and Flex portions is that there is currently no enforced standards. We can all code on our own way because currently we have very little involvement with each other’s endeavors. The expectations are that you code well, hit deadlines, and keep management informed.

    That’s all well and good for the short-term, but after seeing the business ramifications of a few code bases not coded with the future in mind, I have grave concerns. Business ramifications being an insane overhead cost for feature requests, no risk-free way to test the already written software, and more risk associated with particular individuals being the only ones who know how certain systems work. I’m worried that I’m not doing everything in my power to ensure that if I get hit by a bus, those taking over the code bases after me are well equipped, and can be successful in doing so. Conversely, I dread maintaining some of the other code bases that aren’t using the standards I’m using.

    I’ve got what I feel are obvious things:

    • using best coding practices (those that aren’t too subjective)
    • following OOP encapsulation, and documenting where I break it, and why
    • using Subversion source control, checking in only what you need to successfully compile and run the app
    • What I check into Subversion actually compiles
    • communicating my intent to other developers and getting their feedback
    • Using widely known frameworks (1 for Flash, 1 for Flex)

    What I haven’t done, but feel might be good to do:

    • Provide a document beyond code-commenting per project on how to setup and compile
    • Document my framework modifications that go beyond implementation details
    • Have more debates on the pro’s & con’s of unit testing with a particular devote developer from another team
    • Voice my concerns to management to ensure I’m not wasting my time.

    That last one may seem weird, but it’s not. For example, a lot of service work is created once, and never maintained. In consulting, some stuff is coded from scratch for each client to ensure there are no legal licensing worries after a project is done. Sometimes, it’s just cheaper to re-write, whether in house or out sourced to another company/contractor. For product work, some customers are charged out the yang for things beyond the norm.

    I don’t think I’m wasting my time, though. In my short career, I’ve seen first hand how bad things can be when the original developers do not plan for the future, nor care about it. I want to create a better future, whether I’m in it or not, and not just for the engineers after me, but also because I want research & development funding. If I reduce overhead costs, while ensuring customer satisfaction is at or above where it was before I got involved, I can spend more time coding new products, improving existing ones based on what customers want, and/or creating what the sales’ team sells.

    To do that, I have to ensure the code is stable, can be configured easily, and is insulated against change. This doesn’t just apply to me, though, it applies to the entire team I work with, as well as new employees, and this is where my vision breaks down. The only way I can think to do this is to first become in charge of my area; second, mandate standards the team agrees on; and third, make people fix the things that don’t follow standards.

    Is that how you do this? Do I really need management’s buy in or is this something developers can mutually agree on? One of mentor’s claims I shouldn’t even waste an ounce of my time on my team members, and instead should go straight to management to make some coding standards company law… I’m thinking I agree with him.

    Do you have coding standards at your company/workplace/department? Who created them, how did you implement them, and most importantly, how do you enforce them?

  • Building Tracer Bullets with Flex Builder

    Skip to “Flex Tracer Bullets” to bypass all the philosophy and justification.

    Preface

    The Pragmatic Programmer, a must have programming book, talks about using Tracer Bullets to help clarify and further define requirements. In military terms, a tracer bullet is a special round of ammunition that burns brightly when fired from a weapon. It’s every few rounds, so not every round is a tracer round. It is very easy to see, and thus the person firing can adjust their aim accordingly. In essence, you build an early version of your software that matches the client’s requirements as closely as possible, and get it to them as quickly as possible. The Pragmatic Programmer makes special note that Tracer Bullets are different than prototypes. Prototypes are usually disposable whereas Tracer Bullets are built with the understanding that they will eventually be used in production level code.

    If you’ve read any of the Ruby on Rails books, one thing they espouse is client involvement. Getting the client something tangible to see and play with in mere days. The “play with” is important. Many times in my career “comps”, visual wireframes with some design treatment used to illustrate the entire application, have been treated as the front end developers final requirements. They never end up being this, are never thorough, and resist change (because of the expectations of them). A picture of an application, and an actual application are 2 different things. Giving the client something tangible, that appears to work like the real application, gets them as close to the application as possible. This intimacy generates the most valuable feedback you can get next to user testing. The difference is, this is pre-launch feedback, so you can implement it before you deliver.

    This is important, not just because the client is actually happy the day you deliver the final build of software that meets their expectations, but because of all the bad things you’ve prevented. I’ve read and heard many stories about how weeks were spent in development going down a path the client approved, only to head off exactly the reverse direction for another few weeks, with extremely frustrated developers. Worse than that are the miscommunications , whether by the telephone effect, or the mere lack of anyone I’ve ever met to actually effectively extract customer requirements that are factual. You then think you are going in the right direction, only to have the client say that wasn’t what they were looking for at all.

    Bottom line, it’s better to spend 3 days hashing out some ideas with fake data in your code for sales or the client to see and play with rather than 1 week on requirements gathering, and then 2 weeks in development. The problem with the latter is that you have no guarantees the requirements didn’t change, they were accurate in the first place, or the client will even like what you’ve done even if the requirements and what they wanted were one in the same. Requirements and software are 2 different things. Furthermore, even if you are agile to changing requirements, requests on paper and experiences using software are vastly different as well. In the end, clients are paying for the latter.

    I’m pretty harsh on requirements, I know. That’s because my personal philosophy is, “What do you want the software to do?”. Once told, I go build something, show the client, and go from there. Using early builds (a build meaning a working version of the current, compiled code) as tracer bullets has worked well for me. Sadly, I haven’t found out how to get tracer bullets to work for fixed budget projects. When you don’t even have time for a prototype, you usually just have to rely on your experience and hope you have aim like a sniper.

    You build a tracer bullet, an early & working build, to give to the client and let them use it. You garner feedback, and adjust your direction from there.

    Flash vs. Flex, Prototype vs. Tracer Bullet (again)

    Flash Prototypes

    If you would of asked me a year ago what’s the best way to do tracer bullets, I’d probably have said take a hybrid approach. Build a Flash prototype, and if the client digs it, you can then transition into production code once your direction is more solidified. You can then show them builds every few days (or Thursdays so they can play with it on Friday). The cheapest and quickest way I’ve seen this work is to have a Flash Designer work with the Interaction Designer/Information Architect (maybe they are all the same person), and produce a series of working screens in Flash. The data is fake, but the buttons do in fact work. These are most effective if you can even have some simple use cases working as well.

    For example, if the user needs to “create something”, the prototype will actually have the data the user inputted into the forms actually update a DataGrid for example. Even smoke and mirror effects such as this work wonders with sales and real clients in my experience. Most don’t really care the data isn’t live, and you even run the risk that prototypes are fraught with: that they are perceived as a real application, and are immediately latched onto. At that point, you better hope you can duplicate all of what the designer created in production code. Common problem, but a good one. The biggest point of contention was getting a Flash Developer who could duplicate accurately whatever the Flash Designer had created.

    It’s even worse nowadays for some Flex Developers. As our industry grows and we start taking on traditional programmers who are skilled at code, but do not have a lot of the multimedia experience a lot of Flash Developers sometimes have, a lot of Flex Devs shudder when they just even get complicated “looking” design comps. It’s one thing when your IDE has a timeline, and boilerplate level graphical control, but it’s completely another when you are at the mercy of the component framework you are building upon. Component developers will scoff at this notion, as it is definitely true that you can build components around any design. Either way, those things take time, are not easy, and are typically code centric vs. design centric implementations. It’s even harder when your tool wasn’t designed for it.

    Bottom line, I’ve seen a lot of value in Flash prototypes. Pre-ActionScript 3 is more loosely typed, and Flash is a RAD tool, allowing you quickly build working applications with tight design control, even if “working” is faked. The product of this work makes a great shock troop; quickly in sales/the client’s hands, with next to immediate understanding of how on/off base you are.

    Rapid Application Development isn’t Bad, it isn’t Good, it just is

    Flash prototypes work for more design centric RIA‘s as opposed to larger scale applications. This is because these types of applications, such as an online banking application, or a financial planning tool, are usually business driven. This means the visual aesthetics are usually the least important part of the entire project. For the record, I hate that and strive daily to change that. Yes folks, it IS possible to have a financial planning tool that not only provides sound advice on your economic future, but looks hot doing it. “R” in “RIA” for the win. Regardless, the default Flex components work wonders in looking “good enough” for any application. With working functionality, they shine.

    Flex Builder 2 specifically on it’s own, however, isn’t as RAD as Flash with regards to design projects. I’d argue the reverse for business projects. Either way, both allow you to end up with something that you can use later if coded with as much best practices as possible given the time constraints. This is key because I’ve seen a lot of blogger comments critical of the “RAD” term, feeling like they’ve been sold a bill of goods. They immediately perceive RAD as un-scalable and I don’t think this is fair. They are immediately implying success.

    Let’s take Twitter for example. A few in the blogsphere used Twitter’s performance issues as proof in the pudding that agile/rad languages/frameworks may get you something that works quickly, but that working application doesn’t work well under pressure. I liked the counter argument one commentor, John Ballinger, posed as a rhetorical question in this blog entry (scroll to comments):

    Could Twitter have used any other language (YES of course) but would they have been able to build it in the time and been agile to the constant changes that “may” have ultimately lead them to the current explosion of traffic they have today?

    What I believe John is implying here is that by using a language & framework that allows them to produce a good and working product quickly, they become victims (in a good way) of their own success. If they weren’t quick to market with the flexibility to respond quickly to their users, they wouldn’t be in the situation they are just getting over now because they wouldn’t have a mass of users to begin with. Bottom line, I’d much rather have scalability problems that I can solve with my teams’ programming know-how vs. a scalable site (in theory) with no users. No one cares about scalability if you’re not successful… after the fact anyway.

    Going with RAD (rapid application development) really meaning what it says and not being inherently evil, just being what it is, I believe Flex is a RAD tool just like Flash. The difference here is using it to write code that is a good foundation.

    Flex Builder Tracer Bullets

    So how do you write Flex Builder Tracer Bullets knowing that Flex can be a RAD tool and Tracer Bullets are good to do? Here’s 2 lists:

    Technicals

    1. Don’t use ActionScript, use MXML
    2. Use states, don’t use transitions
    3. Write strongly-typed ValueObject’s based on client’s data needs
    4. build workflows, then build use cases
    5. use copious amounts of tagged builds in Subversion (or whatever source control you use)
    6. componetize sections
    7. use Canvas first, Panel later
    8. make builds easy to see
    9. use fake data from real ValueObjects
    10. put event handlers in Script tag, not in MXML

    Esoterics

    1. Find in a friend in sales (or a stakeholder at your client)
    2. Write emails to stakeholders (sales/client) that ask a question that can be answered
    3. recognize opportunity, and take it
    4. use a phone, not email or IM

    Don’t use ActionScript, use MXML

    Flex Builder can render MXML components pretty accurately whereas ActionScript components not so accurately. This means you can see, in the Design View, your application as it’s coming together. This includes GUI controls and your use of states. Having to compile your app just to see one component visually is slow. Build in MXML because it’s faster to write, and faster to see.

    Use states, don’t use transitions

    A lot of screens have specific states. Some have none. The majority, do, though. It’s quicker to make 1 LoginForm with 3 states than 3 different MXML views that make up a LoginForm. Quicker to edit, too. Flex Builder can show you those states visually, and automatically write the code for you to add & remove controls as well as changing their properties when the state changes. It’s always easiest to start with “main_state”, and go from there. If you don’t, you may later have to copy and paste MXML you’ve already written into AddChild tags individually which are themselves in state tags. Total pain the arse. Do it right the first time.

    Transitions, the animated changes between states, add a lot and make the user’s eye-focus putty in your hands. Don’t do it yet, though. Wait until you’ve gotten direction on your app before you start directing the user’s attention. Transitions are probably the most volatile code in your application, and are also the most subjective. Finally, they cause unexpected changes later when you start throwing data at components that causes their state to change (like custom item renderers for example).

    Define clear states for each View (component), and build them using Flex Builder. It’s ok to hand type MXML as well.

    Write strongly-typed ValueObject’s based on client’s data needs

    Understand the data you have, as a client developer, early. Whether it’s coming from your server team, the client’s server team, or both, understand what you are going to be able to represent that data model in a strongly type set of classes. These do not need to match the server, and new ones can be created specifically to make GUI development easier, including properties. Getting these done allows you to be build View’s (components) that actually have accurate GUI controls on them to represent the data. No VO’s, and your just guessing. VO’s give your GUI design direction, give it purpose.

    If there is contention in the VO’s, you have a communication problem. Solve it, learn the nomenclature, get the lingo down. Collectively agree with all parties involved to have 1 name for everything. While some developers will say 2, “We call it an asset ID, but the customers call it an item ID” you’re just making it more confusing for you in meetings, emails, and IM’s. Bad communication will sabotage any project, and clear data is the key.

    If they are strongly-typed, when you decided to re-factor, you’ll get compiler errors in Flex Builder which makes it easy to quickly change names in places that your global find and replace didn’t catch (or if you were just too paranoid to do so, by hand). In this way, you’re application is resilient to change… and it’s not even really an application yet.

    build workflows, then build use cases

    A task that the user needs to accomplish is solved by an effective workflow. A workflow is the way a user accomplishes that task by being guided or “led” via the user interface. These are the most important parts of an application, and need to be nailed down first. They are also the first cement to dry when coding your application (meaning hard to change later without drastic consequences) so it’s best to really think these out based on sales/client dialogues. More is better. If you have more than one idea to make an interface that allows a user to create a widget, go for it. If it’s up to your Information Architect or Interaction Designer, let her/him know in no uncertain terms the clock is ticking.

    Once you get a workflow down, “The user is shown a list of their savings plans. They can then interact with these savings plans”, it’s now time to build use cases around them. The user needing to upload a file is one, the user needing to be able to filter visible data is another. Use cases are things the user needs to do. They usually collectively make up the task the user needs to accomplish. Sometimes, they can be task in and of themselves. The point here is to ensure you have a solid workflow first, THEN start working on satisfying your use cases.

    Both should be put in builds and thrown at your client with abandon. It’s ok to walk them through it in guided demos; this is brainstorming, not user testing. This is how your application will effectively work, so make sure you client can do what they need to do and can see what they need to see.

    use copious amounts of tagged builds in Subversion (or whatever source control you use)

    If you get a working build with specific functionality, make a tagged build in Subversion. If you are not using Subversion, mark the current build in your repository with a special label (in CVS), or some other verbose comment with an accepted convention so you can find that exact build of code later. No source control? …just make a copy of the code.

    This way, if you or the client wants to refer to an older example, you’ve got the mofo on ice, and can thaw it in minutes, ready for any meeting.

    componetize sections

    This has less to do with OOP, and more to do with MXML readability. Because Flex Builder is nice in that the Design View will write all the code for you via dragging and dropping controls on your forms, it doesn’t have that human touch. So, even if you don’t format it by hand, you’ll still end up with a ton of MXML tags spewed out over hundreds of lines if you build an entire application in one MXML file. The first pure MXML app I ever saw in my life was a pure MXML RSS Reader posted on Flexcoders. While I respected MXML’s power, I couldn’t read it for $h1werwer….

    If you have a big form, put it in a component. That way, 30 lines of MXML becomes ““. Omg, 1 line of meaningful code… hells yeah, I can read that at light speed! Furthermore, if you hold Control (Command on Mac), you can then click on “UserForm” as a hyperlink, and open the file in question. Supa-fast!

    use Canvas first, Panel later

    While Panel gives you a nice container for your mini-components of your application, they merely serve as pretty looking trappings for your lack of requirements insecurity. Use Canvas, set horizontal and vertical scroll policies to off, and let it be raw. You need to see the gaping holes in your UI, not hide them in pretty chrome.

    make builds easy to see

    The point of builds is to get client feedback, and get it early with real software. If the client can’t see the software iteration, they’ll question “this whole ‘Agile’ thing”. Don’t send EXE’s over email, nor SWF’s. Find a reliable FTP site, upload it, and run it. This is easiest if you don’t have any local file dependencies, the SWF makes no data calls (locally or externally), and doesn’t require any weird arse things to make it run (“Oh… well, lemme reset my host file to be localhost, and then reploy the war file…”. What? Dude, just upload the SWF with accompanying HTML file. If you can’t do that, you’re not writing a Tracer Bullet, but instead a real application build that wasn’t meant to be agile.

    If the sales person/client can’t see the SWF, neither will your users. If you don’t want to deal with Flash Player install issues, don’t do Flex development. Once you get it out of the way, you can always depend on your salesperson/client being able to see your latest build from there.

    use fake data from real ValueObjects

    A great way to point out immediate problems, and make make your application feel more real, is to throw fake data at it in the form of ValueObjects populated with data. Obviously, you may be way ahead of the server team (yours or the client), so it helps to have factory methods; functions that can generate a bunch of fake data for you quickly. You can then throw this at the GUI time and time again to test something. Pain in the neck to write, but you’ll use them a tons afterwards.

    Furthermore, this ties in really well with the “make builds easy to see”. Instead of praying that your database call works while the client is viewing your SWF, or if the back-end guys will have their code done by the meeting, you instead don’t have to worry about it; it’s embedded in the SWF, and will work even if the Internet connection suddenly dies (after they’ve downloaded the SWF).

    For Cairngorm, a technique I learned from Darron Schall was using “Mock Commands”. You make 2 Command classes; 1 for real data that may use a Delegate to make a call to the server, and 1 that just gets fake data from a Factory class and has a timer to simulate a delay. That way, you just change 1 line of code in your Controller class to switch to fake-data mode.

    put event handlers in Script tag, not in MXML

    The thing that’ll change the most as you hop around files modifying GUI stuff is your MXML. Since most MXML is for showing GUI controls, it’ll be volatile from the get-go. Putting code there is just asking for it get in the way, and maybe even get waxed. So, instead, have your Buttons for example call a function in your Script tag for their click handler instead of do things directly in the MXML. That way, you can even delete the MXML, replace it, and then easily wire it up again.

    Find in a friend in sales (or a stakeholder at your client)

    Sales can go either way. They can be a developer’s worst enemy, or you’re biggest fan base. I prefer the latter. I’ve been in too many situations where sales sold something that was impossible and I had to make the impossible possible. AKA, “Flash Developers at Design Agencies”.

    The first thing to do is find out who in sales (assuming just 1 individual) is interacting with the client, and basically catering the project to their needs. Start up a dialogue with this individual assuming your project manager doesn’t mind, and get to know the client. You may wish you hadn’t, but do it anyway. Learn the needs that sales is trying to satisfy by using your code as a conduit. When they start asking for specific functionalities, you’ll know why, and be more informed in suggesting ideas, changes, or options.

    The ideas are cool because sales usually perceives engineering being “fun governors”; depending on the organization. The last thing they expect is MORE things for the developer to do coming FROM the developer. The changes are good because as an engineer, you know how hard something will be to make, how it may work differently in practice, or know the ramifications of a design path whereas sales might not. Rather than saying no, you can make an informed suggestion about how to get the result sales is looking for. This may seem like something you can do in a meeting, but trust me, it’s tons easier when you already have an established rapport with the individual, and almost give the suggestion in passing, almost like you and the sales guy have already got it all planned out.

    Finally, options are key here. Being successful at software is the middle ground between doing everything sales wants, and coding just enough to get it solid and working. Enough flair to make the sale, enough OOP to ensure it doesn’t blow up. Combined, you win. A lot of times, you as a developer may not know what that balance is. The easiest way I’ve found is to put the ball back in sales or management’s court. If they ask for 5 things, you spec them out, give time estimations with risk assessments, and any additional optional ways to implement certain features in increments. Giving sales options is way better than ultimatums. It’s important that your time estimations for your articulated options with possible incremental milestones are not bs. You need to be sincere, honest, and thorough. If it was easy, they wouldn’t call it “work”.

    Naturally becoming friends with the client is dangerous. It’s all fun and games until business gets involved. That doesn’t mean you still can’t build up a rapport to better communicate with the client, and thus understand where they are coming from. I’ve seen a lot of managers in my time offer to shield me from meetings. If the meeting is with the client, I highly recommend you lower shields, and go. Even if you don’t converse in a dialogue, you can still listen.

    Write emails to stakeholders (sales/client) that ask a question that can be answered

    When you are in the process of figuring things out, it’s really easy to give that laid back, relaxed feeling others in conversation. The no-pretense, “What do you think?”. Don’t ask open ended, non-focused questions like that to stake-holders. Be direct, and know the type of feedback you want before hand. If you do, 1 of 2 things will happen, both of which are good. Either the salesperson/client will answer your question in written form so you can refer to it later and thus continue working on your GUI, or they’ll have no clue, in which case you can propose some ideas and look straight pimpin’ (really smart and capable).

    recognize opportunity, and take it

    If your sales/client has no clue what any form of Agile is, or what a “build” is… find a way to educate them. That is, find an appropriate time and place to introduce the concepts. Don’t start ranting about Agile Development on a sales call for example. Instead, if you have a question about how a certain section works on a design comp the client sent you, use that as an opportunity to send them 2 builds, and choose the one they like, or perhaps choose a different one. If they respond positively (or not negatively), boom, you win. You just set the expectation you can send them working prototypes to play with. Suddenly they’ll be hip to the notion you’re sending them working software to play with that is representative of what they’ll actually be using… and that’s a pretty accurate assumption on their part. Their shaping of it also ensures you’re never wrong because you’re basically doing what they tell you to do. Obviously, famous last words for a programmer. Either way, if your the IA/ID or not, you can also use this opportunity to suggest ideas, again giving yourself an opportunity at least appear intelligent.

    If there is a client phone call/meeting, and you have the opportunity to attend, do so. If it is appropriate, start a dialogue to challenge your assumptions about their comments to the recent builds you sent them. Engage with them (and/or sales) in the process.

    Use a phone, not email or IM

    If you’re unsure about something, and you have access to sales, go talk to them in person. Make sure you brushed & flossed first, obviously. If they are unavailable, send them an email. If they are remote, call them, and then only email if they aren’t around and don’t return phone calls. In person dialogue is ideal, whereas phone voice dialogue is 2nd best. Email and IM are not the best form of communication, and communication is the most important thing in a software project. Use the best kind you can to ensure success.

    Caveats and Gotchas

    There are some caveats and gotchas. The more time your team is writing tracer bullets, the less time they are moving forward with traditional visible results. The Agile crew would argue that it is better to spend 4 hours on 2 ideas, allowing the client to pick one they like as opposed to spending 1 week on requirements and then 2 weeks on development for animplementation the client won’t like, which then ends up being another 2 weeks to code to the new idea. Even 2 weeks of bouncing ideas with near production code is better than 2 weeks of “coding off a spec”… well, unless you’re doing government work. It’s hard for some to see the value in writing code that has fake data, and an ever changing interface, seeing the same things in different ways without seeing in their eyes tangible progress on milestones. My retort is they can’t prove their milestones are accurate without the client having some form of involvement in confirming those milestones were met without allowing the client to play with a build that shows that milestone in action.

    Regardless, it’s hard to argue with a Subversion log that says “everything under the View’s folder has changed a lot the last week, but everything in the Cairngorm business, command, and events folder has not… what exactly HAVE you accomplished this week? Can you name one requested feature you’ve completed?”. Valid question, and one that management & sales need to manage; IA/ID & developers can help, but ultimately they aren’t accountable for resource management. Look at it this way: You’ll either be re-coding this at beginning more quickly with less stress using a series of tracer bullets as opposed to slowly at the end with less malleable code under more stress. Use that fact to empower sales. Take the initiative.

    If you don’t have leadership approval, it won’t work. If your manager looks at you funny when you send a “half finished application” the client, you’re already in deep trouble.

    If the client doesn’t care, you’ll really need to leverage your sales rapport. You’ll need to educate the client how software works, and that is extremely hard… but fun. If you don’t, they’ll just expect it to be “done and finished by X date”. That’s not how things work in the real world and they need to realize no matter how much money they spend, they can’t change that. It’s in their best interest to get a good feeling with the software early because it’s easier to change early, harder to change later. If you get those feelings early on, most changes later won’t be so drastic as completely changing workflows.

    Regarding MXML, I’m a big fan of writing my components in all ActionScript. That way, I can re-use them since I have lower level control and can make them really flexible. Again, Flex Builder won’t render these unless you convert them to a SWC (via a Flex Library project for example), so save the uber-OOP for later. If you stick with pure MXML, the tool will work well, and you won’t be fighting it to adopt your best practices. If you have a lot of members on your team, this is also something you can throw at other developers to handle, even junior ones. They can cut their teeth on making a reusable component while you continually define the app via multiple iterations.

    A couple notes on branches and prototypes. First, I’m not a big fan of using branches for one Flex Dev to make some design iterations while the rest of the team “moves forward”. The Flex Dev(s) doing the design iterations should be in the real code. If the rest of the team has qualms with this, you’ll need to setup an easier way for them to test, whether by writing formal/informal unit testing for them on GUI & non-GUI code. For example, one of the benefits of Cairngorm is that it allows multiple developers to work in tandem. One strategy is to have multiple developers handling all Events, Commands, Factory, ValueObject, and Business Delegate code. This leave the Views in the hands of whatever developer(s) handling building the tracer bullets to show sales/the client. The rest of the team can either use the latest build in source control to throw data at and see what happens, and just comment out the actual Cairngorm Event dispatching when they check the code in, but I’ve found it’s easier to just make informal test cases; MXML applications that test your whole Cairngorm use case setup. A la, you build a simple View with a GUI control data bound to the Model, dispatch an event, and see if it works.

    Regarding prototypes, for larger projects I think these are more the than justifiable. Throw away code is quicker to write than tracer bullets, and it’s always good to play with some code ideas before committing more rigorous practices to it before you know the idea will actually fly (strong-typing, encapsulation, etc.). There comes a point though where you should start leveraging the code you are writing in a good base, and really put the code to the test in early builds to see if she holds up.

    Finally, being intimately familiar with Flex Builder helps. I think I’m pretty adept at it, and I’d say that significantly contributes to my ability to quickly modify code without making it spaghetti. My experiences in Director and Flash have contributed to my ability to fake a lot of interactions for the sake of communicating a point. Finally, using OOP, encapsulation, and strongly-typed code to get the tool to help you find errors are all ways to write flexible code. While the temptation is to not even use strong-typing, and use a procedural approach, you’ll spend too much time trying different ideas because you can’t share code easily. Remember, it’s ok to do this stuff on paper or your favorite UML tool first. I just use paper, personally and plaster comps on walls in front of my desk. Now, that experience doesn’t just happen over night. Regardless, I was responding to bi-weekly changes on software projects at my first job of which I didn’t know OOP or how to write classes, nor did I know what design patterns were. I didn’t even know how to return a value from a function (I just modified global values instead). Yet, I found a way, so you can too.

    Conclusions

    Iterative development through speedy coding with Flex Builder. Following the tips above, you can hopefully build your Flex apps a little faster via Tracer Bullets so you can play with some workflow / use case / design ideas and throw them at the client. What they throw back you can then start coding for real on… and then toss that back… rinse, repeat.