New book: Begin to Code with C#
Purchase from these online retailers:
Become a C# programmer—and have fun doing it!
Start writing software that solves real problems, even if you have absolutely no programming experience! This friendly, easy, full-color book puts you in total control of your own learning, empowering you to build unique and useful programs. Microsoft has completely reinvented the beginning programmer’s tutorial, reflecting deep research into how today’s beginners learn, and why other books fall short. Begin to Code with C# is packed with innovations, from its “Snaps” prebuilt operations to its “Make Something Happen” projects. Whether you’re a total beginner or you’ve tried before, this guide will put the power, excitement, and fun of programming where it belongs: in your hands!
Easy, friendly, and you’re in control! Learn how to…
- Get the free tools you need to create modern programs
- Work with 150 sample programs that illustrate important concepts
- Use the sample programs as starting points for your own programs
- Explore exactly what happens when a program runs
- Approach program development with a professional perspective
- Use powerful productivity shortcuts built into Microsoft Visual Studio
- Master classes, interfaces, methods, and other essential concepts
- Organize programs so they’re easy to construct and improve
- Capture and respond to user input
- Store and manipulate many types of real-world data
- Create interactive games that are fun to play
- Build modern interfaces your users will love
- Test and debug your code—and avoid problems in the first place
About this book
- For absolute beginners who’ve never written a line of code
- For anyone who’s been frustrated with other beginning programming books or courses
- For developers who’ve started out with other languages and now want to learn C#
I think that programming is the most creative thing you can learn how to do. If you learn to paint, you can make pictures. If you learn the violin, you can make music. But if you learn to program, you can create experiences that are entirely new (and you can make pictures and music too if you want to). Once you have started on the programming path, there’s no limit to where you can go. There are always new devices, technologies, and marketplaces where you can use your programming skills.
You can think of this book as your first step on a journey to programming enlightenment. The best journeys are undertaken with a destination in mind, and this one is no different. I’d like to describe the destination as “usefulness.” By the end of this book you won’t be the best programmer in the world (unless I retire, of course), but you will have enough skills and knowledge to write properly useful programs. And maybe you can have at least one of your programs available worldwide for download from the Microsoft Store.
However, before we start off, I’d like to issue a small word of warning. In the same way that a guide would want to tell you about the lions, tigers, and crocodiles that you might encounter if you went on a safari adventure, I feel that I must let you know that our journey might not be all smooth sailing. Programmers have to learn to think slightly differently about problem solving because a computer just doesn’t work the same way that we do. Humans can do complex things rather slowly. Computers can do simple things really quickly. It is the job of the programmer to harness the simple abilities of the machine to solve complicated problems. This is what we are going to learn how to do.
The key to success as a programmer is pretty much the same as for lots of other endeavors. If you want to become a world-renowned violin player, you will have to practice a lot. The same is true for programming. You will have to spend quite a bit of time working on your programs to get code-writing skills. But the good news is that, just as a violin player really enjoys making the instrument sing, making a computer do exactly what you want turns out to be a really satisfying experience. And it gets even more enjoyable when you see other people using programs that you have written and finding them useful and fun to use.
How this book fits together
I’ve organized this book in four parts. Each part builds on the previous one with the aim of turning you into a successful programmer. We start off considering the low-level programing instructions that programs use to tell the computer what to do, and we finish by looking at professional software practices.
Part 1: Coding fundamentals
The first part gets you started. It points you to where you will install and use the programming tools that you will need, and it introduces you to the fundamental elements of the C# programming language that are used by all programs.
Part 2: Advanced programming
Part 2 describes the features of the C# programming language that are used to create more complex applications. It shows you how to break large programs into smaller elements and how you can create custom data types that reflect the specific problem being solved. You’ll also find out how programs can maintain data in storage when they are not running.
Part 3: Making games
Making games is great fun. And it turns out that it is also a great way to learn how to use object-oriented programming techniques. In this part, you’ll build some playable games and at the same time learn the fundamentals of how to extend programming objects through inheritance and component-based software design.
Part 4: Creating applications
Part 4 is where you find out how to create fully fledged applications. You’ll discover how to design graphical user interfaces and how to connect program code to the elements on the display. You’ll also learn how modern applications are structured. Part 4 doesn’t appear in this printed book but is available as an ebook, free to download from this book’s webpage at https://aka.ms/BeginCodeCSharp/downloads.
How you will learn
In each chapter, I will tell you a bit more about programming. I’ll show you how to do something, and then I’ll invite you make something of your own by using what you’ve learned. You’ll never be more than a page or so away from doing something or making something unique and personal. In each chapter we will use Snaps, prebuilt bits of functionality that I’ll show you how to use. After that, it’s up to you to make something amazing!
You can read the book straight through if you like, but you’ll learn much more if you slow down and work with the practical parts along the way. This book can’t really teach you how to program, any more than a book about bicycles can teach you how to ride a bike. You have to put in the time and practice to learn how to do it. But this book will give you the knowledge and confidence to try your hand at programming, and it will also be around to help you if your programming doesn’t turn out as you expected. Here are the elements in the book that will help you really learn, by doing!
Yes, the best way to learn things is by doing, so you’ll find “Make Something Happen” elements throughout the text. These elements offer ways for you to practice your programming skills. Each of them starts with an example and then introduces some steps you can try on your own. Everything you create will run on a Windows PC, tablet, or phone. You can even publish your creations to the whole wide world via the Windows Store.
A great way to learn how to program is by looking at code written by other people and working out what it does (and sometimes why it doesn’t do what it should). In this book’s “Code Analysis” challenges, you’ll use your deductive skills to figure out the behavior of a program, fix bugs, and suggest improvements.
If you don’t already know that programs can fail, you will learn this hard lesson very soon after you start writing your first program. To help you deal with this in advance, I’ve included “What Could Go Wrong?” elements, which anticipate problems you might have and provide solutions to those problems. For example, when I introduce something new, I’ll sometimes spend some time considering how it can fail and what you need to worry about when you use the new feature.
I’ve spent a lot of my time teaching programming. But I’ve also written many programs and sold a few to paying customers. I’ve learned some things the hard way that I really wish I’d known right at the start. The aim of “Programmer’s Points” is to give you this information up front so that you can start taking a professional view of software development as you learn how to do it. “Programmer’s Points” cover a wide range of issues, from programming to people to philosophy. I’d strongly advise you to read and absorb these points carefully—they can save you a lot of time in the future!
Want to see more of this book? Download this free bonus content. This .zip file (9.4 MB) contains everything from the bonus Part 4 not included in the print book.
About the author
Rob Miles has spent more than 30 years teaching programming at the University of Hull in the United Kingdom. He’s a Microsoft MVP, with a passion for programming, C#, and creating new things. If he had any spare time, he’d spend it writing even more code. He loves making programs and then running them to see what happens. He reckons that programming is the most creative thing you can learn how to do. He also reckons that in a battle between us and the Martians, we’d win, because we’ve got Visual Studio and they don’t—and there isn’t anything better in the universe for building software. He claims to know a lot of really good jokes, but nobody has ever heard him tell one. If you want an insight into the Wacky World™ of Rob Miles, you can read his blog at www.robmiles.com and follow him on Twitter via @RobMiles.