Programming

Objective-C


Objective-C is a compiled language that is derived from C and is purely object-oriented. All variables are objects, and they are acted upon by sending messages to them. An object is a complex storage structure that can contain complex data and respond to a certain messages, which are determined by the object’s class type. The code syntax is very similar to C++, however sending messages to an object uses sets of brackets to delineate the target object, message, and arguments.

This is a useful language for a Scout to learn because all Apple’s mobile and desktop computers use this as their native language for programs and apps. Also, the programming environment, XCode, is free from Apple Computer. Its only limitation is that it only runs on Mac OSX computers. But if a Scout already has a Mac, it is easy to get started.

Download software: https://developer.apple.com/xcode/

Cost: Free download from Apple, Inc.

Hardware requirements: Mac

Operating systems supported: Mac OSX

Difficulty level: 5 out of 5


TRY IT!

1. To get familiar with the XCode environment, follow along with this example. It is a simple program that sends its output to the debugging log so you can watch it run:

2. Next, follow along with this slightly more advanced tutorial that builds a simple iPhone program that includes a button press and an output label on the screen:


ABOUT THE PROGRAM — A WALK THROUGH

Programming in Objective-C involves merging several different scopes of knowledge:

  1. the Objective C language itself,
  2. the XCode programming environment, and
  3. the Visual Object designer for laying out where buttons and input controls appear on a form.

So as you move between these different working areas, it helps to focus on just the scope of the tool or area you are working in. There are linkages between these areas and these will become more apparent as you use it more.


TRY THIS

1. Add another button to the iPhone form that clears the text box.

2. Add a second input control to the form to enter your name.

3. Change the “Click Me” button to copy whatever you entered into the input control into the label box.

4. Add a third button that pops up a notification window. (hint: google UIAlertView for examples)

There are tons of sample programs on the internet and how-to tutorials. Just be sure to scope your google search with the keywords for the functions in Objective-C that you are exploring.


LEARN MORE

https://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode_User_Guide/000-About_Xcode/about.html

youtube.com – LOTS of examples

google.com – Even more examples


RESOURCES, TIPS, TRICKS AND HINTS

The Apple developer site, developer.apple.com, has tons of programming guides and Q&A forums. Your local library probably will also have books on XCode, Objective-C, and iPhone programming that can fill in the blanks too. Browse the stacks at 651.8424 O, and 651.8425 I.

Write a comment about “Objective-C”

Nickname:

Type your comment:

  • 1. Safety. Do the following:
      a. Show your counselor your current, up-to-date Cyber Chip.
      b. Discuss first aid and prevention for the types of injuries or illnesses that could occur during programming activities, including repetitive stress injuries and eyestrain.

    2. History. Do the following:
      a. Give a brief history of programming, including at least three milestones related to the advancement or development of programming.
      b. Describe the evolution of programming methods and how they have improved over time.

    3. General knowledge. Do the following:
      a. Create a list of 10 popular programming languages in use today and describe which industry or industries they are primarily used in and why.
      b. Describe three different programmed devices you rely on every day.

    4. Intellectual property. Do the following:
      a. Explain how software patents and copyrights protect a programmer.
      b. Describe the difference between licensing and owning software.
      c. Describe the differences between freeware, open source, and commercial software, and why it is important to respect the terms of use of each.

    5. Projects. Do the following:
      a. With your counselor’s approval, choose a sample program. Then, as a minimum, modify the code or add a function or subprogram to it. Debug and demonstrate the modified program to your counselor.
      b. With your counselor’s approval, choose a second programming language and development environment, different from those used for requirement 5a and in a different industry from 5a. Then write, debug, and demonstrate a functioning program to your counselor, using that language and environment.
      c. With your counselor’s approval, choose a third programming language and development environment, different from those used for requirements 5a and 5b and in a different industry from 5a or 5b. Then write, debug, and demonstrate a functioning program to your counselor, using that language and environment.
      d. Explain how the programs you wrote for requirements 5a, 5b, and 5c process inputs, how they make decisions based on those inputs, and how they provide outputs based on the decision making.

    6. Careers. Find out about three career opportunities in programming. Pick one and find out the education, training, and experience required. Discuss this with your counselor and explain why this career might be of interest to you.

  • Earning the Cyber Chip can help you learn how to stay safe while you are online and using social networks or the latest electronic gadgets.

    Topics include cell phone use, texting, blogging, gaming, cyberbullying, and identity theft. Find out more about the Cyber Chip at www.scouting.org/cyberchip.