Introduction To Computer Science With Objective-C

Matthew Campbell, February 7, 2012

Computer Science is the study of abstraction – finding the best model for a problem and implementation – figuring out how to solve the solution mechanically. That is what my new series is all about: getting back to the basics and understanding how Computer Science will make us better iOS and Objective-C programmers.

Computer Science is the study of abstraction – finding the best model for a problem and implementation – figuring out how to solve the solution mechanically.

Introducing the Computer Science With Objective-C Series

So, I got this idea from perhaps the most unlikely of places: the movie Julie & Julia, where the main actor writes a blog about cooking a new recipe each day from the famous cookbook by Julia Childs. I thought it would be cool to go through my old college computer science materials and try to solve the problems from the class using Objective-C. Kind of like the movie, except I’ll write once a week on this topic and not every day (because I’m not insane…).

I thought it would be cool to go through my old college computer science materials and try to solve the problems from the class using Objective-C.

But, while the idea started as a weekly log of attempting to solve computer science puzzles with Objective-C things have evolved. That’s because as I go through the materials I realized that computer science is more than programming – it’s a study of how we solve problems in general. This means that I may have to be more narrative and descriptive at times. My hope is that this will help you learn more about understanding the how and why of what we do when we’re creating iOS apps.

What Will You Gain From Computer Science?

Here are some of the benefits that I hope that you get from this:

  • a deeper understanding of abstraction
  • an expanded view of how and why iOS does what it does
  • some background to help get the more esoteric Objective-C practices
  • time outside the box that you are probably in right now as a programmer
  • Review and reinforcement of computer science topics
  • What The Computer Science With Objective-C Series Is Not

    This is not meant to be a how to guide to programming, iOS app development or Mac development. These topics are much more practical. Some of the paths that we go down in the computer science series will be more about expanding your mind and may or may not have practical applications. Its more about you and how you think.

    To learn more about the mechanics of Objective-C programming you can look at my free eBook, Beginning Objective-C Programming.

    If you are interested in making applications for the iPhone and iPad check out iOS Code Camp, my premier training and coaching program for iOS app developers. If you’re just a little bit curious about iOS app development and Objective-C programming you may simply poke around this site.

    Computer Science vs Programming

    As was mentioned at the top of this article: Computer Science is a study of abstraction and implementation. Programming is the process of giving a computer specific instructions. Usually, programmers think in terms of abstraction and implementation as part of the programming process. However, as a field Computer Science is a more formal study of the kinds of things programmers do; Computer Science may go beyond what a typical programmer thinks about on a daily basis.

    What Is Abstraction?

    This word sounds scarier than it should be, but don’t worry too much about this. In computer science, Abstraction is about creating the best model for a problem. This generally means thinking of a problem in the simplest way possible in a way that may be mechanically represented. Often, an abstraction is much easier to work with than the corresponding problem or situation that we are working with.

    Data Models

    As you work with abstractions more you will find ways of thinking about problems that you can use as a starting point. For instance, many people will use graphs as a way to create an abstraction. For example, think of a business guy graphing out what the performance of a product should be in order to be “successful”. Or think of your company’s organization chart of personnel.

    Graphs are considered a data model. Data models are general abstractions used to represent problems. Another data model is logic. We use logic when we think of things in these terms: if A = B, and B = C, then A = C.

    What Is Implementation?

    While Abstraction has to do with coming up with a simple model of your problem, Implementation is the mechanical process of solving the problem. This could be something as familiar as solving a math problem on paper, a calculator or a computer.

    Usually, software developers think of implementation as programming.

    Data Structures

    Data structures of the programming constructs that we use when representing data models. The idea is that if your data model includes list of some kind, then your programming language needs a data structure to represent that list.

    In Objective-C, we have a data structure called an array, NSArray, which we can use to represent of list of objects. So, if my data model includes a list of weigh-ins that I’m tracking for my diet, I can use an array to store those numbers that represent my weight each day.

    Algorithms

    An algorithm is a precise series of steps that can be carried out mechanically. Algorithms are like recipes: you do one thing after another until the process is complete. Often times, programmers take algorithms and translate them into something that a computer can do using a programming language.

    Algorithms are something that can be studied and made more efficient when needed. However, there is often a trade-off with algorithms when it comes to their efficiency vs simplicity. That is, a very simple algorithm may do the job and be understandable while a more complex algorithm may also do the job and more efficiently but be more difficult to design and understand.

    Summary

    Today we introduced the idea for this series: I’m going to go through my old computer science stuff and relate this to Objective-C and iOS app development. Wish me luck and let me know what you think of this idea below.

    We also introduced some of the main ideas in the study of computer science: abstraction, implementation, data models, data structures and algorithms.