How to save changes to system classes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to save changes to system classes

Robert Sassmann
Hello,

I know already that I can save new classes to packages.
How however can I save changes, made to system classes, since I can't
save them to 'package' Dolphin ?

Thank you
Robert


Reply | Threaded
Open this post in threaded view
|

Re: How to save changes to system classes

Bill Schwab-2
Robert,

> I know already that I can save new classes to packages.
> How however can I save changes, made to system classes, since I can't
> save them to 'package' Dolphin ?

One solution is to put in references to symbols with your initials, and
whether it's added or modified (Ian uses symbols such as #idbModified and
#idbAdded).  Migrate is a goodie on my web site that does a few things, one
of which is track selectors that you can specify as safe and dangerous,
respectively, and will file out all references to them on demand.  That way,
you can file out methods that you've add or changed in the base system, and
even give yourself some idea of which ones are likely to be risky to compile
in a new image.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: How to save changes to system classes

Ian Bartholomew-4
In reply to this post by Robert Sassmann
Robert,

> I know already that I can save new classes to packages.
> How however can I save changes, made to system classes, since I can't
> save them to 'package' Dolphin ?

A word of advice first.
Modifying a System class by editing an existing method or adding
instance/class variables is not normally recommended. It can cause problems
because
a) You may change the expected behaviour of the class/method on which other
applications, or the image itself, may be depending.
b) You can let yourself in for problems when the image changes (via an
update) and modifies the method you have edited.

Adding new methods to a system class is OK though.

You don't say which version of Dolphin you are using but you can add single
methods to packages in all versions.  In D2 and D3 you can select a method
(in the class browser) and then use the drop down combo box to select a
package to move the method to. Single methods added to a package can be
viewed using the PakageBrowser's "Methods" tab. In Dolphin 4 the combo box
has disappeared and you use a menu option but the procedure is otherwise the
same.

You can save complete classes by selecting a class in a class browser and
choosing "FileOut" from the class menus. It can be reloaded using "FileIn"
(strangely enough!). NB resources (views) associated with a class are not
saved using this method.

Finally, you can save one or more methods using a workspace. Open a
workspace and then drag/drop methods from the class browser onto the
workspace. More methods can be added and interspersed with normal code if
needed. Save the workspace using the .st file type and it can be reloaded
using "FileIn" as before.

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: How to save changes to system classes

Bill Schwab-2
Hi Ian,

> A word of advice first.
> Modifying a System class by editing an existing method or adding
> instance/class variables is not normally recommended. It can cause
problems
> because
> a) You may change the expected behaviour of the class/method on which
other
> applications, or the image itself, may be depending.

Thanks for catching this!


> b) You can let yourself in for problems when the image changes (via an
> update) and modifies the method you have edited.

That's a big part the motivation for the safe/dangerous split in Migrate.


> Adding new methods to a system class is OK though.

For the newbies, we should carefully define what we mean by new method,
because if it incorrectly overrides something defined in a super class, then
the bad things you mention above can still happen.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]