Hi. I program a fair amount in my everyday job, but it’s essentially BASIC. This is my first foray into OOP. I’ve been following along pretty well up until this chapter. I generally know what is happening, but it’s so much new information at once that I’m getting bogged down. Frankly I’m not sure how to proceed in the book. I’m attending the iOS bootcamp in january, so my goal is to get all the way through this book before I go. What I’m struggling with is figuring out to what degree I need to intimately understand what I’m plowing through. If anyone has any thoughts or advice, I’d be happy to hear it.
Here’s a particular example of how I’m getting stuck…
I’m working on the Challenge, and frankly I’m having to do a good bit of cheating by looking at other people’s code from this forum. But I a trying to make a real effort to understand what is going on.
Here’s a line in particular that I “get but don’t get” if that makes any sense.
In my Portfolio.h file…
I understand that I am having to declare a method that my portfolio object(s) will use. I understand that this particular method is the method by which the main() program will add a stock into the portfolio array. It looks like ‘stock’ is the stock object that will be added and (StockHolding *) is the class of object that ‘stock’ is.
But here’s my problem…if I were sitting here at my machine writing this program on a blank slate, I would have no clue how to construct that line on my own. I would know that I need a method to add a stock object to my portfolio array but I would only get about as far as -(void)addStock. I might know that I have to specify an object name such as ‘stock’ and that I somehow need to mention that the ‘stock’ object is a StockHolding object, but I wouldn’t know how to write the line and I wouldn’t know exactly where in the book to refer back to. So…my question is really this I guess: How does a newbie best figure that out? Is there somewhere to look that has say, “examples of implementation methods”?
Hmmm…that seems to make little sense now that I read back over it. The answer may very we’ll be this: “I need to go back several chapters and re-read several times”. Fair enough. But I would like to plow on too.