Beginning Object-Oriented Programming with C#
Home > Computing and Information Technology > Computer programming / software engineering > Object-oriented programming (OOP) > Beginning Object-Oriented Programming with C#
Beginning Object-Oriented Programming with C#

Beginning Object-Oriented Programming with C#

|
     0     
5
4
3
2
1




Out of Stock


Notify me when this book is in stock
About the Book

The ideal beginner's guide to C# and object-oriented programming Wrox beginners' guides have the perfect formula for getting programming newcomers up and running. This one introduces beginners to object-oriented programming using C# to demonstrate all of the core constructs of this programming framework. Using real-world situations, you'll discover how to create, test, and deliver your programs and how to work with classes, arrays, collections, and all the elements of object-oriented programming. Covers exactly what beginners, even those with no prior programming experience, need to know to understand object-oriented programming and start writing programs in C# Explains the advantages and disadvantages of C#, and tips for understanding C# syntax Explores properties, encapsulation, and classes; value data types; operands and operators; errors and debugging; variables; and reference types Shows how to use statement repetition and program loops, understand arrays and collections, and write your own classes Also covers inheritance and polymorphism Beginning Object-Oriented Programming with C# uses the tried-and-true Wrox formula for making this popular programming method easy to learn.

Table of Contents:
INTRODUCTION xxv PART I: GETTING STARTED CHAPTER 1: INTRODUCING C# 3 A Short History of Object-Oriented Programming (OOP) 4 Installing C# 5 Downloading Visual Studio Professional 5 A Test Program Using C# 8 Creating a Project 9 The C# Integrated Development Environment 10 The Major IDE Windows 10 Using the Source Code Window 12 Adding a Toolbox Object to a Windows Form 13 Changing the Text of a Label Object 14 Running the Program 16 Summary 16 CHAPTER 2: UNDERSTANDING OBJECTS 19 Understanding Objects 20 Everyday Use of Objects 20 Class Properties 20 Class Methods 22 How Many Properties, How Many Methods? 23 Classes Are Simplifi cations of Objects 23 What Do I Do After I’ve Defi ned a Class? 23 Instantiating an Object of a Class 26 I Have an Object…Now What? 29 Why Hide the Data Inside an Object? 32 Getting Started with Objects 32 Developing a Program Plan 38 Where to Start? The Five Program Steps 38 The Five Program Steps 38 Creating a Simple Application Using Objects 40 Using the Program Steps to Create a Program Plan 40 1: Initialization 40 2: Input 41 3: Process 42 4: Display 43 5: Termination 43 Using C# to Implement Your Program Plan 43 Critique of the btnDisplayOutput Click Event Code 53 Summary 54 PART II: UNDERSTANDING C# SYNTAX CHAPTER 3: UNDERSTANDING DATA TYPES 59 Computer Data 59 Integer Data Types 60 Range of Integer Data Types 61 Understanding Binary Numbers 61 Signed Integer Values 62 Which Integer Should You Use? 62 Variable Naming Rules and Conventions 63 Floating-Point Data Types 71 Which Floating-Point Data Type Should You Use? 74 Monetary Values: The Decimal Data Type 74 Using IntelliSense to Locate Program Errors 76 Syntax Rules and Error Messages 76 The Boolean Data Type 77 Summary 79 CHAPTER 4: UNDERSTANDING C# STATEMENTS 81 Basic Building Blocks of a Programming Language 82 Operands and Operators 82 Expressions 83 Statements 83 Operator Precedence 84 Overriding the Default Precedence Order 85 Defi ning Variables 87 Defi ning a Variable from the Compiler’s Point of View 87 Step 1: Preliminary Syntax Checking 87 Step 2: Symbol Table Checking 87 Step 3: Defi ning a Variable 89 Using a Variable in a Program 90 Bucket Analogy 91 Types of Program Errors 93 Syntax Errors 93 Semantic Errors 93 Logic Errors 94 The Visual Studio Debugger 94 The Debugging Process 94 Making Repetitious Debugging Easier 95 Using the Visual Studio Debugger 97 Setting a Breakpoint 97 Using a Breakpoint to Examine Variables 98 Single-Stepping the Program 100 Defensive Coding 101 Write Your Code So That Someone Else Can Easily Understand It 101 Use Program Comments 101 Use Meaningful Variable Names 103 Avoid Magic Numbers 104 Use a Consistent Coding Style 105 Take a Break 105 Use a Second Set of Eyes 105 Summary 106 CHAPTER 5: UNDERSTANDING REFERENCE DATA TYPES 109 String Variables 110 Defi ning a String Reference Variable 110 The Meaning of null 111 Why Reference Types Are Diff erent from Value Types 113 Reference Variable Rules 113 Reference Type Variables Versus Value Type Variables 115 Why Do Reference Variables Work the Way They Do? 115 Pass by Value Versus Pass by Reference 116 A Little Effi ciency Gain 116 Using String Variables 117 String Concatenation 117 Shorthand Assignment Operators 117 String Manipulation 118 String Length 118 Letting IntelliSense Show You Properties and Methods 119 Using an IntelliSense Option 120 An Important Distinction Between Properties and Methods 120 Thinking About Object Properties and Methods 120 Strings and Escape Sequences 131 Verbatim String Literals 132 DateTime Reference Objects 133 DateTime and ToString( ) Conversions 133 Class Constructors 139 Invoking the Application 139 The UpdateTimeInfo( ) Method 140 Overloaded Methods 141 Method Signatures 142 The Refresh Button 143 Summary 144 CHAPTER 6: MAKING DECISIONS IN CODE 147 Relational Operators 148 Using Relational Operators—The if Statement 148 The if-else Statement 152 Shorthand for Simple if-else: The Ternary Operator 154 Style Considerations for if and if-else Statements 155 Nested if Statements 157 RDC 158 Logical Operators 160 Using the Logical Operators 162 Associativity 163 The switch Statement 164 Summary 167 CHAPTER 7: STATEMENT REPETITION USING LOOPS 169 Program Loops 170 Good Loops, Bad Loops 170 The Three Conditions of a Well-Behaved Loop 170 The for Loop 171 Increment and Decrement Operators 172 Sequencing in a for Loop 173 When to Use a for Loop 179 Nested for Loops 179 Use the Debugger as a Learning Tool 182 while Loops 182 Why Have More Than One Type of Loop? 184 do-while Program Loops 185 The continue Statement 189 Summary 190 CHAPTER 8: UNDERSTANDING ARRAYS AND COLLECTIONS 193 What Is an Array? 194 Some Array Details 195 Array Element Versus Array Index 195 N – 1 Rule 196 Casts 201 The ListView Object 201 Arrays Are Objects 206 Multidimensional Arrays 207 Initializing Arrays 211 Variations for Initializing an Array 212 Which Array Defi nition/Initialization Syntax Is Best? 212 Code Like a User 212 Initializing Multidimensional Arrays 213 Initializer Lists for String Objects 213 Ragged Arrays 215 Defi ning Ragged Arrays at Runtime 215 Collections 216 ArrayList Objects 218 Summary 221 PART III: WRITING YOUR OWN CLASSES CHAPTER 9: DESIGNING CLASSES 227 Class Design 228 Scope 230 Block Scope 231 Local Scope 232 Class Scope 232 Namespace Scope 233 Visualizing Scope 233 Why Does C# Support Scope? 235 Think Before You Write 235 Designing a Program 236 The Five Program Steps 236 Initialization Step 236 Input Step 238 Process Step 238 Display Step 238 Termination Step 238 Look at the Forest, Not Just the Trees 238 UML Light 239 Access Specifi ers 239 Access Specifi ers and Scope 240 The static Keyword 241 UML Methods 242 Design Intent and Access Specifi ers for Methods 242 Class Property and Method Names 244 Think Like a User 245 The clsDates Design 245 namespace Modifi er 247 Class Organization 248 static Data Versus Instance Members 248 Property and Helper Methods 249 General Methods 249 User Interfaces Versus User Interfaces 252 Summary 252 CHAPTER 10: DESIGNING AND WRITING CUSTOM CLASSES 255 Constructors 256 Default Constructors 256 Nondefault Constructors 256 Constructor Overloading 257 Constructor Sloppiness 257 Fixing the Constructor Problem 258 Always Call the Default Constructor 259 Property Methods 259 Property Methods and Getters and Setters 260 Property Method Rules 261 How the get Property Methods Work 262 How Does Visual Studio Know Whether to Use the get or set Statement Block? 263 What to Do if an Error Occurs in a Property Method 264 Method Coupling and Cohesion 266 Cohesion 266 Coupling 266 Class Design for Deck-of-Cards Program 267 UML Class Diagram for Shuffl e Deck Program 268 Class Constants and Properties 268 Class Methods 269 The clsCardDeck Code 273 Class Properties, Constructor, and Property Methods 275 Class General Methods 276 Designing a Card Game Using clsCardDeck 278 Design Considerations 279 What Kind of Architecture? 279 Sideways Refi nement 280 Summary 291 CHAPTER 11: EXCEPTION HANDLING AND DEBUGGING 295 Overview 296 Bugs 296 Syntax Errors 296 Semantic Errors 296 Logic Errors 297 Input Errors 297 Data Validation 297 Limit User Input 298 Check Boxes 301 Combination Boxes 302 Date and Time Input 304 Exception Handling 306 try-catch Statement Blocks 308 Anticipating a Specifi c Exception 310 Fuzzy Exception Messages 312 The fi nally Statement Block 313 Program Debugging 314 The Nature of the Beast 314 Detection 314 Isolation 316 The Visual Studio Debugger 316 The Locals Window 317 The Immediate Window 318 Single-Stepping Through the Program 318 Backing Up from a Breakpoint 319 The Debug Toolbar 319 Finding the Bug 320 Scaff old Code 321 Toggling Scaff old Code 322 Defensive Coding 322 Summary 323 CHAPTER 12: GENERICS 327 What Are Generics? 327 Recursion 333 Data Problems 333 Introduction to Generics 334 Generics Versus ArrayLists 334 Boxing and Unboxing 335 Generic Quicksort 343 Using Generics with Constraints and Interfaces 347 Interfaces 347 Why Use an Interface? 348 Using an Interface 349 How Do You Know an Interface Is Implemented for a Data Type? 350 Summary 354 PART IV: STORING DATA CHAPTER 13: USING DISK DATA FILES 359 Directories 360 The DriveInfo Class 360 Directory Class 360 DirectoryInfo Class 361 File Class 367 FileInfo Class 368 Types of Files 369 Textual Versus Binary Data Files 370 Sequential Versus Random Access Files 380 Sequential Files 380 Advantages and Disadvantages of Sequential Files 380 Random Access Files 381 Fixed Record Sizes 381 Advantages and Disadvantages of Random Access Files 383 Serialization and Deserialization 411 To Serialize or Not to Serialize 417 MDI, Menus, and File Dialogs 418 Summary 422 CHAPTER 14: USING DATABASES 425 What Is a Database? 425 The Structure of a Database 426 Database Tables, Fields, and Records 426 Designing Fields for a Database Table 427 Data Normalization 428 Creating Your Own Databases 432 Using SQL Server Management Studio 432 Using SQL 435 The SELECT Statement 435 The WHERE Predicate 436 The ORDER BY Clause 436 Aggregates 437 A DBMS System 438 Displaying Database Data Without Data Binding 451 Performing the Query 452 Edit a Record (UPDATE) 454 Summary 456 CHAPTER 15: USING LINQ 459 Using LINQ 459 Query Keywords 460 Summary 470 PART V: ADVANCED TOPICS CHAPTER 16: INHERITANCE AND POLYMORPHISM 475 What Is Inheritance? 476 An Inheritance Example 476 The Base and Derived Classes 478 The protected Access Specifi er 479 Advantages of Inherited Relationships 480 Base Classes Are Not Derived Classes 491 Abstract Classes 491 Polymorphism 492 Extension Methods 495 Summary 498 CHAPTER 17: PRINTING AND THREADING 501 Using a Printer 501 Threading 509 A Threading Program 510 What Have You Gained with Threading? 515 Refactoring 516 Rename 516 Extract Method 516 Summary 520 CHAPTER 18: WEB PROGRAMMING 523 Static Web Pages 523 Dynamic Web Pages 530 Summary 535 APPENDIX: ANSWERS TO EXERCISES 539 INDEX 577


Best Sellers


Product Details
  • ISBN-13: 9781118387948
  • Publisher: John Wiley & Sons Inc
  • Binding: Digital (delivered electronically)
  • No of Pages: 624
  • ISBN-10: 1118387945
  • Publisher Date: 05 Nov 2012
  • Language: English


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Beginning Object-Oriented Programming with C#
John Wiley & Sons Inc -
Beginning Object-Oriented Programming with C#
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Beginning Object-Oriented Programming with C#

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals

    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!