• Complain

Kent Beck - Test Driven Development: By Example

Here you can read online Kent Beck - Test Driven Development: By Example full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2002, publisher: Addison-Wesley Professional, genre: Humor. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Kent Beck Test Driven Development: By Example
  • Book:
    Test Driven Development: By Example
  • Author:
  • Publisher:
    Addison-Wesley Professional
  • Genre:
  • Year:
    2002
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Test Driven Development: By Example: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Test Driven Development: By Example" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Quite simply, test-driven development is meant to eliminate fear in application development. While some fear is healthy (often viewed as a conscience that tells programmers to be careful!), the author believes that byproducts of fear include tentative, grumpy, and uncommunicative programmers who are unable to absorb constructive criticism. When programming teams buy into TDD, they immediately see positive results. They eliminate the fear involved in their jobs, and are better equipped to tackle the difficult challenges that face them. TDD eliminates tentative traits, it teaches programmers to communicate, and it encourages team members to seek out criticism However, even the author admits that grumpiness must be worked out individually! In short, the premise behind TDD is that code should be continually tested and refactored. Kent Beck teaches programmers by example, so they can painlessly and dramatically increase the quality of their work.

Kent Beck: author's other books


Who wrote Test Driven Development: By Example? Find out the surname, the name of the author of the book and a list of all author's works by series.

Test Driven Development: By Example — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Test Driven Development: By Example" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Appendix I. Influence Diagrams

This book contains many examples of influence diagrams. The idea of influence diagrams is taken from Gerald Weinberg's excellent Quality Software Management series, particularly Book 1: Systems Thinking . The purpose of an influence diagram is to see how the elements of a system affect one another.

[1] Weinberg, Gerald. 1992. Systems Thinking . Quality Software Management . New York: Dorset House. ISBN: 0932633226.

Influence diagrams have three elements:

  • Activities, notated as a word or short phrase

  • Positive connections, notated as a directed arrow between two activities; meaning that more of the source activity tends to create more of the destination activity, or less of the source activity tends to create less of the destination activity

  • Negative connections, notated as a directed arrow between two activities with a circle over it; meaning that more of the source activity tends to create less of the destination activity, or less of the source activity tends to create more of the destination activity

A lot of words for a simple concept. provide a few examples.

The more I eat, the more I weigh. The less I eat, the less I weigh. Personal weight is a far more complicated system than this, of course. Influence diagrams are models to help you understand some aspect of the system, not understand and control it perfectly.

Figure A.1. Two seemingly unrelated activities

Figure A2 Positively connected activities Figure A3 Negatively - photo 1

Figure A.2. Positively connected activities

Figure A3 Negatively connected activities Feedback Influence doesnt - photo 2

Figure A.3. Negatively connected activities

Feedback Influence doesnt work in one direction only Often the effects of an - photo 3

Feedback

Influence doesn't work in one direction only. Often the effects of an activity come back around to change the activity itself, either positively or negatively, as shown in .

Figure A.4. Feedback

If my weight rises then my self-esteem drops which makes we want to eat more - photo 4

If my weight rises, then my self-esteem drops, which makes we want to eat more, which makes my weight rise, and so on. Anytime you have a cycle in an influence diagram, you have feedback.

There are two kinds of feedbackpositive and negative. Positive feedback causes systems to encourage more and more of an activity. You can find positive feedback loops by counting the number of negative connections in a cycle. If there are an even number of negative connections, then you have a positive feedback loop. The feedback loop in is a positive feedback loop. It will cause you to keep gaining weight until the influence of some other activity kicks in.

Negative feedback damps or reduces an activity. Cycles with an odd number of negative connections are negative feedback loops.

The keys to system design are

  • Creating virtuous cycles, in which positive feedback loops encourage the growth of good activities

  • Avoiding death spirals, in which positive feedback loops encourage the growth of unproductive or destructive activities

  • Creating negative feedback cycles to prevent overuse of good activities

System Control

When choosing a system of software development practices, you'd like the practices to support one another so that you tend to do about the right amount of any activity, even under stress. is an example of a system of practices that leads to insufficient testing.

Figure A.5. Not enough time to test reduces the available time

Under the pressure of time you reduce the amount of testing which increases - photo 5

Under the pressure of time, you reduce the amount of testing, which increases the number of errors, which increases the time pressure. Eventually some outside activity (like "Cash Flow Panic") steps in to ship the software regardless.

When you have a system that isn't behaving, you do have options.

  • Drive a positive feedback loop the other direction. If you have a loop between tests and confidence, and tests have been failing thus reducing confidence, then you can make more tests work to increase confidence in your ability to get more tests working.

  • Introduce a negative feedback loop to control an activity that has grown too large.

  • Create or break connections to eliminate loops that are not helping.


Appendix II. Fibonacci

In answer to a question from one of the reviewers of this book, I posted a test-driven Fibonacci. Several reviewers commented that this example turned on their light about how TDD works. However, it is not long enough, nor does it demonstrate enough of TDD techniques, to replace the existing examples. If your lights are still dark after reading the main examples, take a look here and see.

The first test shows that fib(0) = 0. The implementation returns a constant.

public void testFibonacci() { assertEquals(0, fib(0)); } int fib( int n) { return 0; }

(I am just using the TestCase class as a home for the code, because it is only a single function.)

The second test shows that fib(1) = 1.

public void testFibonacci() { assertEquals(0, fib(0)); assertEquals(1, fib(1)); }

I just put the second assert in the same method, because there didn't seem to be any substantial communication value to writing testFibonacciOfOneIsOne.

There are several ways I could go to make this run. I'll choose to treat 0 as a special case:

int fib( int n) { if (n == 0) return 0; return 1; }

The duplication in the test case is starting to bug me, and it will only get worse as we add new cases. We can factor out the common structure of the assertions by driving the test from a table of input and expected values.

public void testFibonacci() { int cases[][]= {{0,0},{1,1}}; for (int i= 0; i < cases.length; i++) assertEquals(cases[i][1], fib(cases[i][0])); }

Now adding the next case requires six keystrokes and no additional lines:

public void testFibonacci() { int cases[][]= {{0,0},{1,1},{2,1}}; for ( int i= 0; i < cases.length; i++) assertEquals(cases[i][1], fib(cases[i][0])); }

Disconcertingly, the test works. It just so happens that our constant 1 is right for this case as well. On to the next test:

public void testFibonacci() { int cases[][]= {{0,0},{1,1},{2,1},{3,2}}; for ( int i= 0; i < cases.length; i++) assertEquals(cases[i][1], fib(cases[i][0])); }

Hooray, it fails. Applying the same strategy as before (treating smaller inputs as special cases), we write:

int fib( int n) { if (n == 0) return 0; if (n <= 2) return 1; return 2; }

Now we are ready to generalize. We wrote 2, but we don't really mean 2, we mean 1 + 1.

int fib( int n) { if (n == 0) return 0; if (n <= 2) return 1; return 1 + 1; }

That first 1 is an example of fib(n-1):

int fib( int n) { if (n == 0) return 0; if (n <= 2) return 1; return fib(n-1) + 1; }

The second 1 is an example of fib(n-2):

int fib( int n) { if (n == 0) return 0; if (n <= 2) return 1; return fib(n-1) + fib(n-2); }
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Test Driven Development: By Example»

Look at similar books to Test Driven Development: By Example. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Test Driven Development: By Example»

Discussion, reviews of the book Test Driven Development: By Example and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.