CHF25.00
Download est disponible immédiatement
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.
Auteur
Jack Purdum, Ph.D., is an established author of more than a dozen programming books. Using his teaching experience as a professor of computer language instruction at Purdue University, he has identified common stumbling blocks for beginning programmers and knows how to teach concepts so readers can understand and code immediately.
Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.
Résumé
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.
Contenu
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 ObjectNow 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 <...