RE: Swapping isa's (was Re: Hex Edit controls (resknife))
RE: Swapping isa's (was Re: Hex Edit controls (resknife))
- Subject: RE: Swapping isa's (was Re: Hex Edit controls (resknife))
- From: Jeff Laing <email@hidden>
- Date: Wed, 1 Dec 2004 10:51:33 +1100
I wrote:
> > A better reason, so far, is that <RANT>Interface Builder is
> the dumbest
> > crappiest most insane idea that anyone ever in the history
> of time and space
> > has invented</RANT>
to which Guy responded:
> Geez - that's a bit harsh. :) Personally I really like IB & actually
> think it's one of the coolest things I've seen. Certainly the coolest
> GUI editor ( mostly 'cause it's not only a GUI editor )
Yeah, I agree that its perhaps an extreme opinion.
But seriously, I spent days early on in my Cocoa life trying to work out why
the hell a program didn't work, and the only visible clue was a small shaded
triangle in a list window that you have to request by pressing a tiny little
icon that consists of three lines in the corner of the Instances window. In
those days, I didn't know what connections did, and didn't, have to be
present and it was damn hard to work out which widget in the interface might
show them to you.
You need a fairly high degree of familiarity with Interface Builders GUI
before you can be really productive, irrespective of what most people seem
to think. Yes, you can lay panels out without knowing what you are doing,
but thats not where you introduce bugs, its the inter-connectivity of GUI
objects (not to mention creating "instances") that are the hard details to
get exactly right. Accidentally break a connection (because you delete and
recreate a gui control) and your clue is a little yellow icon, which you are
ignoring anyway because thats actually going to be a reference to another
nib.
> Ok, well I'm not in front of a Mac right now but I'll try doing what
> you're doing later on tonight. In the meantime just put a regular
Sadly nor am I - those millions of lines are on Windows 2000.
> NSTextView in there and in code call the funky swap the isa pointer
> thing. :) You're not adding ivars so it should work. Alternatively,
It does, so I'm cool. But I was going to do this whole thing a little
differently to ResKnife in that I was going to have instance variables in my
TextView subclasses, and as has been pointed out, the isa approach doesn't
work in that space.
> since you dig code so much, create an instance of your class in code,
> set it's properties from the standard NSTextView you've got in your
> NIB, remove the standard NSTextView from the view hierarchy and
> replace it with your custom subclass. That'll work for sure and as a
> bonus you get a few lines of code! :)
I'm not saying "I want to do it with code". I'm saying "I want it to be
verifiable by eye", by code inspection. Because Interface Builder is seeing
some sort of corruption in the file and just giving up - I believe I could
see the same corruption and stand a chance of excising it with a careful
knife (vi), which I've managed to do with Visual Studio.
I agree with the principle of Interface Builder, but the implementation has
a few really nasty warts. Its good enough till it stops working, then it
becomes a serious liability because there is no alternative. In our Windows
development, we use Visual Studio to kick-start our projects, but from then
on its all makefile.win and panel.r source files that can be munged by hand
- flat text files never goes irretrievably corrupt (putting Rational Rose
aside).
Of course, one should never lose sight of the fact that I was able to take
the code from ResKnife (including its nib) and weld it into my Cocoa project
in about two hours, and it worked enough to prove the concept. There must
be something right going on here...
Switching from rant back to (hopefully) productive discussion, one thing I
noticed in the ResKnife code was that they chose to have a
HexWindowController, a HexWindowDelegate and three HexTextView entities. In
all the stuff I've done so far, I haven't seen a good reason to seperate the
controller from the delegate - can anyone give one, other than some
theoretical "it conforms to this pattern" ? One of the serious warts in the
ResKnife stuff to my eye is that there is still a lot of cross-talk between
the controller and the delegate, which seems to defeat the purpose of the
seperation.
ie, I'm planning on having HexWindowController and three HexTextViews, which
treat the controller as their delegate as well.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden