Reddit Reddit reviews Test Driven Development: By Example

We found 33 Reddit comments about Test Driven Development: By Example. Here are the top ones, ranked by their Reddit score.

Computers & Technology
Books
Computer Programming
Software Design, Testing & Engineering
Software Development
Test Driven Development: By Example
Check price on Amazon

33 Reddit comments about Test Driven Development: By Example:

u/Vitate · 26 pointsr/cscareerquestions

Much of this stuff is learnable outside of work, too, at least at a superficially-passable level. Trust me.

Pick up a few seminal books and read them with vigor. That's all you need to do.

Here are some books I can personally recommend from my library:

Software Design

u/ashmoran · 13 pointsr/Buttcoin

/u/nickjohnson has it summed up in this comment:

> Does NOBODY write unit tests?

A unit test is not a complicated thing. It takes one small, self-contained piece of code, sets up some situational context, runs the code with parameters set to interesting values, and then checks that certain conditions are met. (Conditions include things like: the correct result is returned, certain messages are sent, certain messages are not sent, the result is returned in less than X seconds, or whatever.)

It is important to note that while unit tests are not complicated, this does not mean they are not difficult to write. It is somewhere between art and science to write good unit tests, but it is possible. There is something like 20 years of work in this field, especially since the (capital A) Agile movement started. There are whole books on the subject, such as Kent Beck's effortlessly enlightening Test Driven Development: By Example.

Unfortunately, the number of programmers is growing so fast, that new programmers are joining the field faster than they can encounter experienced programmers, and so they are relearning lessons that were first learnt when they were still young, or even before they were born.

This problem didn't used to matter so much, but the situation has changed. Now that people know how to create money with code, code quality is not just a matter of late-night bug-fixing to get a small app released on time, it could potentially make or lose the entire net worth of a person, or even millions of people.

This is exactly the reason I've never bought a single ETH token. When I saw Etheruem, I said exactly this: "It seems to combine the properties of Bitcoin and OpenTransactions in the riskiest possible way". Some time later, The DAO showed the potential downside of that risk.

This kind of problem will not be fixed by developers learning how to write unit tests, it needs a bigger picture than that. But we will be able to put a lot of the world's wealth to much better use, if the developers of cryptocurrencies are able to find and reuse the learnings of software developers in other fields. And as Nick suggested, writing unit tests would be a good start.

u/fesor · 8 pointsr/PHP
u/596F75206E65726421 · 6 pointsr/javascript

>What are some good guides/practices to unit testing?

Test Driven Development: By Example is a good book to get started with

>Say I have an app with dozens of functions, how do I choose which functions to write tests for, and are there preferred style guides for these tests?

Ideally, you would test them all and you would want to write unit tests and integration tests for them.

>If it helps I want to begin by testing the front end code, whether it's generated with a framework like React or more bespoke using template strings. How do you conduct "recon" on your code to pick the targets to write tests for first, and how do you choose your testing framework?

I've never used bespoke so I can't comment on it but for React I'd recommend jestand enzyme. Jest is a testing framework that was created by Facebook (the creators of React). It's not specifically designed for React but it works great with it. Enzyme is a library made by Airbnb specifically for testing React components. Enzyme is designed to work along side Jest.

>I know you need as much coverage as possible but since you gotta start somewhere, how do you pick the starting point in your code?

The most critical part of your application

u/artsrc · 5 pointsr/programming

Here are some:

  • TDD allows you to start at the top, or the bottom, or anywhere else you feel makes sense. As long as you start with one failing test.
  • You can do TDD without proper error checking
  • TDD involves constant feed back, a test fails, all tests pass
  • You can't do TDD with a slow (2 minute) build
  • TDD promotes decoupling to make units testable
  • TDD is incremental, the design, tests and implementation evolve together
  • TDD has a clean meaning, and means what this book says it does:

    http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530
u/ir8prim8 · 4 pointsr/PHP

They are older books, but really changed my way of programming. Refactoring by Fowler and Test Driven Development by Beck.

https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672
https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530

Feeling overwhelmed and confused can always be solved by breaking things into small enough problems and making enough tests to make sure that your assumptions match reality.

Frameworks can be confusing the way they hide details away from you. Remember though, that with open source, there is nothing to stop you from digging into the framework methods you are calling and see how they work. If you get stuck, sometimes looking at the source will tell you more than looking at the docs. Try multiple frameworks in multiple languages. Once you think you have an idea of the different parts required, try using a template library and an ORM library and write the rest of the code you need to make a basic custom framework.

If you want to see a more direct approach to web services, take a look at Go, where frameworks are almost discouraged. http://thenewstack.io/make-a-restful-json-api-go/

