Part 1 – Basic fundaments
Computer Programming Exposed
A computer program is like a cooking recipe
One of my favorite breakfast is a toasted cheese sandwich. And basically, this is what I normally do:
- One milk bread
- Slice the bread in half
- Slice the cheese and add to one half of the bread
- Slice the tomato and add to the other half of the bread
- Close the sandwich
- Spread butter on the outside of the bread
- In a pan at low heat, cook the bread in each side until it’s golden brown.
It sounds trivial to show you how I do my breakfast sandwich, but it is actually the same way that a programming language works. You provide the variables (in our breakfast the ingredients) that “holds” the data, and the instructions (directions), which perform operations on that data.
A compiler is a bridge between the human and the machine. The compiler is responsible to convert the programming language, created by the developer, into 0s and 1s, the way computer understands.
a program works?
Basically creating a computer program is the following:
- Decide what you want the computer to do.
- Break the task you want the computer to complete into a series of modules (instructions) that contains the instructions the computer follows to do what you want, and then provide the data it needs to do that.
- Run the instructions through the compiler.
- Link the result to other precompiled modules.
- Store that output somewhere.
- Run the program.
Running a computer program goes from Idea > Code > Compiler > Disk > Memory > CPU > Computer executing the program.
Objective-C. What is it?
Objective-C is an object-oriented programming language, which means that it was created to support a certain style of programming. Most object-oriented development environments consist of several parts:
- An object-oriented programming language
- A runtime environment
- A framework or library of object and functions
- A suite of development tools
The object in Objective C
The goal should not be to simply be able to write programs by using Objective-C; the goal should be to write good programs by using Objective-C.
You will want to add new functionality. The term of extensible means that you would like to be able to add new features to your software without
You want to improve or change functionality. The term enhanceable means changing the way existing functionality works without breaking the rest of the application.
Object-oriented programming features
What gives object-oriented programming it’s power is that the way objects are defined and the way they interact with each other, making it relatively easy to accomplish the goals of extensibility and
Encapsulation is about celebrating your object’s ignorance about how things work in the objects they use. Encapsulation makes it possible for the developer to change how an object carries out its responsibilities or behaves (enhanceability) and to add new responsibilities to an object (extensibility) without having to disturb the existing code that uses those objects. To make your programs enhanceable, you want to depend on the implementation details as little as possible. Basically, it is not important for the outside module world to know how it is done, but what it does.
Polymorphism is about cultivating more of the same. This feature in object-oriented languages makes it possible to add new objects of the same type and have your program handle them without making any changes to the code that uses them. Whereas encapsulation enables you to ignore how things are done, polymorphism enables you to escape the specific details of differences between objects that do the same thing in different ways.
When people talk about object-oriented programming, they tend to talk about two things. The first is all that cool encapsulation and polymorphism stuff, which makes it easy to modify programs. Then they talk about reuse, and that you can create reusable objects that save time and money. The best models for reusability are found in the frameworks you will use to develop applications. You will find that when you use those same principles and techniques in your programs, you will have taken a giant step forward in enabling the kind of reusability you need to make your programs enhanceable and extensible.
That would be the starting line of Objective-C. Now, let’s speak the language of Objective-C.
Thank you for reading and see you in the next post.