best practices seeqnce - 2324-02-2012

Post on 19-Oct-2014

2.053 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Best PracticesYoussef Chaker

February 23-24 2012

Presented by

Monday, February 27, 12

Day 1

The Why, What and How

Monday, February 27, 12

but first...

Who am I and why should you listen to me?

Monday, February 27, 12

Monday, February 27, 12

Why?

Monday, February 27, 12

Developers are not code monkeys

Monday, February 27, 12

Better relationships with customers and business dev people

Monday, February 27, 12

Professionalism...remember that one?

Monday, February 27, 12

<warning>

Monday, February 27, 12

Ariane 5 Flight 501

Flight 501, which took place on June 4, 1996, was the first, and unsuccessful, test flight of the European Ariane 5 expendable launch system.

Due to an error in the software design (inadequate protection from integer overflow), the rocket veered off its flight path 37 seconds after launch and was destroyed by its automated self-destruct system when high aerodynamic forces caused the core of the vehicle to disintegrate. It is one of the most infamous computer bugs in history.The breakup caused the loss of four Cluster mission spacecraft, resulting in a loss of more than US$370 million

10

Monday, February 27, 12

Therac-25

The Therac-25 was a radiation therapy machine produced by Atomic Energy of Canada Limited (AECL) [...]. It was involved with at least six accidents between 1985 and 1987, in which patients were given massive overdoses of radiation, approximately 100 times the intended dose. Three of the six patients died as a direct consequence. These accidents highlighted the dangers of software control of safety-critical systems, and they have become a standard case study in health informatics and software engineering.[...]A commission has concluded that the primary reason should be attributed to the bad software design and development practices, and not explicitly to several coding errors that were found. In particular, the software was designed so that it was relatively impossible to test it in a clean automated way.

Monday, February 27, 12

More online: http://en.wikipedia.org/wiki/List_of_software_bugs

Monday, February 27, 12

</warning>

Monday, February 27, 12

what not to do!

Monday, February 27, 12

source: http://thedailywtf.com/Articles/Flexible-Spending.aspx#pic2Monday, February 27, 12

Shortcuts

Quick & dirty

Cutting Corners

Monday, February 27, 12

Live Coding

Monday, February 27, 12

A Simple Prayer

Lord, please protect our biggest VPS from Eric's installed software

- including but not limited to plugins and gems written by 11 year old  Pakistanis.

May his apps be well behaved and may they be considerate of CPU and RAM.

Lord, if any of these terms are unfamiliar to you, look them up on Wikipedia.

Peace be to all other apps and all other VPSs on the same physical server.

Amen.

Monday, February 27, 12

what to do?

Monday, February 27, 12

What You Already Know• Follow coding standards.

• Be consistent. If you do operations in a specific way, do that kind of operations in the same way (e.g. defining variable/method/class names, parenthesis usage etc.).

• More code does not mean better code. Keep it simple and reduce complexity.

• Catch specific exceptions instead of highest level class 'Exception'. This will provide understandability and more performance.

• Use understandable and long names for variables. Loop variable names can be i, j, k, index etc., local variable names must be longer than loop variables, parameter names must be longer than local variables and static variable names must be longer than parameters; proportional with scope size.

• Don't use magic numbers and strings directly in the code. Use constants. This method provides more modularity and understandability.

• Use understandable comments. Bad comment is worse than no comment.

• Method names must include "what is done by this method" information.

Monday, February 27, 12

• Package related classes (that changed together and/or used together) together.

• Use positive conditionals. Readability of positive conditionals are better than negative ones.

• Use dependency injection to manage too many singletons.

• Use exceptions only for catching exceptions, not for control flow. Think as required and perform control flow with control statements/conditionals.

• Don't use so many arguments with methods. Keep the number at most 8-10. If more is required, review your design.

• Don't use method alternatives with boolean flag variables (public void someMethod(bool flag)). Write more than one method for each flag condition.

• Think twice before defining a method as static and be sure if you really need to. Static methods are harder to manage.

• Avoid using methods with reference parameters. Use multi attributed object parameters instead.

• Number of interface methods must be minimized to decrease coupling/dependency.

Monday, February 27, 12

What School Did not Teach You

• Deliver often, get user feedback in a continuous regular and intense flow

• Don't try to be too much smarter than your customer, just enough

• Do only whats needed to deliver the functionality expected in each step in the best possible way

• Make sure you love and care about your work, code, user and customer

Monday, February 27, 12

Questions?Comments?Concerns?

Monday, February 27, 12

“Motivational products don’t