u/CSMastermind · 4 pointsr/learnprogramming

I've posted this before but I'll repost it here:

Now in terms of the question that you ask in the title - this is what I recommend:

Job Interview Prep


  1. Cracking the Coding Interview: 189 Programming Questions and Solutions
  2. Programming Interviews Exposed: Coding Your Way Through the Interview
  3. Introduction to Algorithms
  4. The Algorithm Design Manual
  5. Effective Java
  6. Concurrent Programming in Java™: Design Principles and Pattern
  7. Modern Operating Systems
  8. Programming Pearls
  9. Discrete Mathematics for Computer Scientists

    Junior Software Engineer Reading List


    Read This First


  10. Pragmatic Thinking and Learning: Refactor Your Wetware

    Fundementals


  11. Code Complete: A Practical Handbook of Software Construction
  12. Software Estimation: Demystifying the Black Art
  13. Software Engineering: A Practitioner's Approach
  14. Refactoring: Improving the Design of Existing Code
  15. Coder to Developer: Tools and Strategies for Delivering Your Software
  16. Perfect Software: And Other Illusions about Testing
  17. Getting Real: The Smarter, Faster, Easier Way to Build a Successful Web Application

    Understanding Professional Software Environments


  18. Agile Software Development: The Cooperative Game
  19. Software Project Survival Guide
  20. The Best Software Writing I: Selected and Introduced by Joel Spolsky
  21. Debugging the Development Process: Practical Strategies for Staying Focused, Hitting Ship Dates, and Building Solid Teams
  22. Rapid Development: Taming Wild Software Schedules
  23. Peopleware: Productive Projects and Teams

    Mentality


  24. Slack: Getting Past Burnout, Busywork, and the Myth of Total Efficiency
  25. Against Method
  26. The Passionate Programmer: Creating a Remarkable Career in Software Development

    History


  27. The Mythical Man-Month: Essays on Software Engineering
  28. Computing Calamities: Lessons Learned from Products, Projects, and Companies That Failed
  29. The Deadline: A Novel About Project Management

    Mid Level Software Engineer Reading List


    Read This First


  30. Personal Development for Smart People: The Conscious Pursuit of Personal Growth

    Fundementals


  31. The Clean Coder: A Code of Conduct for Professional Programmers
  32. Clean Code: A Handbook of Agile Software Craftsmanship
  33. Solid Code
  34. Code Craft: The Practice of Writing Excellent Code
  35. Software Craftsmanship: The New Imperative
  36. Writing Solid Code

    Software Design


  37. Head First Design Patterns: A Brain-Friendly Guide
  38. Design Patterns: Elements of Reusable Object-Oriented Software
  39. Domain-Driven Design: Tackling Complexity in the Heart of Software
  40. Domain-Driven Design Distilled
  41. Design Patterns Explained: A New Perspective on Object-Oriented Design
  42. Design Patterns in C# - Even though this is specific to C# the pattern can be used in any OO language.
  43. Refactoring to Patterns

    Software Engineering Skill Sets


  44. Building Microservices: Designing Fine-Grained Systems
  45. Software Factories: Assembling Applications with Patterns, Models, Frameworks, and Tools
  46. NoEstimates: How To Measure Project Progress Without Estimating
  47. Object-Oriented Software Construction
  48. The Art of Software Testing
  49. Release It!: Design and Deploy Production-Ready Software
  50. Working Effectively with Legacy Code
  51. Test Driven Development: By Example

    Databases


  52. Database System Concepts
  53. Database Management Systems
  54. Foundation for Object / Relational Databases: The Third Manifesto
  55. Refactoring Databases: Evolutionary Database Design
  56. Data Access Patterns: Database Interactions in Object-Oriented Applications

    User Experience


  57. Don't Make Me Think: A Common Sense Approach to Web Usability
  58. The Design of Everyday Things
  59. Programming Collective Intelligence: Building Smart Web 2.0 Applications
  60. User Interface Design for Programmers
  61. GUI Bloopers 2.0: Common User Interface Design Don'ts and Dos

    Mentality


  62. The Productive Programmer
  63. Extreme Programming Explained: Embrace Change
  64. Coders at Work: Reflections on the Craft of Programming
  65. Facts and Fallacies of Software Engineering

    History


  66. Dreaming in Code: Two Dozen Programmers, Three Years, 4,732 Bugs, and One Quest for Transcendent Software
  67. New Turning Omnibus: 66 Excursions in Computer Science
  68. Hacker's Delight
  69. The Alchemist
  70. Masterminds of Programming: Conversations with the Creators of Major Programming Languages
  71. The Information: A History, A Theory, A Flood

    Specialist Skills


    In spite of the fact that many of these won't apply to your specific job I still recommend reading them for the insight, they'll give you into programming language and technology design.

  72. Peter Norton's Assembly Language Book for the IBM PC
  73. Expert C Programming: Deep C Secrets
  74. Enough Rope to Shoot Yourself in the Foot: Rules for C and C++ Programming
  75. The C++ Programming Language
  76. Effective C++: 55 Specific Ways to Improve Your Programs and Designs
  77. More Effective C++: 35 New Ways to Improve Your Programs and Designs
  78. More Effective C#: 50 Specific Ways to Improve Your C#
  79. CLR via C#
  80. Mr. Bunny's Big Cup o' Java
  81. Thinking in Java
  82. JUnit in Action
  83. Functional Programming in Scala
  84. The Art of Prolog: Advanced Programming Techniques
  85. The Craft of Prolog
  86. Programming Perl: Unmatched Power for Text Processing and Scripting
  87. Dive into Python 3
  88. why's (poignant) guide to Ruby
