4 ms·
I learned to program by doing the above method with Objective-C, an OOP. Basically I made a Tip Calculator, and did it in a very functional way. Here was my th
by bennyg 14y ago
I learned to program by doing the above method with Objective-C, an OOP.
Basically I made a Tip Calculator, and did it in a very functional way. Here was my thought process. I basically had one method, "didClickCalculateTip" - a button click-down. First I knew I had to take the user input as a string, and convert it to a float. Okay, Google, show me what you got. Then doing math on the float. Okay, now I have a result. How do I put that back on screen onto a label? Hmm, it won't let me set the string property of my UILabel to a float. Google: how to make a UILabel's text (string property) show a float. Okay, now print to the console to make sure it works. And voila.
So, using an OOP language isn't bad right off the bat, because I was able to plug in and figure out OOP design and principles by virtue of playing around with the language over time. I'm a pretty proficient Objective-C developer right now because I haven't stopped playing around with it over the past year and 3/4. Object-oriented design patterns aren't mystical, they make a lot of sense when you just think about them. I chose the language because my quest was to make an iPhone app I had as an idea (not the tip calculator haha) but needed to start somewhere to learn how to program. So I picked the tool that would directly translate to the product I actually wanted to make.
- kyllo 14y agoObjective-C is a language that has object-oriented features, but unlike Java, doesn't force you to use them. You just gave an example of a project where you didn't use an OO design pattern nor OO features beyond a superficial level (An NSMutableString object doesn't count). You used a more event-driven design pattern, which was more appropriate to the problem you solved.
- bennyg 14y agoYes, obviously, but I made the point to show that shunning an OO language from the get-go isn't necessarily the best way to proceed if you want to learn programming from nothing.