Using/editing external packages..

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

Using/editing external packages..

sergio_101
i am currenty develop an app in seaside, and am wondering about best practices when using external packages.

in my case, i am using a copy of TF-Login that i updated to work in pharo 2.

The main class in that package is RegisteredUser. as is true in most cases, i will be tweaking this object a great deal.

this package also contains a great deal of renderers that will be tweaked.

so, my question is:

how should i go about this?

should i take RegisteredUser and sublcass it? this might requried me to change other code in the package? should i subclass the renders and override their methods?

should i just go ahead and edit the TF-Login package directly?

my initial thought was to edit the package direclty, but i am not sure what would happen if the package is externally updated.

thoughts? ideas?

--
Reply | Threaded
Open this post in threaded view
|

Re: Using/editing external packages..

Sean P. DeNigris
Administrator
sergio_101 wrote
i am currenty develop an app in seaside, and am wondering about best
practices when using external packages.
I've found the easiest and most flexible approach is two-fold:
- Refactor the underlying library with the hooks and abstractions you need
- And then, subclass

If you just override and monkey-patch, I feel you are more vulnerable to the library changing underneath you, as well is potentially making your code harder to understand. If you can make the library designed to use it the way you want, you will reduce duplication and the chance of someone else coming in and doing it in an incompatible way, as well as give the library maintainers an idea of what you're doing, so they may consider that in making non-backward-compatible changes.

Of course, that's ideal and requires library maintainers open to accepting such changes, but in practice I've found this to be true (with Pharo, Magritte, BabyMock…)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Using/editing external packages..

sergio_101
i think you're right.. i just need to sit down and walk myself through it with this codebase.. since i am the maintainer of the codebase in question (although i did not write it), i really want to address this issue correctly, and not cut any corners..

thanks!


On Tue, Feb 11, 2014 at 11:20 AM, Sean P. DeNigris <[hidden email]> wrote:
sergio_101 wrote
> i am currenty develop an app in seaside, and am wondering about best
> practices when using external packages.

I've found the easiest and most flexible approach is two-fold:
- Refactor the underlying library with the hooks and abstractions you need
- And then, subclass

If you just override and monkey-patch, I feel you are more vulnerable to the
library changing underneath you, as well is potentially making your code
harder to understand. If you can make the library designed to use it the way
you want, you will reduce duplication and the chance of someone else coming
in and doing it in an incompatible way, as well as give the library
maintainers an idea of what you're doing, so they may consider that in
making non-backward-compatible changes.

Of course, that's ideal and requires library maintainers open to accepting
such changes, but in practice I've found this to be true (with Pharo,
Magritte, BabyMock…)



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Using-editing-external-packages-tp4742801p4742832.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




--