u/ma_trix · 4 pointsr/ADHD

The best possible book I can advise is "Test-Driven Development" by Kent Beck. Amazon link for reference :
http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530/

It's well written and introduces one to TDD in a really cool, systematic way with real-life (or real-life inspired) examples.

u/bwainwright · 4 pointsr/java

We assign mentors (usually the more experienced team members, but can vary depending on project and resourcing requirements) to new guys who will help them get to grips with things like our methodologies, coding standards, etc.

If we end up with a team consisting of a lot of guys without TDD experience (rare, but my teams can vary depending on other projects/resources within my company), we'll occasionally run TDD workshops where one of my senior guys or myself will go through a fill worked example of TDD, and then point the new guys in the direction of suitable resources so they can self learn (although we support them as much as required).

In terms of resources, there are a number of books we have on our internal "recommended reading" list:

  1. The Clean Coder : A Code Of Conduct For Professional Programmers by Robert C. Martin (http://www.amazon.com/The-Clean-Coder-Professional-Programmers/dp/0137081073). This is a good book for developers in general, but has a good section on TDD.

  2. Test Driven Development : By Example by Kent Beck (http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530/ref=sr_1_1?s=books&ie=UTF8&qid=1458766760&sr=1-1&keywords=kent+beck). Kent Beck is one of the leading proponents of TDD, and this is well worth a read. I find that the fact the text is example driven really helps our developers relate TDD principals to actual real life situations.
  3. xUnit Test Patterns : Refactoring Test Code by Gerard Meszaros (http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054). This is a bit more advanced and goes above why and how to use TDD - in fact, it's not specifically about TDD, but rather just unit tests in general. However, it explains ways and patterns that can be used to design your code and your tests correctly in order to produce quality tests.

    There's a lot of information on the web, but I find sometimes books are just the best source.
u/thehocho · 4 pointsr/cscareerquestions

There's a [book] (http://www.amazon.com/Test-Driven-Development-By-Example/dp/0321146530/).

It's a "classic" but I personally found it on the slow/pedantic side. See if you can borrow it from someone or find a chapter online for free before you buy it.

edit - formatting

u/[deleted] · 3 pointsr/PHP
u/trolleycrash · 3 pointsr/programmer

I have a similar story, and came from a procedural background, too.

My eureka moment came when I started to understand the importance of Test-Driven Development. Test-driven Development by Example is the book that tipped the scales for me. There are more modern and pertinent examples now, but this book is a classic.

TDD will help your programming be more declarative, which will in turn help you work with frameworks like Unity.

Happy coding!

u/Ravilan · 3 pointsr/node

IMO you should go beyond learning node.
Learn javascript (node is just javascript with core libraries).
Actually don't learn javascript, learn how to code.
Even more, learn how to learn.

I'm not the only one with this opinion: http://blog.codinghorror.com/please-dont-learn-to-code/

Also a side point: learn how to test. Testing (may it be unit, behaviour, …) is really important. It helps you code better, have a stronger code (less bugs, or more easily identifiables), more maintainable, and so on.

If you know the basis of code, and how to learn, not only you'll know node, but you'll potentially know php, ruby, scala, whatever.

I strongly encourage you to read:

u/jesusdiez · 3 pointsr/PHP

Test, test and test. Read about TDD (https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530). Learn about the tools (phpUnit, phpSpec, behat) and start using them. You will find hard testing at the beginning, like everything, but later you won't want to work in without tests.
Apart of that, learn how the composer package manager works and don't do anything without it. Don't reinvent the wheel and use components that someone already invested a lot of hours in (auth, orm, microframeworks).
Think about your systems as a composition of pieces that work well together, without need of coupling to a specific framework.

u/ircmaxell · 3 pointsr/PHP

My only reservation here is that it's not really a TDD exercise. TDD typically involves choosing and writing tests for the functionality being added next by the developer, as opposed to here where the test dictates the next piece of functionality to add. It's a subtle difference, but a tangible one.

Now I'm not saying that this isn't a good idea. I'm not saying it isn't useful. Just that it's not quite TDD, as the design evolution is already in place for you, and you're just writing the code.

For a great example of what I'm talking about, check out Kent Beck's Test Driven Development, By Example. He walks through developing a few applications using TDD while keeping a "mini backlog" of what to do next, constantly adjusting the priorities.

Again, not putting this down, just not quite sure if it's as much as a TDD exercise as a testing exercise. But it's an interesting concept...

u/tieTYT · 2 pointsr/programming

Yes, his book is titled "Test Driven Development: By Example".

u/keithb · 2 pointsr/programming

Try Test-Driven Development. In TDD, programming proceeds by accumulating ever larger catalogues of concrete examples. Get hold of Beck's Test Driven Development: by example Get your buddies to set you up with a TDD environment in Ruby and off you go.

u/xoxer · 2 pointsr/programming

This pretty much defines the TDD workflow. It's exactly as mr_chromatic describes it.

u/solid7 · 2 pointsr/learnprogramming

In the interest of giving you something to do which differs from what just about everyone else will say... write the following failing unit test and make it pass ;P

import question
import unittest

class ProjectTest(unittest.TestCase):
def testGetQuestion(self):
test_obj = question.Question()
expected = 'What is the sum of all fears?'
self.assertEqual(test_obj.GetQuestion(), expected)

Refactor, rinse, repeat.

A great reference

Another great reference

u/DeliveryNinja · 2 pointsr/java

Today the defacto way to design something is though tests. Some people might disagree with me here but I believe that Test Driven Development can help. You may want to do a small top level design but before you write any code you must always write the unit test for that code first. This way you can see how it is going to be used before you spend time coding it. Each of your tests should represent a piece of functionality in the code base. As you write each test you implment just enough code to get it to pass before you move on to the next one. Never regressing by letting old tests fail.

I usually start with a top level class and work out it's relationship to other objects in the design through interfaces. Then I'll write tests for each of the dependent objects and work top down like this. This is known as the London style TDD. There are other ways as well.

I reccommend this book:

Growing object orientated design through tests

Also this one, (but it's a bit long winded and it's a different style of TDD)

Test Driven - Kent Beck

u/attekojo · 2 pointsr/learnprogramming

If you want an excellent whirlwind tour to computer science basics with a language you've probably never heard of, I'd recommend MIT's Structure and Interpretation of Computer Programs course. The video lectures and the course book are available free online. It's pretty tough going but will seriously expand your mind :)

