Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Fundamentals of Computer Programming with C# (The Bulgarian C# Programming Book)
PREMIUM
Số trang
1122
Kích thước
10.7 MB
Định dạng
PDF
Lượt xem
1961

Fundamentals of Computer Programming with C# (The Bulgarian C# Programming Book)

Nội dung xem thử

Mô tả chi tiết

Fundamentals of Computer Programming with C#

(The Bulgarian C# Programming Book)

by Svetlin Nakov & Co.

http://www.introprogramming.info

ISBN: 978-954-400-773-7

ISBN-13: 978-954-400-773-7 (9789544007737)

ISBN-10: 954-400-773-3 (9544007733)

Pages: 1122

Language: English

Published: Sofia, 2013

Tags: book; free book; ebook; e-book; programming; computer programming; programming concepts; programming principles; tutorial;

C#; data structures; algorithms; Intro C#; C# book; book C#; CSharp; CSharp book; programming book; book programming; textbook;

learn C#; study C#; learn programming; study programming; how to program; programmer; practical programming guide; software

engineer; software engineering; computer programming; software developer; software technologies; programming techniques; logical

thinking; algorithmic thinking; developer; software development; programming knowledge; programming skills; programming language;

basics of programming; presentations; presentation slides; coding; coder; source code; compiler; development tools; code decompiler;

JustDecompile; debugging code; debugger; Visual Studio; IDE; development environment; bug fixing; class library; API; C#; .NET; .NET

Framework; types; variables; operators; expressions; statements; value types; reference types; type conversion; console; console input;

console output; console application; conditional statements; if; if-else; switch-case; loops; whole; do-while; for loops; foreach; nested

loops; arrays; matrices; multidimensional arrays; numeral systems; binary numbers; decimal numbers; hexadecimal numbers;

representations of numbers; methods; method invocation; parameters; recursion; iteration; recursive algorithms; classes; objects; fields;

constructors; properties; static fields; static methods; static constructor; static members; namespaces; exceptions; exception handling;

stack trace; catch exception; throw exception; try-catch; try-finally; using statement; strings; text processing; StringBuilder; escaping;

System.String; regular expressions; string formatting; OOP; object-oriented programming; access modifiers; public; private; protected;

internal; this keyword; const fields; readonly fields; default constructor; implicit constructor; overloading; method overloading; constructor

overloading; automatic properties; read-only properties; constants; enumerations; inner classes; nested classes; generics; generic types;

generic methods; text files; streams; files; StreamReader; StreamWriter; data structures; ADT; abstract data structure; linear data

structures; list; linked list; static list; doubly-linked list; array list; stack; queue; deque; trees; graphs; binary tree; binary search tree;

balanced tree; balanced search tree; B-tree; red-black tree; tree traversal; ordered balanced search tree; graph representation; list of

edges; list of successors; adjacency matrix; depth-first search; DFS; breadth-first search; BFS; dictionary; hash table; associative array;

hash function; collision resolution; set; multi set; bag; multi bag; multi dictionary; algorithm complexity; asymptotic notation; time

complexity; memory complexity; execution time; performance; collection classes; .NET collections; Wintellect Power Collections; OOP;

principles; abstraction; encapsulation; polymorphism; abstract class; interface; operation contract; virtual method; method overriding;

cohesion; strong cohesion; coupling; loose coupling; spaghetti code; object-oriented modeling; UML; use-case diagram; sequence diagram;

statechart diagram; activity diagram; design patterns; singleton; factory method; code quality; high-quality code; code conventions; naming

identifiers; variable names; method names; naming classes; code formatting; high-quality classes; high-quality methods; variable scope;

variable span; variable lifetime; control-flow statements; defensive programming; assertions; code documentation; documentation; self￾documenting code; code refactoring; lambda expressions; LINQ; extension methods; anonymous types; LINQ queries; data filtering; data

searching; data sorting; data grouping; problem solving; problem solving methodology; problems and solutions; generating ideas; task

decomposition; algorithm efficiency; writing code; code testing; border cases testing; borderline cases; performance testing; regression

testing; exercises; problems; solutions; programming guidelines; programming problems; programming exercises; good programmer;

efficient programmer; pragmatic programmer; Nakov; Svetlin Nakov; Software Academy; Bulgaria; Bulgarian book; BG book; Bulgar ian C#

book; Kolev; Vesselin Kolev; Dilyan Dimitrov; Hristo Germanov; Iliyan Murdanliev; Mihail Stoynov; Mihail Valkov; Mira Bivas; Nikolay

Kostov; Nikolay Nedyalkov; Nikolay Vassilev; Pavel Donchev; Pavlina Hadjieva; Radoslav Ivanov; Radoslav Kirilov; Radoslav Todorov;

Stanislav Zlatinov; Stefan Staev; Teodor Bozhikov; Teodor Stoev; Tsvyatko Konov; Vesselin Georgiev; Yordan Pavlov; Yosif Yosifov, ISBN

9789544007737, ISBN 9544007733, ISBN 978-954-400-773-7, ISBN 954-400-773-3

Book Front Cover

Contents

Contents..............................................................................................2

Detailed Table of Contents ..................................................................5

Preface..............................................................................................13

Chapter 1. Introduction to Programming ..........................................69

Chapter 2. Primitive Types and Variables ........................................111

Chapter 3. Operators and Expressions.............................................139

Chapter 4. Console Input and Output ..............................................165

Chapter 5. Conditional Statements ..................................................195

Chapter 6. Loops .............................................................................211

Chapter 7. Arrays ............................................................................235

Chapter 8. Numeral Systems ...........................................................265

Chapter 9. Methods .........................................................................293

Chapter 10. Recursion .....................................................................351

Chapter 11. Creating and Using Objects ..........................................385

Chapter 12. Exception Handling ......................................................415

Chapter 13. Strings and Text Processing.........................................457

Chapter 14. Defining Classes...........................................................499

Chapter 15. Text Files......................................................................615

Chapter 16. Linear Data Structures .................................................641

Chapter 17. Trees and Graphs .........................................................681

Chapter 18. Dictionaries, Hash-Tables and Sets ..............................727

Chapter 19. Data Structures and Algorithm Complexity ..................769

Chapter 20. Object-Oriented Programming Principles .....................807

Chapter 21. High-Quality Programming Code ..................................853

Chapter 22. Lambda Expressions and LINQ .....................................915

Chapter 23. Methodology of Problem Solving ..................................935

Chapter 24. Sample Programming Exam – Topic #1........................985

Chapter 25. Sample Programming Exam – Topic #2......................1041

Chapter 26. Sample Programming Exam – Topic #3......................1071

Conclusion.....................................................................................1119

FUNDAMENTALS OF

COMPUTER PROGRAMMING

WITH C#

(The Bulgarian C# Programming Book)

Svetlin Nakov & Co.

Dilyan Dimitrov

Hristo Germanov

Iliyan Murdanliev

Mihail Stoynov

Mihail Valkov

Mira Bivas

Nikolay Kostov

Nikolay Nedyalkov

Nikolay Vasilev

Pavel Donchev

Pavlina Hadjieva

Radoslav Ivanov

Radoslav Kirilov

Radoslav Todorov

Stanislav Zlatinov

Stefan Staev

Svetlin Nakov

Teodor Bozhikov

Teodor Stoev

Tsvyatko Konov

Vesselin Georgiev

Veselin Kolev

Yordan Pavlov

Yosif Yosifov

Sofia, 2013

FUNDAMENTALS OF COMPUTER

PROGRAMMING WITH C#

(The Bulgarian C# Programming Book)

© Svetlin Nakov & Co., 2013

The book is distributed freely under the following license conditions:

1. Book readers (users) may:

- distribute free of charge unaltered copies of the book in electronic or

paper format;

- use portions of the book and the source code examples or their

modifications, for all intents and purposes, including educational and

commercial projects, provided they clearly specify the original source,

the original author(s) of the corresponding text or source code, this

license and the website www.introprogramming.info;

- distribute free of charge portions of the book or modified copies of it

(including translating the book into other languages or adapting it to

other programming languages and platforms), but only by explicitly

mentioning the original source and the authors of the corresponding

text, source code or other material, this license and the official website

of the project: www.introprogramming.info.

2. Book readers (users) may NOT:

- distribute for profit the book or portions of it, with the exception of the

source code;

- remove this license from the book when modifying it for own needs.

All trademarks referenced in this book are the property of their respective

owners.

Official Web Site:

http://www.introprogramming.info

ISBN 978-954-400-773-7

Detailed Table of Contents

Contents..............................................................................................2

Detailed Table of Contents ..................................................................5

Preface..............................................................................................13

About the Book ..........................................................................................13

C# and .NET Framework..............................................................................17

How То Read This Book?..............................................................................22

Why Are Data Structures and Algorithms Emphasized?......................................25

Do You Really Want to Become a Programmer?................................................26

A Look at the Book’s Contents ......................................................................29

History: How Did This Book Come to Be? ........................................................38

Authors and Contributors .............................................................................40

The Book Is Free of Charge! .........................................................................53

Reviews ....................................................................................................53

License .....................................................................................................63

Resources Coming with the Book...................................................................65

Chapter 1. Introduction to Programming ..........................................69

In This Chapter ..........................................................................................69

What Does It Mean "To Program"?.................................................................69

Stages in Software Development...................................................................71

Our First C# Program..................................................................................75

The C# Language and the .NET Platform ........................................................79

Visual Studio IDE........................................................................................93

Alternatives to Visual Studio....................................................................... 104

Decompiling Code..................................................................................... 104

C# in Linux, iOS and Android...................................................................... 107

Other .NET Languages............................................................................... 107

Exercises................................................................................................. 108

Solutions and Guidelines............................................................................ 108

Chapter 2. Primitive Types and Variables ........................................111

In This Chapter ........................................................................................ 111

What Is a Variable?................................................................................... 111

Data Types.............................................................................................. 111

Variables................................................................................................. 123

Value and Reference Types ........................................................................ 128

Literals ................................................................................................... 131

6 Fundamentals of Computer Programming with C#

Exercises................................................................................................. 135

Solutions and Guidelines............................................................................ 136

Chapter 3. Operators and Expressions.............................................139

In This Chapter ........................................................................................ 139

Operators................................................................................................ 139

Type Conversion and Casting...................................................................... 152

Expressions ............................................................................................. 158

Exercises................................................................................................. 160

Solutions and Guidelines............................................................................ 161

Chapter 4. Console Input and Output ..............................................165

In This Chapter ........................................................................................ 165

What Is the Console? ................................................................................ 165

Standard Input-Output.............................................................................. 169

Printing to the Console .............................................................................. 169

Console Input .......................................................................................... 183

Console Input and Output – Examples.......................................................... 190

Exercises................................................................................................. 192

Solutions and Guidelines............................................................................ 193

Chapter 5. Conditional Statements ..................................................195

In This Chapter ........................................................................................ 195

Comparison Operators and Boolean Expressions ............................................ 195

Conditional Statements "if" and "if-else" ....................................................... 200

Conditional Statement "switch-case"............................................................ 206

Exercises................................................................................................. 208

Solutions and Guidelines............................................................................ 209

Chapter 6. Loops .............................................................................211

In This Chapter ........................................................................................ 211

What Is a "Loop"?..................................................................................... 211

While Loops............................................................................................. 211

Do-While Loops ........................................................................................ 216

For Loops ................................................................................................ 221

Foreach Loops.......................................................................................... 225

Nested Loops ........................................................................................... 226

Exercises................................................................................................. 231

Solutions and Guidelines............................................................................ 233

Chapter 7. Arrays ............................................................................235

In This Chapter ........................................................................................ 235

What Is an "Array"? .................................................................................. 235

Declaration and Allocation of Memory for Arrays ............................................ 235

Access to the Elements of an Array.............................................................. 238

Reading an Array from the Console.............................................................. 241

Detailed Table of Contents 7

Printing an Array to the Console.................................................................. 243

Iteration through Elements of an Array......................................................... 244

Multidimensional Arrays............................................................................. 246

Arrays of Arrays ....................................................................................... 253

Exercises................................................................................................. 257

Solutions and Guidelines............................................................................ 259

Chapter 8. Numeral Systems ...........................................................265

In This Chapter ........................................................................................ 265

History in a Nutshell.................................................................................. 265

Numeral Systems ..................................................................................... 266

Representation of Numbers ........................................................................ 276

Exercises................................................................................................. 289

Solutions and Guidelines............................................................................ 290

Chapter 9. Methods .........................................................................293

In This Chapter ........................................................................................ 293

Subroutines in Programming ...................................................................... 293

What Is a "Method"? ................................................................................. 293

Why to Use Methods?................................................................................ 294

How to Declare, Implement and Invoke a Method? ......................................... 295

Declaring Our Own Method......................................................................... 295

Implementation (Creation) of Own Method.................................................... 300

Invoking a Method.................................................................................... 301

Parameters in Methods .............................................................................. 303

Returning a Result from a Method ............................................................... 328

Best Practices when Using Methods.............................................................. 345

Exercises................................................................................................. 347

Solutions and Guidelines............................................................................ 348

Chapter 10. Recursion .....................................................................351

In This Chapter ........................................................................................ 351

What Is Recursion? ................................................................................... 351

Example of Recursion................................................................................ 351

Direct and Indirect Recursion...................................................................... 352

Bottom of Recursion.................................................................................. 352

Creating Recursive Methods ....................................................................... 352

Recursive Calculation of Factorial ................................................................ 353

Recursion or Iteration? .............................................................................. 355

Simulation of N Nested Loops ..................................................................... 356

Which is Better: Recursion or Iteration?........................................................ 362

Using Recursion – Conclusions .................................................................... 378

Exercises................................................................................................. 378

Solutions and Guidelines............................................................................ 380

Chapter 11. Creating and Using Objects ..........................................385

8 Fundamentals of Computer Programming with C#

In This Chapter ........................................................................................ 385

Classes and Objects .................................................................................. 385

Classes in C#........................................................................................... 387

Creating and Using Objects ........................................................................ 390

Namespaces ............................................................................................ 405

Exercises................................................................................................. 410

Solutions and Guidelines............................................................................ 412

Chapter 12. Exception Handling ......................................................415

In This Chapter ........................................................................................ 415

What Is an Exception?............................................................................... 415

Exceptions Hierarchy................................................................................. 424

Throwing and Catching Exceptions............................................................... 426

The try-finally Construct ............................................................................ 432

IDisposable and the "using" Statement......................................................... 437

Advantages of Using Exceptions .................................................................. 439

Best Practices when Using Exceptions .......................................................... 445

Exercises................................................................................................. 453

Solutions and Guidelines............................................................................ 454

Chapter 13. Strings and Text Processing.........................................457

In This Chapter ........................................................................................ 457

Strings.................................................................................................... 457

Strings Operations .................................................................................... 462

Constructing Strings: the StringBuilder Class................................................. 480

String Formatting ..................................................................................... 488

Exercises................................................................................................. 491

Solutions and Guidelines............................................................................ 496

Chapter 14. Defining Classes...........................................................499

In This Chapter ........................................................................................ 499

Custom Classes........................................................................................ 499

Usage of Class and Objects ........................................................................ 502

Organizing Classes in Files and Namespaces.................................................. 505

Modifiers and Access Levels (Visibility) ......................................................... 508

Declaring Classes ..................................................................................... 509

The Reserved Word "this" .......................................................................... 511

Fields ..................................................................................................... 512

Methods.................................................................................................. 518

Accessing Non-Static Data of the Class......................................................... 519

Hiding Fields with Local Variables ................................................................ 522

Visibility of Fields and Methods.................................................................... 524

Constructors ............................................................................................ 531

Properties ............................................................................................... 549

Static Classes and Static Members............................................................... 559

Detailed Table of Contents 9

Structures ............................................................................................... 580

Enumerations .......................................................................................... 584

Inner Classes (Nested Classes) ................................................................... 590

Generics ................................................................................................. 594

Exercises................................................................................................. 610

Solutions and Guidelines............................................................................ 613

Chapter 15. Text Files......................................................................615

In This Chapter ........................................................................................ 615

Streams.................................................................................................. 615

Reading from a Text File ............................................................................ 620

Writing to a Text File................................................................................. 628

Input / Output Exception Handling............................................................... 630

Text Files – More Examples ........................................................................ 631

Exercises................................................................................................. 636

Solutions and Guidelines............................................................................ 638

Chapter 16. Linear Data Structures .................................................641

In This Chapter ........................................................................................ 641

Abstract Data Structures............................................................................ 641

List Data Structures .................................................................................. 642

Exercises................................................................................................. 676

Solutions and Guidelines............................................................................ 678

Chapter 17. Trees and Graphs .........................................................681

In This Chapter ........................................................................................ 681

Tree Data Structures................................................................................. 681

Trees...................................................................................................... 681

Graphs ................................................................................................... 714

Exercises................................................................................................. 722

Solutions and Guidelines............................................................................ 723

Chapter 18. Dictionaries, Hash-Tables and Sets ..............................727

In This Chapter ........................................................................................ 727

Dictionary Data Structure........................................................................... 727

Hash-Tables ............................................................................................ 735

The "Set" Data Structure ........................................................................... 760

Exercises................................................................................................. 765

Solutions and Guidelines............................................................................ 767

Chapter 19. Data Structures and Algorithm Complexity ..................769

In This Chapter ........................................................................................ 769

Why Are Data Structures So Important? ....................................................... 769

Algorithm Complexity................................................................................ 770

Comparison between Basic Data Structures................................................... 779

When to Use a Particular Data Structure? ..................................................... 779

10 Fundamentals of Computer Programming with C#

Choosing a Data Structure – Examples......................................................... 786

External Libraries with .NET Collections ........................................................ 801

Exercises................................................................................................. 803

Solutions and Guidelines............................................................................ 804

Chapter 20. Object-Oriented Programming Principles .....................807

In This Chapter ........................................................................................ 807

Let’s Review: Classes and Objects ............................................................... 807

Object-Oriented Programming (OOP) ........................................................... 807

Fundamental Principles of OOP.................................................................... 808

Inheritance.............................................................................................. 809

Abstraction.............................................................................................. 824

Encapsulation .......................................................................................... 828

Polymorphism.......................................................................................... 830

Cohesion and Coupling .............................................................................. 836

Object-Oriented Modeling (OOM)................................................................. 842

UML Notation........................................................................................... 844

Design Patterns........................................................................................ 847

Exercises................................................................................................. 851

Solutions and Guidelines............................................................................ 852

Chapter 21. High-Quality Programming Code ..................................853

In This Chapter ........................................................................................ 853

Why Is Code Quality Important? ................................................................. 853

What Does Quality Programming Code Mean?................................................ 854

Why Should We Write Quality Code? ............................................................ 854

Identifier Naming ..................................................................................... 857

Code Formatting....................................................................................... 866

High-Quality Classes ................................................................................. 874

High-Quality Methods ................................................................................ 878

Proper Use of Variables.............................................................................. 883

Proper Use of Expressions .......................................................................... 890

Use of Constants ...................................................................................... 891

Proper Use of Control Flow Statements......................................................... 894

Defensive Programming............................................................................. 898

Code Documentation................................................................................. 900

Code Refactoring ...................................................................................... 904

Unit Testing............................................................................................. 905

Additional Resources ................................................................................. 912

Exercises................................................................................................. 912

Solutions and Guidelines............................................................................ 913

Chapter 22. Lambda Expressions and LINQ .....................................915

In This Chapter ........................................................................................ 915

Extension Methods.................................................................................... 915

Detailed Table of Contents 11

Anonymous Types .................................................................................... 918

Lambda Expressions.................................................................................. 920

LINQ Queries ........................................................................................... 924

Nested LINQ Queries................................................................................. 930

LINQ Performance .................................................................................... 930

Exercises................................................................................................. 933

Solutions and Guidelines............................................................................ 933

Chapter 23. Methodology of Problem Solving ..................................935

In This Chapter ........................................................................................ 935

Basic Principles of Solving Computer Programming Problems ........................... 935

Use Pen and Paper.................................................................................... 936

Generate Ideas and Give Them a Try! .......................................................... 937

Decompose the Task into Smaller Subtasks................................................... 938

Verify Your Ideas!..................................................................................... 941

If a Problem Occurs, Invent a New Idea! ...................................................... 943

Choose Appropriate Data Structures! ........................................................... 946

Think about the Efficiency!......................................................................... 950

Implement Your Algorithm! ........................................................................ 953

Write the Code Step by Step! ..................................................................... 954

Test Your Solution! ................................................................................... 967

General Conclusions.................................................................................. 979

Exercises................................................................................................. 980

Solutions and Guidelines............................................................................ 983

Chapter 24. Sample Programming Exam – Topic #1........................985

In This Chapter ........................................................................................ 985

Problem 1: Extract Text from HTML Document............................................... 985

Problem 2: Escape from Labyrinth ............................................................. 1012

Problem 3: Store for Car Parts .................................................................. 1026

Exercises............................................................................................... 1038

Solutions and Guidelines.......................................................................... 1040

Chapter 25. Sample Programming Exam – Topic #2......................1041

In This Chapter ...................................................................................... 1041

Problem 1: Counting the Uppercase / Lowercase Words in a Text.................... 1041

Problem 2: A Matrix of Prime Numbers....................................................... 1054

Problem 3: Evaluate an Arithmetic Expression ............................................. 1060

Exercises............................................................................................... 1069

Solutions and Guidelines.......................................................................... 1069

Chapter 26. Sample Programming Exam – Topic #3......................1071

In This Chapter ...................................................................................... 1071

Problem 1: Spiral Matrix .......................................................................... 1071

Problem 2: Counting Words in a Text File ................................................... 1078

Problem 3: School .................................................................................. 1099

12 Fundamentals of Computer Programming with C#

Exercises............................................................................................... 1117

Solutions and Guidelines.......................................................................... 1118

Conclusion.....................................................................................1119

Did You Solve All Problems? ..................................................................... 1119

Have You Encountered Difficulties with the Exercises?................................... 1119

How Do You Proceed After Reading the Book? ............................................. 1120

Free Courses at Telerik Software Academy.................................................. 1121

Good Luck to Everyone!........................................................................... 1121

Preface

If you want to take up programming seriously, you’ve come across the

right book. For real! This is the book with which you can make your first

steps in programming. It will give a flying start to your long journey into

learning modern programming languages and software development

technologies. This book teaches the fundamental principles and concepts

of programming, which have not changed significantly in the past 15 years.

Do not hesitate to read this book even if C# is not the language you would

like to pursue. Whatever language you move on to, the knowledge we will

give you here will stick, because this book will teach you to think like

programmers. We will show you and teach you how to write programs for

solving practical algorithmic problems, form the skills in you to come up

with (and implement) algorithms, and use various data structures.

As improbable as it might seem to you, the basic principles of writing

computer programs have not changed all that much in the past 15 years.

Programming languages change, technologies get modernized, integrated

development environments get more and more advanced but the

fundamental principles of programming remain the same. When

beginners learn to think algorithmically, and then learn to divide a problem

instinctively into a series of steps to solve it, as well as when they learn to

select the appropriate data structures and write high-quality programming

code that is when they become programmers. Once you acquire these skills,

you can easily learn new languages and various technologies – like Web

programming, HTML5 and JavaScript, mobile development, databases and

SQL, XML, REST, ASP.NET, Java EE, Python, Ruby and hundreds more.

About the Book

This book is designed specifically to teach you to think like a programmer and

the C# language is just a tool that can be replaced by any other modern

programming languages, such as Java, C++, PHP or Python. This is a book

on programming, not a book on C#!

Please Excuse Us for the Bugs in the Translation!

This book was originally written in Bulgarian language by a large team of

volunteer software engineers and later translated into English. None of the

authors, translators, editors and the other contributors is a native English

speaker so you might find many mistakes and imprecise translation. Please,

excuse us! Over 70 people have participated in this project (mostly

Bulgarians): authors, editors, translators, correctors, bug submitters, etc. and

14 Fundamentals of Computer Programming with C#

still the quality could be improved. The entire team congratulates you on your

choice to read this book and we believe the content in it is more important

that the small mistakes and inaccuracies you might find. Enjoy!

Who Is This Book Aimed At?

This book is best suited for beginners. It is intended for anyone who so far

has not engaged seriously in programming and would like to begin doing it.

This book starts from scratch and introduces you step by step into the

fundamentals of programming. It won’t teach you absolutely everything you

might need for becoming a software engineer and working at a software

company, but it will lay the groundwork on which you can build up

technological knowledge and skills, and through them you will be able to turn

programming into your profession.

If you’ve never written a computer program, don’t worry. There is always a

first time. In this book we will teach you how to program from scratch.

We do not expect any previous knowledge or abilities. All you need is some

basic computer literacy and a desire to take up programming. The rest you

will learn from the book.

If you can already write simple programs or if you have studied programming

at school or in college, or you’ve coded with friends, do not assume you

know everything! Read this book and you’ll become aware of how many

things you’ve missed. This book is indeed for beginners, but it teaches

concepts and skills that even experienced professional programmers lack.

Software companies are riddled with a shocking amount of self-taught

amateurs who, despite having programmed on a salary for years, have no

grasp of the fundamentals of programming and have no idea what a hash

table is, how polymorphism works and how to work with bitwise operations.

Don’t be like them! Learn the basics of programming first and then the

technologies. Otherwise you risk having your programming skills crippled,

more or less, for years, if not for life.

If, on the other hand, you have programming experience, examine this book

in details and see if you are familiar with all subjects we have covered, in

order to decide whether it is for you or not. Take a close look especially at the

chapters "Data Structures and Algorithms Complexity", "Object-Oriented

Programming Principles", "Methodology of Problem Solving" and "High-Quality

Programming Code". It is very likely that, even if you have several years of

experience, you might not be able to work well with data structures; you

might not be able to evaluate the complexity of an algorithm; you might

not have mastered in depth the concepts of object-oriented programming

(including UML and design patterns); and you might not be acquainted with

the best practices for writing high-quality programming code. These are

very important topics that are not covered in all books on programming, so

don’t skip them!

Preface 15

Previous Knowledge Is Not Required!

In this book we do not expect any previous programming knowledge

from the readers. It is not necessary for you to have studied information

technology or computer science, in order to read and comprehend the book

content. The book starts from scratch and gradually gets you involved in

programming. All technical terms you will come across will have been

explained beforehand and it is not necessary for you to know them from other

sources. If you don’t know what a compiler, debugger, integrated develop￾ment environment, variable, array, loop, console, string, data structure,

algorithm, algorithm complexity, class or object are, don’t be alarmed. From

this book, you will learn all these terms and many more and gradually get

accustomed to using them constantly in your everyday work. Just read the

book consistently and do the exercises.

Certainly, if, after all, you do have prior knowledge in computer science and

information technologies, they will by all means be of use to you. If, at

university, you major in the field of computer science or if you study

information technology at school, this will only help you, but it is not a must.

If you major in tourism, law or other discipline that has little in common with

computer technology, you could still become a good programmer, as long

as you have the desire. The software industry is full of good developers

without a computer science or related degree.

It is expected for you to have basic computer literacy, since we would not

be explaining what a file, hard disk and network adapter is, nor how to move

the mouse or how to write on a keyboard. We expect you to know how to

work with a computer and how to use the Internet.

It is recommended that the readers have at least some basic knowledge of

English. The entire documentation you will be using every day and almost all

of the websites on programming you would be reading at all times are in

English. In the profession of a programmer, English is absolutely

essential. The sooner you learn it, the better. We hope that you already

speak English; otherwise how do you read this text?

Make no illusion you can become a programmer without

learning even a little English! This is simply a naive

expectation. If you don’t speak English, complete a course of

some sort and then start reading technical literature, make

note of any unfamiliar words and learn them. You will see for

yourselves that Technical English is easy to learn and it

doesn’t take much time.

What Is the Scope of This Book?

This book covers the fundamentals of programming. It will teach you how

to define and use variables, how to work with primitive data structures (such

as numbers), how to organize logical statements, conditional statements and

Tải ngay đi em, còn do dự, trời tối mất!