[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Object style guide




Hi all,

    seems there is more and more activity going on objectwise these
days and some people try to standardize things. Looking at some of the
examples posted recently, I thought of two things (besides trying to
figure out what you folks did):

(1) The common procedure header seems inappropriate for object design,
   e.g. what is a "CALLING SEQUENCE" for an object?

(2) There is a basic structure to all *__define.pro files which one
   should not have to retype all the time.

Gee!, I thought, here's a template that addresses both. It provides a
new file header structure (which is still format-compatible with the 
old "analogue" one), and it provides a basic skeleton for any object 
definition. Under Unix you can easily use it like:
   sed 's/%NAME%/MyObject/' template__define.pro > myobject__define.pro
and you will find a file that awaits to become alive by you. On Windows
systems you will have to do a find/change and replace %NAME% by your
favorite, then "Save as ...".

I'd be extremely happy if (especially) the gurus among you would find it
equally useful to adopt a new format for the file header in object 
definition routines. The attached file should serve as a basis for 
discussion, I am open for any suggestions.

Cheers,
Martin in objectland ;-)


-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
; Object definition 
;-------------------------------------------------------------
;+
; NAME:
;    %NAME%
;
; PURPOSE:
;
; CATEGORY:
;
; PROPERTIES:
;    public properties:
;    private properties:
;
; METHODS:
;    public methods:
;       GetProperty
;       SetProperty
;       Show
;       Init
;       Cleanup
;    private methods:
;    
; DESCRIPTION:
;
; INTERFACES:
;
; SIDE EFFECTS:
;
; MODIFICATION HISTORY:
;-
; Copyright
;-------------------------------------------------------------


; **********************************************************************
; **********************************************************************
; Get Properties of %NAME%
;
pro %NAME%::GetProperty,    $
                          _ref_extra=extra

   ; Fill in lines along
   ; if arg_present(KEYWORD) then KEYWORD = self.KEYWORD

end  ;  %NAME%::GetProperty


; **********************************************************************
; **********************************************************************
; Set Properties of %NAME%
;
pro %NAME%::SetProperty,        $
                          _ref_extra=extra

   ; Fill in lines along
   ; if n_elements(KEYWORD) eq 1 then self.KEYWORD = fix(KEYWORD)

end  ;  %NAME%::SetProperty


; **********************************************************************
; **********************************************************************
; Display %NAME%
;
pro %NAME%::Show

end  ;  %NAME%::Show


; **********************************************************************
; **********************************************************************
; Cleanup method
;
pro %NAME%::CleanUp


   print,'%NAME%::CleanUp'

end  ;  %NAME%::CleanUp


; **********************************************************************
; **********************************************************************
; Initialization method
;
function %NAME%::Init,   $
                          _ref_extra=extra


   success = 0

   ; check inputs and set defaults 
   ; Fill in lines along
   ; if n_elements(KEYWORD) eq 0 then KEYWORD = 0L
   ; self.KEYWORD = KEYWORD
   ; success = 1

   return,success

end  ;  %NAME%::Init


; **********************************************************************
; **********************************************************************
; Structure definition
;
pro %NAME%__Define

   temp = {%NAME%,             $
             dummy:-1   }

end  ;  %NAME%__Define