Your SlideShare is downloading. ×
Unindented Code Cannot Possibly Work
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Unindented Code Cannot Possibly Work

91
views

Published on

Ed Buhain presented "Unindented Code Cannot Possibly Work" at the 2012 DC Agile Engineering Conference

Ed Buhain presented "Unindented Code Cannot Possibly Work" at the 2012 DC Agile Engineering Conference

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
91
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • June 4, 1996
  • S - single responsibility - objects should do only one thingO - open/closed principle - entities should be open for extension, closed for modificationL - Liskov substitution - objects should be replaceable with subtypes without altering correctnessI - interface segregation - many client-specific interfaces are better than one general-purpose interfaceD - dependency inversion - depend upon abstractions, not concretions
  • One of the partners at Excella Consulting compiled a list of observations about the work we do. One of the observations he noted (#17): Success is dependent on people, process, and technology. In that order.
  • In the interview, I often ask a lot of questions to find out how much someone loves developing software or working with computers.How many computers do you have?Physical or virtual?What do you do to learn about new technologies?Do you play any MMORPGs?I want people who are passionate about computers and software engineering. I want someone who would choose to do the same thing in their free time.
  • I look for people with great communication skills. Verbal communications, for one.Gregg Boer, Program Manager, TFS – “The Greatest Estimate”
  • Here’s a sample resumeI received – the name’s been changed, of course.
  • Here’s a classic debate. Are code comments good or bad?I personally prefer to use comments sparingly – I want the code to be self-documenting through the use of readable identifiers with whitespace and indentation to provide emphasis.
  • Does this code work? Maybe it produces the right output, but that's only half of the evaluation criteria. This code fails because it doesn't properly communicate what it's supposed to do.
  • The third thing I look for is how well candidates know their tools and techniques. You will be judged on your mastery of tools and patterns.
  • Learn what your tools do well; learn what your tools do not do well.
  • Some people get really verbose when they’re filling in comments. This snippet was inspired by someone I worked with who had a habit of including random personal information in his comments.Speaking of tools, don't rely so much on them that it keeps you from writing good software.Don't confuse Intellisense with spell check. If you spell it wrong the first time, it'll help you spell it wrong every time.
  • Same thing goes with ORM. If you spelled your column name like this <sample>, your class names are going to look like this.Tools are not a substitute for thinking.
  • Speaking of techniques, you’re also going to be judged on your presentation.
  • Here’s a door from Excella's main office in Arlington.Which way does the door open?It's a really nice office, but here, we sacrificed obvious cues for the sake of beauty and symmetry -- or at least conforming to the design standards of the building. We're used to cues that tell us whether to (gesture) push or pull.When we first moved in, I noticed one of Excella's partners looking up every time he approached a doorway. He was looking for the only visual cue we have…
  • … the door stop at the top of the door.Someone gave me a helpful mnemonic. The main doors in the office open away from the main space. Should your users have to make up mnemonics because you forgot to think about how they'd use your software?
  • Now pick someone to represent your little group. We'll go around the room and just shout out some of the ideas.
  • Here’s my opportunity to complain about consistency.
  • They put a lot of thought into the airport signage at Schiphol.Color coding: Color should make sense and clearly communicate an information category.Terminology: Assume that visitors know nothing about the facility and use terminology that is easily understandable to everyone. Fonts: Don’t use more than one font, and stick to such sans-serif typefaces as Frutiger, Clearview, Gill or Meta. Pictograms: Don’t rely too much on pictograms; supplement with text, especially with less familiar functions.
  • The back-end code for your software could be amazing, but if your user interface looks like you rushed to put it together, people will assume that you rushed the whole thing.
  • Have you ever built THE FORM? Have you ever thought it was a good idea?When this stuff was new, it was pretty neat. You could throw something like this together pretty quickly.Our needs have evolved. THE FORM might work, sure, but there are so many things wrong with the form
  • I worked on one project (actually the same one as the last one) where I couldn’t figure out why my data didn’t save when I clicked OK. It turns out I was supposed to click Apply / Cancel. Aren’t those supposed to be equivalent?Have you ever run into software where they switch OK and Cancel? I’m so used to that order that I’ll click the wrong one if you switch it around
  • Here’s something from a site that completely blew me away. I’m used to seeing Login and Password – this site had them switched around.
  • Know Your Users’ Patterns (Expect the Unexpected!)The Therac-25 was a state-of-the-art cancer treatment system designed to deliver radiation with pinpoint accuracy.It had two treatment modes: a high-power x-ray mode and a low-power electron beam mode.X-ray mode fired 25,000 rads of radiation. To switch to x-ray mode, you typed an “X” into a field and a thick metal plate automatically deployed to transform the radiation beam into lower-intensity x-rays.Electron beam mode fired 200 rads. You entered an “E” to activate it.The operator pushed X accidentally, but used an unexpected key combination to change it – up arrow to select “edit” and change from “x-ray” to “electron beam” mode, then return to get back to the bottom of the screen.This sequence had never been tested. The screen showed “electron beam” mode – the metal plate was retracted, but the power setting remained at maximum.There was a video camera in the treatment room, but the control room monitor wasn’t plugged in.beam fired, blue flash, excruciating pain. control room displayed "Malfunction 54" -- operator fired beam again.Cherenkov radiation caused by acceleration of a stream of electrons."Captain Kirk forgot to put the machine on stun.“2/38.5
  • If we were to be agile when it comes to UI…We’re conditioned to look for structured data. Specific information vs. natural language prose.Prose vs. Tables - Airline ReservationCut the fluff!
  • Who’s gone through an app certification process? Polishing your app might take longer than the functionality!I recently went through the Windows 8 certification process and they’re cracking down on some of these patterns. I’ve shown you a few of the smells that could make your customers, your users, your bosses cringe – and I want you to recognize them, too, because that’s how you’ll deliver good software.
  • Set Phasers on Stun by Stephen CaseyClean Code by Robert C. MartinThe Design of Everyday Things by Donald A. NormanDesigning with the Mind in Mind by Jeff JohnsonUrsEnzler – Clean Code and Clean TDD Cheat Sheets
  • UrsEnzler – Clean Code and TDD Cheat SheetsSo… we’ve learned how to identify and how to avoid code smells, but what happens when you have to work with a code base filled with code smells?
  • Roberto Hernandez is up next to tell you all about how we deal with legacy code.
  • Transcript

    • 1. Unindented Code Cannot Possibly Work! Ed Buhain December 7, 2012PRIVILEGED AND CONFIDENTIAL. The information contained in this material is privileged and confidential, and is intended only for the use of the individual towhom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that anydissemination, distribution or copying of this material is strictly prohibited. If you have received this material in error, please destroy it immediately. #DCAEC12 #DCAEC12
    • 2. The Ariane 5 $7B development $500M rocket & cargo Software Based on the Ariane 4 #DCAEC12 #DCAEC12
    • 3. The Ariane 5 Inertial Reference Systems On-Board Computers Boosters & Main Engine #DCAEC12 #DCAEC12
    • 4. The journey of a thousand milessometimes ends very, very badly.  - Despair, Inc. #DCAEC12 #DCAEC12
    • 5. About Me NAME: Ed Buhain COMPANY: Excella Consulting EMAIL: ed.buhain@excella.com TWITTER: @buhain BLOG: blog.buhain.com #DCAEC12
    • 6. Unindented Code Cannot Possibly Work! Ed Buhain December 7, 2012PRIVILEGED AND CONFIDENTIAL. The information contained in this material is privileged and confidential, and is intended only for the use of the individual towhom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that anydissemination, distribution or copying of this material is strictly prohibited. If you have received this material in error, please destroy it immediately. #DCAEC12 #DCAEC12
    • 7. #DCAEC12 #DCAEC12
    • 8. SOLID Principles S - Single Responsibility O - Open/Closed Principle L - Liskov Substitution I - Interface Segregation D - Dependency Inversion #DCAEC12
    • 9. #DCAEC12 #DCAEC12
    • 10. #DCAEC12 #DCAEC12
    • 11. Unindented code cannot possibly work.  - Jeff Prosise #DCAEC12 #DCAEC12
    • 12. #DCAEC12 #DCAE
    • 13. Success is dependent on people,process, technology – in that order.  - Jeff Gallimore #DCAEC12 #DCAEC12
    • 14. I - Passion #DCAEC12 #DCAEC12
    • 15. I - Passion #DCAEC12 #DCAEC12
    • 16. II – Communication Verbal Written #DCAEC12 #DCAEC12
    • 17. II – Communication #DCAEC12 #DCAEC12
    • 18. Any fool can write code that acomputer can understand.Good programmers write code thathumans can understand.  - Martin Fowler #DCAEC12 #DCAEC12
    • 19. Does This Code Work? If (productNames.Count > 0) Then lblProductName1.Text = productNames(0) lblProductName1.Visible = True End If If (productNames.Count > 1) Then lblProductName2.Text = productNames(1) lblProductName2.Visible = True End If . . . If (productNames.Count > 98) Then lblProductName99.Text = productNames(98) lblProductName99.Visible = True End If #DCAEC12
    • 20. Does This Code Work? SELECT a.CustomerName AS a, b.Address1 AS b, b.City AS c, b.PostalCode AS d, c.OrderNumber AS e FROM Customers a INNER JOIN Addresses b ON b.AddressId = a.AddressId INNER JOIN Orders c ON c.CustomerId = a.CustomerId WHERE c.IsProcessed = 0 #DCAEC12
    • 21. Does This Code Work? // increment j i++; #DCAEC12
    • 22. Does This Code Work?string iCustnm;iCustnm = "644";if (Cust.Has_Orders(iCustnm))processOrders(iCustnm);else wiatforOrdersw(iCustnm);Display_Customer_Orders(iCustnm.ToString()); #DCAEC12
    • 23. III – Tools & Techniques #DCAEC12
    • 24. Skynet became self-aware.  - The Terminator #DCAEC12 #DCAEC12
    • 25. Know Your Tools! // Doug H. - 12/11/2010 - Bug 2733 // Rachel G. - 11/17/2010 - Bug 2544 // Doug H. - 11/11/2010 - Bug 2211 // Doug H. - 10/29/2010 - Bug 2211 // Howard W. - 8/6/2010 - Bug 2099 // Norm P. - 4/11/2010 - Bug 1556 // Doug H. - 1/14/2010 - Bug 1444 ProcessPayment(payment); #DCAEC12
    • 26. Know Your Tools!/* * * Edited by Doug H. * Thursday 3:45 p.m. * Outside Temperature 38°F * I live at 65 Main Street. * I wish I was on vacation. I have 6 days of vacation left. * */ #DCAEC12
    • 27. CuStOmErADDRESSid #DCAEC12 #DCAEC12
    • 28. III – Tools & Techniques Know Your Tools Think About Presentation #DCAEC12 #DCAEC12
    • 29. #DCAEC12
    • 30. #DCAEC12
    • 31. You’re Surrounded! Think of something you think is poorly designed. Share with your group. #DCAEC12
    • 32. We’re Surrounded! Pick a group representative. Share with the whole room. #DCAEC12
    • 33. #DCAEC12
    • 34. #DCAEC12#DCAEC12
    • 35. Attractive things work better.  - Donald A. Norman #DCAEC12 #DCAEC12
    • 36. Know Your Patterns #DCAEC12
    • 37. Know Your Patterns #DCAEC12
    • 38. Know Your Patterns #DCAEC12
    • 39. Know Your Patterns #DCAEC12
    • 40. Know Your Patterns #DCAEC12
    • 41. Know Your Patterns #DCAEC12
    • 42. Know Your Patterns You are confirmed on United Airlines flight 2049, departing from Washington-Dulles Airport at 10:00 a.m. on Friday, December 7, 2012 and arriving at Seattle-Tacoma International Airport at 3:00 p.m. United Flight 2049 Washington-Dulles to Seattle- Tacoma Departs: Fri 12/7 10:00 AM #DCAEC12
    • 43. Putting It All Together… #DCAEC12
    • 44. Reading List #DCAEC12
    • 45. Reading List #DCAEC12
    • 46. What do you think about when youhear the term legacy code?… the sort of code that you just wishwould die.  - Michael Feathers #DCAEC12 #DCAEC12
    • 47. About Me NAME: Ed Buhain COMPANY: Excella Consulting EMAIL: ed.buhain@excella.com TWITTER: @buhain BLOG: blog.buhain.com #DCAEC12