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.
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