re: Cocoa and Computational Expense
re: Cocoa and Computational Expense
- Subject: re: Cocoa and Computational Expense
- From: "Mr. George Warner" <email@hidden>
- Date: Mon, 22 Jun 2009 10:18:38 -0700
On Sat, 20 Jun 2009 16:36:58 -0700 (PDT), syntonica
<email@hidden> wrote:
> I am new to Cocoa (about 3 weeks now) and have not done much
programming since the halcyon days of 16K RAM.
WoW! a whole 16K!!! I remember paying > $50 each in 1974 for surplus
1103's, the worlds first 1K dynamic RAM. (Yeah, I just dated myself…)
> How can I tell how computationally expensive a class or method is?
I've never been this far from the metal.
> Is there a corpus somewhere listing this, or do programmers just
know these things from their experience?
SHARK (part of the CHUD tool set; search for it at <http://developer.apple.com/search
>).
> In the old days, we would cut corners and break rules to get better
performance or memory usage.
> The idea of "more" meant thousands of dollars more. Now, resources
for your average little
> application seem to be limitless. So, do I just walk the straight
and narrow and let the
> Frameworks worry about these things for me?
Yes and no. These days you're at the mercy of the Framework developers
as to their performance but you do control your code and how it uses
those frameworks. Ultimately what you want to do is (performance)
profile your code and see where it's spending it's time. If it's
spending it's time in our frameworks then perhaps you can figure out
ways to avoid calling our frameworks as often as you are (caching?).
If it's time spend in your code then there may be ways (improving your
algorithms? Re-factoring?) to make your code run faster.
> Finally, on a side note and because this is my first OOP, just how
big should a class get? Just as a rule of thumb.
> I have 700 lines and 50 methods in my MyDocument class and it seems
positively bloated to me.
> Is this normal? Or might I possibly have a bad design?
Pretty much, welcome to object programming… (IMHO the "bad design"
isn't necessarily yours…)
> I only see a couple of lines that could be factored into their own
method and nothing that could really me moved into its own class.
> I know these are rather vague questions with amorphous answers, but
I am hoping somebody can shine some light or at least
> show me which door I need to go through.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden