On Tue, Jul 28, 2009 at 5:39 PM, Igor Stasenko <siguctua@gmail.com> wrote:
I think that all such kind of queries (like isXXXPlatform) should be
not included and not used in a well-designed system.
If you want some capability - then you should ask directly for it,
irrespectively on what platform you are currently running.


I am agree. I really believe in the phrase "tell don't ask". However, I have a couple of things to say:

1) It is not as easy as it seems. If you want to delegate to another object and be polymorphic regarding the platform you must reify a couple of classes (in your slash it is easy because you have the File hierarchy). I mean, you cannot put everything in the Platform class. And this must be done in every place. You must really understand that piece of code to change it. I can do this in my projects, but I don't know about to do it everywhere.

2) Let's go step by step. I would first remove all the "SmalltalkImage current platformName = 'Mac OS'" (and others platforms) from all places. Once we have this, we can see senders of isUnix for example, and try to see how to make this more OO instead of this if. (as you said).


As an example, see the FileDirectory>>slash

It is very confusing for people to see isXXXPlatform in code, because
it tells almost nothing about what platform-specific feature you rely
on.
So, i'd prefer to see the code which asks some provider object about
support of given capability (it could be OSPlatform),
instead of placing isMacOS, isWindows , isUnix into code, which
causing a lot of frustration to people who would want to port your
code to other platforms, or simply check, if their platform provides
required feature(s).

Don't forget, that each time someone sees isMacOs, or isWindows etc..
he thinks: 'duh.. this thing wont work on my platform'.
Instead of thinking in a different way: 'duh.. this thing depends on
following OS feature, lets take a look if i can hack it to wire it up
with my OS'

2009/7/28 Mariano Martinez Peck <marianopeck@gmail.com>:
>
>
> On Tue, Jul 28, 2009 at 4:38 PM, Miguel Cob� <miguel.coba@gmail.com> wrote:
>>
>> I think that it should be done at least in pharo core and more
>> importantly,
>
> Yes, I wanted to say to do it in Pharo core at least. Then, it's a task of
> each external package developer to change their code to use this methods.
>
>>
>> create a new page in the wiki with the programming recommended
>> tips/techniques
>> and there to include all the tips that appear on the list:
>>
>> - Use the OSPlatform isActivePlatform and children
>> - Not to use the Utilities deprecated classes
>> - The case against SmalltalkImage current that appear in a thread a
>> couple of days ago
>> - etc
>>
>> and featured in the pharo website to avoid introducing this bad idioms
>> again
>>
>> Miguel Cob�
>>
>> 2009/7/28 Mariano Martinez Peck <marianopeck@gmail.com>:
>> >
>> >
>> > On Tue, Jul 28, 2009 at 4:24 PM, Adrian Lienhard <adi@netstyle.ch>
>> > wrote:
>> >>
>> >> We have OSPlatform. For instance:
>> >>
>> >> MacOSXPlatform isActivePlatform
>> >
>> > Nice! I wasn't aware of them...so, what about changing
>> >
>> > SmalltalkImage current platformName� = 'Mac OS'
>> >
>> > for
>> >
>> > MacOSXPlatform isActivePlatform
>> >
>> > In all places? Obviously, the same with the other platforms.
>> >
>> > Is there a reason I don't see?� just time to do it ?
>> >
>> > thanks!
>> >
>> > Mariano
>> >
>> >
>> >>
>> >> HTH,
>> >> Adrian
>> >>
>> >> On Jul 28, 2009, at 18:55 , Mariano Martinez Peck wrote:
>> >>
>> >> > Ok, I write the changeset, but I don't like it hehehehe.
>> >> >
>> >> > What about puting isMacintosh, isUnix and isWindows in
>> >> > SmalltalkImage ?
>> >> > I think those methods are useful and perhaps many people in different
>> >> > packages are doing things like this:
>> >> > � �^SmalltalkImage current platformName �= 'Mac OS'
>> >> >
>> >> > This is not nice. Tomorrow we change the platformName and we have to
>> >> > modify
>> >> > a lot of code.
>> >> >
>> >> > For example, I searched the string "SmalltalkImage current
>> >> > platformName =
>> >> > 'Mac OS'" and it is in a lot of places. I think we should get rid of
>> >> > them.
>> >> >
>> >> > what do you think?
>> >> >
>> >> > best,
>> >> >
>> >> > Mariano
>> >> >
>> >> >
>> >> >
>> >> > On Tue, Jul 28, 2009 at 3:18 PM, Adrian Lienhard <adi@netstyle.ch>
>> >> > wrote:
>> >> >
>> >> >> Yes, if you tested it and think it is good, please change the status
>> >> >> to verified.
>> >> >>
>> >> >> Cheers,
>> >> >> Adrian
>> >> >>
>> >> >> On Jul 28, 2009, at 17:12 , Miguel Cob� wrote:
>> >> >>
>> >> >>> should the ticket be marked as verified?
>> >> >>>
>> >> >>>
>> >> >>> On Tue, Jul 28, 2009 at 10:10 AM, Miguel
>> >> >>> Cob�<miguel.coba@gmail.com>
>> >> >>> wrote:
>> >> >>>> It works ok on my
>> >> >>>>
>> >> >>>> Debian Linux 5.0 (Lenny) i386.
>> >> >>>> Debian Linux 5.0 (Lenny) amd64.
>> >> >>>>
>> >> >>>> Miguel Cob�
>> >> >>>>
>> >> >>>> 2009/7/28 Mariano Martinez Peck <marianopeck@gmail.com>:
>> >> >>>>>
>> >> >>>>>
>> >> >>>>> On Tue, Jul 28, 2009 at 11:58 AM, Adrian Lienhard
>> >> >>>>> <adi@netstyle.ch> wrote:
>> >> >>>>>>
>> >> >>>>>> On Jul 28, 2009, at 14:51 , Mariano Martinez Peck wrote:
>> >> >>>>>>
>> >> >>>>>>> On Tue, Jul 28, 2009 at 5:42 AM, Damien Cassou <
>> >> >> damien.cassou@gmail.com
>> >> >>>>>>>> wrote:
>> >> >>>>>>>
>> >> >>>>>>>> 2009/7/27 Mariano Martinez Peck <marianopeck@gmail.com>:
>> >> >>>>>>>>> HostSystemMenusTest class>>expectedFailures
>> >> >>>>>>>>>
>> >> >>>>>>>>> SmalltalkImage current platformName = 'Mac OS' ifFalse:[
>> >> >>>>>>>>> � �^#(#testXXX #testYYY)].
>> >> >>>>>>>>> ].
>> >> >>>>>>>>> ^#()
>> >> >>>>>>>>
>> >> >>>>>>>> Expected failures are indications of bugs that are not yet
>> >> >>>>>>>> corrected.
>> >> >>>>>>>> Does not seem to apply here.
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> ahhh okok. So...shall we go for torsten solution ?
>> >> >>>>>>
>> >> >>>>>> Yes.
>> >> >>>>>
>> >> >>>>> http://code.google.com/p/pharo/issues/detail?id=996
>> >> >>>>>
>> >> >>>>> I also attached a possible changeset.
>> >> >>>>>
>> >> >>>>> best,
>> >> >>>>>
>> >> >>>>> Mariano
>> >> >>>>>
>> >> >>>>>>
>> >> >>>>>> Adrian
>> >> >>>>>>
>> >> >>>>>>
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>>>
>> >> >>>>>>>>
>> >> >>>>>>>> --
>> >> >>>>>>>> Damien Cassou
>> >> >>>>>>>> http://damiencassou.seasidehosting.st
>> >> >>>>>>>>
>> >> >>>>>>>> "Lambdas are relegated to relative obscurity until Java makes
>> >> >>>>>>>> them
>> >> >>>>>>>> popular by not having them." James Iry
>> >> >>>>>>>>
>> >> >>>>>>>> _______________________________________________
>> >> >>>>>>>> Pharo-project mailing list
>> >> >>>>>>>> Pharo-project@lists.gforge.inria.fr
>> >> >>>>>>>>
>> >> >>>>>>>>
>> >> >>>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >> >>>>>>>>
>> >> >>>>>>> _______________________________________________
>> >> >>>>>>> Pharo-project mailing list
>> >> >>>>>>> Pharo-project@lists.gforge.inria.fr
>> >> >>>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-
>> >> >>>>>>> project
>> >> >>>>>>
>> >> >>>>>>
>> >> >>>>>> _______________________________________________
>> >> >>>>>> Pharo-project mailing list
>> >> >>>>>> Pharo-project@lists.gforge.inria.fr
>> >> >>>>>>
>> >> >>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >> >>>>>
>> >> >>>>>
>> >> >>>>> _______________________________________________
>> >> >>>>> Pharo-project mailing list
>> >> >>>>> Pharo-project@lists.gforge.inria.fr
>> >> >>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-
>> >> >>>>> project
>> >> >>>>>
>> >> >>>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> Pharo-project mailing list
>> >> >>> Pharo-project@lists.gforge.inria.fr
>> >> >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> Pharo-project mailing list
>> >> >> Pharo-project@lists.gforge.inria.fr
>> >> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >> >>
>> >> > _______________________________________________
>> >> > Pharo-project mailing list
>> >> > Pharo-project@lists.gforge.inria.fr
>> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>
>> >>
>> >> _______________________________________________
>> >> Pharo-project mailing list
>> >> Pharo-project@lists.gforge.inria.fr
>> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > Pharo-project@lists.gforge.inria.fr
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project@lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project@lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project