1. Session 2 Practices of agile developers AgileDev Tour Duong Trong Tan tandt@fpt.edu.vn Hanoi, December 2010
2. Objectives TurboBoost your development performance 2 Beginning agility Feeding agility Deliver what customers want Agile feedback Agile coding Agile debugging Agile collaboration Improvement of individual expertise and productivity
3. Keep it releasable in increment TurboBoost your development performance 3 Use version control for sharing code and builds This helps you integrate early and often Tools: SVN, CVS, Git Commit “potentially shippable code” to contribute the “potentially shippable product” at the end of sprint. Automate build and deployment early Preparing scripts, manuals, settings etc. Tools: Ant, Maven
4. Issue Tracking TurboBoost your development performance 4 As the project progresses, you’ll get a lot of feedback including corrections, suggestions, change requests, feature enhancement, bug fixes, etc. Log all issues into a good tracking system Hints: Redmine, Google Code, Assembla.com, etc.
7. Where feedbacks come from? TurboBoost your development performance 7 From the System Using testing, coding From the Users During requirement discussion, demo, sprint review From the Team During code, test, design and “chit chat”
8. Unit Testing TurboBoost your development performance 8 Unit testing provides instant feedback makes your code robust can be a helpful design tool is a confidence booster Unit tests can act as probes when solving problems are reliable documentation are a learning aid Tools: Junit, NUnit, HttpUnit, etc. Write tests before writing code (TDD)
9. Best Practices from Scrum TurboBoost your development performance 9 Feedbacks are gathered before, during and after the sprint: Sprintplanning => feedback from the customers, about requirement DailyScrum => feedback from the team Sprintreview => feedback from the customer, about the product
10. Listen to the users TurboBoost your development performance 10 Let them do acceptance testing “It’s a bug” : Every complaint holds a truth. => There is no such thing called a stupid user.
11. Quality code for productivity TurboBoost your development performance 11 Agile Coding
12. Dreyfus Model Levels of Expertise TurboBoost your development performance You are neither “expert” nor “novice” at all things; rather, you are at one of these stages in some particular skill domain Expert Proficient Competent Advanced Beginner Novice 12 From Journeyman to Master
13. Pair Programming TurboBoost your development performance 13 A pair of developers shares a problem, a computer, a keyboard and a goal: solve the problem PP was defined in XP Utilize the R-mode activities Improve communication and effectiveness Improve software quality Widely ADOPTED, but still CONTROVERSAL! 2 roles: Driverand Navigator: The Driver doesn’t see the big picture The Driver should “step a way from the keyboard” The Navigator tends to use pattern-matching problem solving technique
14. Program Intently and Expressively TurboBoost your development performance 14 Code should provide high-level of: readability and understandability. public void MakeCoffee() { lock(this) { // ... operation } } private object makeCoffeeLock = new object(); public void MakeCoffee() { lock(makeCoffeeLock) { // ... operation } }
15. Communication in Code TurboBoost your development performance 15 Use standard comments for communication, avoid misunderstanding and create “developer manual” Document code using well chosen, meaningful names. Use comments to describe its purpose and constraints. BUT Don’t use commenting as a substitute for good code. Use tools for help: RDoc, javadoc, and ndoc, IDEs
16. Trade-off and Simplicity TurboBoost your development performance 16 “There is no best solution” Code in Increments, not a “big bang” Use of TODO + skeleton before code Keep It Simple, but not simplistic Write High-Cohesive, Low-Coupled Code Efficient Use of Design Patterns
17. Design Patterns TurboBoost your development performance 17 Design Patterns is a modern classic in the literature of object-oriented development, offering timeless and elegantsolutions to common problems in software design. Utilize design principles and best practices for better design Create “vocabulary” for team communication Keep GoF’s and JavaEE’s DP in your “thinking toolbox”
18. What do you see in this piece of code? /** * This is a singleton class. * Used for logging action to the std out. * Example: Logger.getInstance().log(“foo”); */ public class Logger{ private static Logger instance; private Logger(){} public static getInstance(){ if(instance!=null){ return instance; } else{ instance = new Logger(); } } public void log( String message){ System.out.println(message); } } 18 TurboBoost your development performance
19. Refactoring TurboBoost your development performance 19 You practice “code a bit, fix a little” => result in dirty code & bad design. Refactoring helps in restructure or design your code to make it better. But what does “better” mean? Keep in mind: Maintainability Extensibility High Cohesion Low Coupling
20. Refactoring Techniques TurboBoost your development performance 20 for abstraction Encapsulate Field Generalize Type Replace type-checking code with State/Strategy Replace conditional with polymorphism for breaking code apart Extract Method, turn part of a larger method into a new method Extract Class for improving code standard Move Method or Move Field Rename Method or Rename Field Pull Up, move to a superclass Push Down, move to a subclass
21. How do you face with mistakes? TurboBoost your development performance 21 Agile Debugging
24. Meetings TurboBoost your development performance 24 Planning Objective oriented Review Product|Release review : formal Technical review (code, design): informal Attack and Defense Design, algorithm, code review Tracking Daily meeting Stand up meeting Retrospection Training|Seminar|Composium|Pilot
25. Keep the meeting focused TurboBoost your development performance 25 Ask 3 questions: What did I achieve yesterday? What am I planning to do today? What’ s in my way? Or What impeded me from doing good job? Use time box
26. Stand-up Meeting Benefits TurboBoost your development performance 26 kick off the day ahead in a focused way bring the issue out into the open and actively seek help determine areas that may need additional hands make team members aware of what’s going on identify redundancy or areas facilitating the sharing of code and ideas encourage forward momentum
27. Collaborative Coding TurboBoost your development performance 27 Architects Must Write Code Don’t let anyone design in isolation Practice collective ownership correctly Share Code Only When Ready Developers should be a Mentor Knowledge grows when given Don’t let others smell your code
28. Code Review TurboBoost your development performance 28 Formal code inspections are very efficient in finding problems It works in “bug-prevention” mode Styles: The all-nighter The pick-up game Pair programming Receipt: Can you read and understand the code? Are there any obvious errors? Will the code have any undesirable effect on other parts of the application? Is there any duplication of code (within this section of code itself or with other parts of the system)? Are there any reasonable improvements or refactorings that can improve it?
29. Self-organization and Self-management TurboBoost your development performance 29 In Scrum, developers in Scrum Team manage themselves. This helps in: Encouraging transfer and share of ideas, status, problems Seeking problems as soon as possible Avoiding conflicts and problems Working collectively. Image courtesy to http://www.richmondmontessori.ca
30. Communication tools TurboBoost your development performance 30 Whiteboard Sticky note Email Version control Wiki Blog Task management tools Issue trackers
31. How can you kaizen? TurboBoost your development performance 31 Improve Expertise and Productivity Continuously
33. 10,000 HOURS Malcolm Gladwell writes in Outliers that people at the very top don’t work harder than everyone else. They work much, much harder. In fact, Gladwell quotes neuroscientists who believe that 10,000 hours of practice is required to become world class at a particular skill--whether it’s surgery, shooting baskets, or public speaking.
34. References and Further Readings TurboBoost your development performance 34 Code Complete 2ndEdn., by Steve McConnell Practices of an Agile Developer - Working in the Real World by VenkatSubramaniam and Andy Hunt. Pragmatic Thinking and Learning – Refactor your wetware by Andy Hunt.
Hinweis der Redaktion
No more theory, no more processes, no more models. We’ll discuss the daily practices of an agile developer which help you actively transform yourself to a higher level of SoftDev capability. We need to step out from books!
Things: code, process, model, tools. Adjustment must be based on well-understanding of stuffs.common responses to an obvious error:• Dismiss the person as incompetent.• Dismiss the idea by pointing out the obvious flaw.• Ask your teammate to address your concern.Courage: sometimes you don’t see the situation as written in books, you must be honest with ys that requires courage
At the start of a meeting, pick a mediator who willact as the decision maker for that session.
take Java, forinstance. You have the Java language with its series of updated features.Then you have Swing, Servlets, JSP, Struts, Tapestry, JSF,JDBC, JDO, Hibernate, JMS, EJB, Lucene, Spring...; the list goes on.If you are into Microsoft technology, you have VB, Visual C++, MFC,COM, ATL, .NET, C#, VB.NET, ASP.NET, ADO.NET, WinForms, EnterpriseServices, Biztalk.... And don’t forget UML, Ruby, XML, DOM, SAX,JAXP, JDOM, XSL, Schema, SOAP, web services, SOA; yet again the listgoes on (and we’re starting to run out of short acronyms).
Words vs. ImagesImage: http://www.flickr.com/photos/vaxzine/2278300537/
Metaphor : transferWhat we call windows on the computer screen aren’t really windows at all. The mouse isn’t actually a rodent. A folder on your hard disk isn’t a real folder, and the trashcan isn’t a real can.
For pricing, for example.What are use case point, function point, man month, person day, user story point?
Use prototyping for test code, code some, fill someAutomate to save timeSimulation: write code for Arithmetics. Add/Substract/Divide/Multiply
Novices need recipes. Advanced beginners don’twantthe big picture. Competent practitioners can troubleshoot. Proficient practitionerscan self-correct. Experts workfrom intuition.For your team:Use rules for novices, intuition for experts.For you: Know what you don’t know.For student: Expert != TeacherNo Expertise Without ExperienceGladwell: take any chance you got to practice. Think ab. the case of MS.
Comment a function:Purpose: Why does this method exist?Requirements (pre-conditions): What inputs do we need, and what state must the object be in, for this method to work?Promises (post-conditions): What state is the object in, and what values are returned, on successful completion of this method?Exceptions: What can go wrong, and what exceptions may be thrown?
XP values:Keep it simpleDRYCohesion is a measure of how functionally related the members of acomponent (package, module, or assembly) are
GoF: Gang of Four() – authors of Design Patterns: Elements of Reusable Object-Oriented Software“Don’t reinvent the wheel”Example:
Example of Singleton design pattern, used in code
What do you have in NetBeans, Eclipse, VS?
Bug Report:* Date of the problem• Short description of the problem or issue• Detailed description of the solution• References to articles, and URLs, that have more details or relatedinformation• Any code segments, settings, and snapshots of dialogs that maybe part of the solution or help you further understand the detailsAttack Problems in Isolation: design low-coupled code
Training is not all about technical .Ask Phuong : how can she train her team?
DRY practice in seeing others report progress motivates each of us to do the same.
What is dirty|smelling code?
One-night-a-month monster code review session: bring all needed stuffs: food, drink, music, game ..
Using “crowd intelligence”
Next session will examine some advanced tool for agile devlopers
Reflection: use a paper, draw a mind-mapRepeat the spirit