On 13 Nov 2013, at 08:52, jtuc...@objektfabrik.de wrote:

> Bahman,
> 
> Am 13.11.13 08:43, schrieb Bahman Movaqar:
>> Let's say I have a method with signature in a language like Java as below:
>>   gregorianDayToJulianDay(year, month, day)
>> 
>> What could be a proper naming for this method in Smalltalk?  I'm a bit
>> confused as I'm so used to the concept of methods being "verbs" which
>> accept some arguments.
>> 
>> I'd appreciate any help/idea.
>> 
> Thats always hard ;-)
> 
> I suggest a method name starting with 'convert' or 'as'. If you implement the 
> method on a specialized GregorianDate class, you can sure omit the part for 
> what you convert from, in a helper class you need to keep it.
> 
> So let's assume you implement the method on a helper class. Then I'd suggest
> 
> #convertGregorianToJulianYear:month:day:
> 
> If you can change the order of parameters, it is even better (IMO) to make 
> the thing more like Date's newDay:month:year: (or newDay:monthIndex:year). So 
> we end up with:
> #convertGregorainToJulianDay:month:year:
> 
> In case you have a specialized GregorianDate class:
> GregorianDate>>#asJulianDay:month:year:
> 
> This is of course from a smalltalk perspective. If your goal is to keep it 
> recognizable for Java developers, keep the year:month:date ordering and 
> implement additional methods for the Smalltalk-minded that delegate to the 
> "originals" (or the other way round, that doesn't really matter).
> 
> So this is my train of thoughts about finding a good method name. Others may 
> think completely different.

Your comments are valid in the context of a class method, but that is very 
close to a static global function, which is not very object oriented.

It of course depends on the class hierarchy (does it really make sense to both 
GregorianDate and JulianDate, time and data calculations can be very difficult).

So either

(GregorianDate newDay: 1 month: 1 year: 2010) asJulianDate

or even

(Date newDay: 1 month: 1 year: 2010) asJulianDate

where I assume the Julian calendar is the default.

Sven

PS: there is the Chronos library (http://www.squeaksource.com/Chronos/)

> HTH
> 
> Joachim
> 
> -- 
> -- 
> ----------------------------------------------------------------------- 
> Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de 
> Fliederweg 1                         http://www.objektfabrik.de
> D-71640 Ludwigsburg                http://joachimtuchel.wordpress.com
> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
> 
> 


Reply via email to