work.But our

Demotivators® products don’t

work even better.”

Monday, February 27, 12

TDDTest Driven Development

Monday, February 27, 12

Write TestsLet them fail

Monday, February 27, 12

Write the minimal code that will make

your tests pass

Monday, February 27, 12

Write More Tests

Monday, February 27, 12

rinse lather repeat

Monday, February 27, 12

source: http://www.agiledata.org/essays/tdd.html

Monday, February 27, 12

= TFDTest First Development

Monday, February 27, 12

TDD = x + TFD

any guesses to what x is?

Monday, February 27, 12

Refactor

Monday, February 27, 12

source: http://www.agiledata.org/essays/tdd.htmlMonday, February 27, 12

source: http://www.despair.com/overconfidence.htmlMonday, February 27, 12

Monday, February 27, 12

TDD ||\/

less fluff, more stuff

Monday, February 27, 12

Frameworks RSpecxUnit

for more: http://en.wikipedia.org/wiki/List_of_unit_testing_frameworksMonday, February 27, 12

Monday, February 27, 12

Monday, February 27, 12

bash-3.2$ bundle exec rake spec

..................................................................................*.....................................................................................................

.......................................................

Pending: GroupVenue add some examples to (or delete) /Users/ychaker/Dev/jogabo/spec/models/group_venue_spec.rb # No reason given # ./spec/models/group_venue_spec.rb:4

Finished in 3 minutes 43.24 seconds239 examples, 0 failures, 1 pending

.................................................................................................................................................................

.............................................................................

Finished in 3 minutes 49.69 seconds238 examples, 0 failures

Monday, February 27, 12

Break15 minutes

Monday, February 27, 12

and we’re back...

Monday, February 27, 12

Question:

Why are you writing code?What’s the purpose of your code?

Monday, February 27, 12

Answer:

solve Business problems

produce a certain Behavior

Monday, February 27, 12

Then maybe we should do Behavior Driven

Development!

Monday, February 27, 12

D’oh!

Monday, February 27, 12

source: http://www.agiledata.org/essays/tdd.htmlMonday, February 27, 12

Disclaimer:The RSpec example was actually a BDD

example

Monday, February 27, 12

User Stories

Monday, February 27, 12

Features

Monday, February 27, 12

Scenarios

Monday, February 27, 12

Monday, February 27, 12

Integration Testing

Monday, February 27, 12

cucumber demo

Monday, February 27, 12

Continuous Integration (CI)

Monday, February 27, 12

Hudson

Monday, February 27, 12

Monday, February 27, 12

Monday, February 27, 12

standup, stretch your legs

Monday, February 27, 12

if there’s anything I want you to take away from today is this last

part

Monday, February 27, 12

Distributed model(examples)

• Fossil

• git

• Mercurial

Monday, February 27, 12

delete, don’t comment out

Monday, February 27, 12

Always use source control system even if the project has only

one developer

Monday, February 27, 12

git demo

Monday, February 27, 12

Questions?Comments?Concerns?

Monday, February 27, 12

Monday, February 27, 12

Day 2

Go Beyond

Monday, February 27, 12

Activity

Monday, February 27, 12

Be Agile, Be Happy

Monday, February 27, 12

Agile ManifestoWe are uncovering better ways of developingsoftware by doing it and helping others do it.Through this work we have come to value:

Individuals and interactions over processes & toolsWorking software over comprehensive documentation

Customer collaboration over contract negotiationResponding to change over following a plan

That is, while there is value in the items onthe right, we value the items on the left more.

Monday, February 27, 12

Let’s go closer

Monday, February 27, 12

Agile ModelingAgile Unified Process (AUP)

Dynamic Systems Development Method (DSDM)Essential Unified Process (EssUP)

Extreme Programming (XP)Feature Driven Development (FDD)

Open Unified Process (OpenUP)Scrum

Velocity tracking

Monday, February 27, 12

Scrum

Monday, February 27, 12

Monday, February 27, 12

iterative, incremental framework for project management and agile software development.

Monday, February 27, 12

Monday, February 27, 12

2-4 week sprints

Monday, February 27, 12

“ScrumMaster”, who maintains the processes

(typically in lieu of a project manager)

Monday, February 27, 12

“Product Owner”, who represents the

stakeholders, represents the business

Monday, February 27, 12

“Team”, a cross-functional group of about 7 people who do the actual

analysis, design, implementation, testing,

etc.

Monday, February 27, 12

Pigs & ChickensA pig and a chicken are walking down a road. The chicken

