Chapter 3. Objects: Get Oriented!: Making code make sense

image with no caption

Every program you write solves a problem.

When you’re building a program, it’s always a good idea to start by thinking about what problem your program’s supposed to solve. That’s why objects are really useful. They let you structure your code based on the problem it’s solving, so that you can spend your time thinking about the problem you need to work on rather than getting bogged down in the mechanics of writing code. When you use objects right, you end up with code that’s intuitive to write, and easy to read and change.

How Mike thinks about his problems

Mike’s a programmer about to head out to a job interview. He can’t wait to show off his C# skills, but first he has to get there—and he’s running late!

  1. Mike figures out the route he’ll take to get to the interview.

    image with no caption
  2. Good thing he had his radio on. There’s a huge traffic jam that’ll make him late!

    image with no caption
  3. Mike comes up with a new route to get to his interview on time.

    image with no caption

How Mike’s car navigation system thinks about his problems

Mike built his own GPS navigation system, which he uses to help him get ...

Get Head First C#, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.