For design stuff I'd recommend reading books about OO testing and refactoring, like this or this.

u/crowseldon · 2 pointsr/argentina

EducacionIT es decente. Mas allá de lo que hagas. Lo mas importante es que practiques e intentes hacer cosas. Lo que lees no sirve si no lo usás.

Te recomiendo muchísimo que aprendas, en cuanto sepas usar mínima-mente las herramientas, como hacer unit tests y que es Test-Driven Development.

Este libro es excelente para entender TDD y está en java

u/guifroes · 2 pointsr/learnprogramming

Interesting!

Looks to me that you can "feel" what good code looks like but you're not able to rationalise it enough for you to write it on your own.

Couple of suggestions:

When you see elegant code, ask yourself: why is it elegant? Is it because is simple? Easy to understand? Try to recognise the desired attributes so you can try to reproduce on your code.

Try to write really short classes/methods that have only one responsibility. For more about this, search for Single Responsibility Principle.

How familiar are you with unit testing and TDD? It should help you a lot to write better designed code.

Some other resources:

u/ForeverAlot · 1 pointr/programming

I don't know of any one source that teaches "good testing principles". There are thousands of sources and Sturgeon's law is working against you. A few sources are predominantly good, most have bits (often the same bits) of genuinely good advice in-between chapters of bland, uninsightful repetition, many are appropriations of popular acronyms by closely or distantly related professions (no, you're not "testing" a requirement specification, you're just reviewing it), and some sources are just plain bad.