looks at the pig and says, “Hey, why don’t we open a restaurant?”

The pig looks back at the chicken and says, “Good idea, what do you want to call it?”

The chicken thinks about it and says, “Why don’t we call it ‘Ham and Eggs’?”

“I don’t think so,” says the pig, “I’d be committed, but you’d only be involved.”

Monday, February 27, 12

Key Notions

• (Sprint) Planning

• Backlog*

• (Sprint) Burn down

• Daily Standups

• + more...

*Backlog: Product/Sprint backlog or any list of tasksMonday, February 27, 12

Scrum for Kids

Monday, February 27, 12

YES! I’m serious

Monday, February 27, 12

The Meads

Monday, February 27, 12

Introducing the Scrum Board

Monday, February 27, 12

The Pughs

Monday, February 27, 12

The Board (again)

Monday, February 27, 12

The Toyota way

Monday, February 27, 12

The Right Process Will Produce the Right Results

1. Create continuous process flow to bring problems to the surface.

2. Use the "pull" system to avoid overproduction.

3. Level out the workload (heijunka). (Work like the tortoise, not the hare.)

4. Build a culture of stopping to fix problems, to get quality right from the [start].

5. Standardized tasks are the foundation for continuous improvement and employee empowerment.

6. Use visual control so no problems are hidden.

7. Use only reliable, thoroughly tested technology that serves your people and processes.

Monday, February 27, 12

Add Value to the Organization by Developing Your People and Partners

1. Grow leaders who thoroughly understand the work, live the philosophy, and teach it to others.

2. Develop exceptional people and teams who follow your company's philosophy.

3. Respect your extended network of partners and suppliers by challenging them and helping them improve.

Monday, February 27, 12

Continuously Solving Root Problems Drives Organizational Learning

1. Go and see for yourself to thoroughly understand the situation (Genchi Genbutsu, 現地現物);

2. Make decisions slowly by consensus, thoroughly considering all options (Nemawashi, 根回し);

implement decisions rapidly;

3. Become a learning organization through relentless reflection (Hansei, 反省) and continuous

improvement (Kaizen, 改善).Monday, February 27, 12

Break15 minutes

Monday, February 27, 12

and we’re back...

Monday, February 27, 12

Monday, February 27, 12

Activity

Monday, February 27, 12

Sprint Planning + Scrum Poker

Monday, February 27, 12

Daily Standups

Short: less than 15 minutes

What did I do yesterday?What am I doing today?What are my obstacles?

Monday, February 27, 12

Stay FlexibleStay Lean

Monday, February 27, 12

Retrospectives

Monday, February 27, 12

Monday, February 27, 12

Monday, February 27, 12

Pair Programming

Monday, February 27, 12

Monday, February 27, 12

Questions?Comments?Concerns?

Monday, February 27, 12

Bonus

Monday, February 27, 12

Lean Startup

Monday, February 27, 12

Screen

Monday, February 27, 12

You have now learnt the basic of software

craftsmanship

Monday, February 27, 12

References• Fowler, Martin. The New Methodology: http://martinfowler.com/articles/newMethodology.html

• Wikipedia. Agile Software Development: http://en.wikipedia.org/wiki/Agile_software_development

• Manifesto for Agile Software Development: http://agilemanifesto.org/

• Wikipedia. Scrum (development): http://en.wikipedia.org/wiki/Scrum_(development)

• Wikipedia. Ariane 5 Flight 501: http://en.wikipedia.org/wiki/Ariane_5_Flight_501

• Ariane 5 Failure, Full Report: http://sunnyday.mit.edu/accidents/Ariane5accidentreport.html

• Wikipedia. Tehrac-25: http://en.wikipedia.org/wiki/Therac-25

• Wikipedia. List of software bugs: http://en.wikipedia.org/wiki/List_of_software_bugs

• Rails Maturity Models: http://railsmaturitymodels.com/practices

• Scrum For Kids http://scrumforkids.com/

• Toyota Production System http://en.wikipedia.org/wiki/Toyota_Production_System

• The Toyota Way http://en.wikipedia.org/wiki/The_Toyota_Way

• Manifesto for Software Craftsmanship http://manifesto.softwarecraftsmanship.org/

• The Lean Startup http://theleanstartup.com/

• Cucumber-Rails https://github.com/cucumber/cucumber-rails

• Gherkin https://github.com/cucumber/cucumber/wiki/Gherkin

Monday, February 27, 12

Contact

@ychaker

http://youhoo.im

http://linked.com/in/ychaker

Monday, February 27, 12

top related