(Ebook) Professional test-driven development with C# : developing real world applications with TDD by James Bender; Jeff McWherter ISBN 9781118102107, 9781118102114, 9781118102121, 111810210X, 1118102118, 1118102126 pdf download
(Ebook) Professional test-driven development with C# : developing real world applications with TDD by James Bender; Jeff McWherter ISBN 9781118102107, 9781118102114, 9781118102121, 111810210X, 1118102118, 1118102126 pdf download
https://ebooknice.com/product/professional-test-driven-development-
with-c-developing-real-world-applications-with-tdd-33558838
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312
https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018
(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT
Subject Test: Math Levels 1 & 2) by Arco ISBN 9780768923049,
0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-
arco-master-the-sat-subject-test-math-levels-1-2-2326094
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044
https://ebooknice.com/product/modern-c-programming-with-test-driven-
development-code-better-sleep-better-21965032
https://ebooknice.com/product/test-driven-development-with-react-
apply-test-driven-development-in-your-applications-33648056
https://ebooknice.com/product/test-driven-development-in-swift-
compile-better-code-with-xctest-and-tdd-33171280
FFIRS.indd ii 3/31/11 8:14:17 AM
PROFESSIONAL
TEST-DRIVEN DEVELOPMENT WITH C#
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
James Bender
Jeff McWherter
ISBN: 978-0-470-64320-4
ISBN: 978-1-118-10210-7 (ebk)
ISBN: 978-1-118-10211-4 (ebk)
ISBN: 978-1-118-10212-1 (ebk)
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to
the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011,
fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or
promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work
is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional
services. If professional assistance is required, the services of a competent professional person should be sought. Neither
the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or website is
referred to in this work as a citation and/or a potential source of further information does not mean that the author or the
publisher endorses the information the organization or website may provide or recommendations it may make. Further,
readers should be aware that Internet websites listed in this work may have changed or disappeared between when this
work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other
countries, and may not be used without written permission. All other trademarks are the property of their respective
owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
—James
—Jeff
— Michael
JAMES BENDER is Vice Present of Technology for Improving Enterprises and has been involved in
software development and architecture for 17 years. He has worked as a developer and architect
on everything from small, single-user applications to Enterprise-scale, multi-user systems. His
specialties are .NET development and architecture, SOA, WCF, WF, cloud computing, and agile
development methodologies. He is an experienced mentor and author.
James has spent his career pushing the envelope of software development and pursuing new and
better ways of building applications. He began his career developing credit card processing
applications in C++ on SCO Unix based systems. In the late 90’s James began exploring web
development with both Java based JSP pages and Microsoft’s ASP technologies. He was an early
adopter of .NET starting with the fi rst public beta. He continued exploring the .NET technology
stack, focusing on the distributed computing paradigm made possible by .NET web services, which
naturally evolved into a somewhat obsessive interest in Microsoft’s Windows Communication
Foundation (WCF).
James has been practicing agile-based methodologies since 2003, including Scrum and eXtreme
Programming (XP). At part of this interest in agile methodologies, James began exploring test-driven
development at the same time. He was instrumental in introducing the concepts and techniques used
in agile software development and test-driven development to many developers at his clients and in
the software development community in general.
James is a Microsoft MVP for Visual C#. James is an active member of the development community.
He is the current president of the Central Ohio .NET Developers Group (www.condg.org) and
continues to lead the Columbus Architects Group (www.colarc.org) and is the senior editor of
fi rst-party content for nplus1.org, an educational website aimed toward architects and aspiring
architects. His blog can be found at www.jamescbender.com.
JEFF MCWHERTER is a partner and director of development at Gravity Works Design and
Development, based in a historic office in Lansing Michigan’s Old Town District. A graduate of
Michigan State University with over 12 years of professional software development experience, Jeff
holds numerous certifications from Microsoft including Microsoft Certified Solutions Developer
(MCSD), Microsoft Certified Database Administrator (MCDBA), Microsoft Certified Application
Developer (MCAD), and Microsoft Technology Specialist (MCTS).
In 2010 Jeff was awarded with the Microsoft Most Valuable Professional (MVP) for the third year
in a row. Also in 2010, Jeff received the Ten Over The Next Ten award presented by the Lansing
Regional Chamber of Commerce, which recognizes 10 young professionals to “watch” over the next
10 years. Jeff is also a published author, with Testing ASP.NET Web Applications published by
Wrox Press.
Along with being an author and software developer, Jeff is very active in developing programming
communities across the country by speaking at conferences and organizing events such as the
Lansing Give Camp, which pairs developers with non-profit organizations for volunteer projects.
MICHAEL EATON has been developing awesome solutions using Microsoft tools and technologies
since 1994, but in 2001 he broke free from the confi nes of the cube farm to go out on his own.
While he lives in the middle- of-nowhere Michigan, he serves clients throughout the Midwest. Well
known for his dislike of web development and box lunches, his focus over the past few years has
been on XAML -based technologies like WPF and Silverlight. He speaks at regional events and user
groups, runs the Kalamazoo X Conference and helps with the Ann Arbor Give Camp. He is also a
C# MVP. When not working on projects or spending time with his family, he treats his World of
Warcraft addiction with ample doses of time on his XBox 360.
MITCHEL SELLERS specializes in software development using Microsoft technologies. He is the CEO
of IowaComputerGurus Inc., a Microsoft C# MVP, a Microsoft Certified Professional, has served
as an author on two books, and served as technical editor on many other books. You will often fi nd
Mitchel interacting with the greater software development community either at events/conferences
or in online discussion forums. To obtain additional information on Mitchel’s professional
experience, certifications, and publications refer to his resume at MitchelSellers.com.
I WANT TO START BY THANKING MY GIRLFRIEND (with any luck, fiancé by the time you are reading
this) Gayle. She has been very supportive and EXTREMELY understanding during the process of
writing this book. More than she should have had to be. Thank you.
I want to thank my parents for making this book possible by making me possible. My mother is so
proud she’ll read every page of this book. Bless her heart. I hope she’s still proud when she realizes
I lied and this is NOTHING like a Stephen King novel.
In the understanding and supporting department I would also like to thank Daniel Grey, Mark
Kovacevich, Jeff Perry and everyone else at Improving Enterprises. I’d also like to thank Pete
Klassen. We miss you man!
I’d like to thank Jeff McWherter and Michael Eaton for their contributions to this book. Jeff; thanks
for taking some of the load off. Mike; thank you for pushing me to include the “non-web” people.
I’d also like to thank my editor Sydney for making this book look like I know how to write.
Brian Prince; thank you for pushing me to get involved in the development community. I was going
to write something funny here, but I couldn’t think of anything. I’ll getcha in the next one.
When I was presented with the opportunity to write this book, I almost said no. I want to thank
Ted Neward for talking me into it. So, this is kinda your fault too.
I want to thank my partners in NPlus1.org Mike Wood and Chris Woodruff for picking up my slack
of the past several months while I worked on this.
Long list of general thanks: Brahma Ghosh, Brian Sherwin, Bill Sempf, Jeff Blankenburg, Carey
Payette, Caleb Jenkins, Jennifer Marsman, Sarah & Kevin Dutkiewicz, Steve Harman, Josh
Holmes. Thanks to Matt Groves for pimping this book almost as much as I did. I’m sure I forgot
someone, so I apologize.
—James
FIRST AND FOREMOST I WOULD LIKE TO THANK my very patient wife Carla. Thank you for all the
support, patience, and understanding you have provided to me for all of my endeavors. Thank you to
the staff at Gravity Works — Amelia Marschall, Lauren Colton, Scott Gowell and Dave Smith — for
answering my random questions that appeared to come out of nowhere. And lastly I would like to
thank James for his hard work, dedication, and friendship.
—Jeff
INTRODUCTION xxv
Why Refactor? 42
A Project’s Lifecycle 42
Maintainability 43
Code Metrics 43
Clean Code Principles 45
OOP Principles 45
Encapsulation 45
Inheritance 46
Polymorphism 48
The SOLID Principles 49
The Single Responsibility Principle 50
The Open/Close Principle 50
The Liskov Substitution Principle 51
The Interface Segregation Principle 51
The Dependency Inversion Principle 52
Code Smells 52
What Is a Code Smell? 52
Duplicate Code and Similar Classes 53
Big Classes and Big Methods 54
Comments 55
Bad Names 56
Feature Envy 57
Too Much If/Switch 58
Try/Catch Bloat 59
Typical Refactoring 60
Extract Classes or Interfaces 60
Extract Methods 62
Rename Variables, Fields, Methods, and Classes 66
Encapsulate Fields 67
Replace Conditional with Polymorphism 68
Allow Type Inference 71
Summary 71
xviii
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com