I had an opportunity to attend Dan North's Testing Faster course and would strongly recommend it. In my case it was more helpful for formalising my own experience than learning concrete new things but other attendees did absolutely "learn new things". He made a point that "TDD" and "BDD" are both inaccurate names and that something like "example-guided development" would have been far more honest; he recommended a book, I think Specification by Example, as a good resource to that end (and noted that that name, too, is technically inaccurate). He also confirmed that Cucumber is a solution looking for a problem.

Test Driven Development: By Example by Kent Beck is a classic, and as far as I can remember, decent. It's maybe a little old now, and it definitely misses some subtle points about maintainability of automated tests in general (or perhaps rather, doesn't really address that).

I've skimmed Code Complete 2. I don't remember it in detail but my overall impression of it was that the sooner it becomes irrelevant the better, because that would signify our profession maturing (if not quite reaching maturity). A lot of its contents would be considered basic by contemporary software development standards and that's a good thing. I don't remember what it says about testing. One thing in a very late chapter (33.8?) stuck with me, though: that seniority has little to do with age and your approach to software development will be formed early on.

Working Effectively with Legacy Code by Michael Feathers is excellent, perhaps the most practically applicable one here.

Sandi Metz is famous in the Ruby community for speaking on this topic and there are recordings on YouTube. From what I've seen her material also mainly addresses beginners but it's fast and easy to consume and her form doesn't bother me the way Martin's does.

One piece of advice I picked up from one of those mostly-mediocre sources had to do with naming in tests, trying to capture the essentials. If you're relying on a particular property of a piece of input to test behaviour, make sure this is evident. Conversely, if any input would satisfy, avoid drawing undue attention:

fn bees_can_fly() {
let some_bee = ...
let bumblebee = ...
let dest = ...

assert fly(some_bee, dest);
assert fly(bumblebee, dest);
}

fn bees_can_pollinate() {
let some_bee = ...
let flower = ...

assert pollinate(some_bee, flower);
}

Testing is about developing confidence. There are many kinds of testing and many things to develop confidence in. For automatic tests it's more about checking (arguably not "testing") that you retain correctness in the face of continuous change. Automatic tests that obstruct that change or compromise your confidence are not helping you and should be rewritten or removed. Reliability of tests is usually more valuable than coverage, for instance.

u/switching · 1 pointr/AskReddit

Read the PHP manual, a couple times - http://us.php.net/manual/en/index.php

The two books that did the most for my coding are:
Refactoring by Martin Fowler:
http://books.google.com/books?id=1MsETFPD3I0C&lpg=PP1&dq=refactoring&pg=PP1#v=onepage&q&f=false

Test Driven Development: by Example by Kent Beck
http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530

You should definitely learn other WebDev techniques .. ASP.NET/Java to embrace the order, Ruby/Python to embrace the chaos.

u/fork_that · 1 pointr/PHP

Point? You write enough test code to make it fail, you then write enough feature code to make it pass...

For more information http://www.amazon.com/Test-Driven-Development-By-Example/dp/0321146530

u/victorstanciu · 1 pointr/bookexchange

I would offer the following:

u/jtbrown · 1 pointr/swift

This guide will get you started with testing in Swift 4. It'll help you get everything set up properly and show you how to write your first tests in Swift. If you want even more depth, you could try Test-Driven iOS Development with Swift 4, Test-Driven iOS Development (Objective-C), or the seminal book, Test-Driven Development: By Example which uses Java.

u/Andrew_Shay · 1 pointr/learnpython
u/thiswillspelldoom · 0 pointsr/learnprogramming

You need this: http://en.wikipedia.org/wiki/Software_design_pattern

More specifically you need to develop good understanding not only of what design patterns are but also...

  • how they describe a problem and a solution in abstract terms
  • how you can identify when your problem can be described in more abstract terms that has a design pattern solution
  • how you can modify design patterns to accommodate irregularities and inconsistencies in your problem, and when you should instead modify the problem to accommodate the design pattern

    These things can take a long time to get used to. Object Oriented is a very useful paradigm to work in but it is, in itself, a design pattern. It is also useful to know when you are better off not doing things in an object oriented way.

    But probably the most important bit of advice, and the thing that helped me to properly understand OOP is unit testing, and how to do it properly. If you haven't yet read it, then read this book and apply what it teaches you in your projects. Learn to use a good testing framework and a good mocking framework (in c#, for example, my preference is for Moq and NUnit) and learn to express yourself in test code. Learn also about dependency injection. These testing techniques, and the TDD story, will guide you not only in writing the units of your project, but also in architecting it and letting testability guide the design. Once you see how the design of your code is affected, you'll start to understand OOP a lot more, and also the finer points of the design patterns you want to implement.

    Good luck :)