Created August 8, 2009
Last updated August 8, 2009
Instance-scope operation and Class-scope operation
In the Class diaglam, we can define operations in the class. Operations are classifed into 2 groups whether it is instance-scope.
One is an instance-scope operation,and the other is a class-scope operation.
In this page, I will explain the feature and the use of the instance-scope operation and the class-scope operation
1.
Attention:To understanding this pase , you shoud understand "
Instance-scope attribute and Class-scope attribute".
-----
Note.
1:If beginners of the object-oriented program a java application, usually all method ( operation ) is static ( Formerly, I was so ).
If you are so , I want you to read this page , notice the mistake.
Instance-scope operations are defined at setting and getting the value of Instance-scope attributes.
Please read "2.When to define an instance-scope operation?".
I define an instance-scope operation at the following.
- When I want to setting 2 or more instance-scope attributes at the same time , checking the parameter ( range check and so on) , locking the mutex ( thread safe ) and defining the read-only attribute , or when I assume to modifying like these.
- When I want to processing some datas based on present datas.
For example , in java , there are java.io.File.Delete() , java.security.MessageDigest.digest().
In Excel VBA , there are Activate() , Close() , and PrintOut() methods of Workbook class, Execute() method of CommandbarButton class.
Of course , there are more methods.
Class-scope operations are defined at setting and getting the value of class-scope attributes.
In the class diaglam , class-scope operations are underlined 1.
Please read "4.When to define a class-scope operation?".
------
Note.
1:The class-scope attribute and operation are underlined. That is written in the UML Superstructure Specification v2.0 "7.3.19 Feature (from Kernel)"(p67).
I define a class-scope operation at the following.
- When I want to setting 2 or more class-scope attributes at the same time , checking the parameter and so on.
(This is the same as an instance-scope operation.)
- When I want to defining an operation of the "utility class".
The utility class is composed only functions and constants. For examle , there are java.lang.Math class ( Java ) , DateTime module ( VBA ).
An utility class is not capable of creating instances.
In the class diaglam, an utility class is written "<<utility>>" keyword on the class name.
The following tables are pages that I referred to create this page.
I doesn't assume the responsibility of any damage that occurs because of the use of this page.
Microsoft ,Windows ,Visual Basic and Excel are registered trademarks of Microsoft Corporation in the United States and other countries.
Visual Basic for Applications may represent a VBA.
Mac ,Mac OS ,Mac OS X ,AppleScript are trademarks of Apple Inc., registerd in the U.S. and other countries.
UML ,Unified Modeling Language are trademarks of Object Management Group Inc. in the U.S. and other countries.
Sun, Sun Microsystems, Sun Microsystems Computer Corporation, the Sun logo, the Sun Microsystems Computer Corporation logo, Solaris, Java, JavaSoft, JavaScript, HotJava, JDK, and all Java-based trademarks or logos are trademarks or registered trademarks of Sun Microsystems, Inc.
Other brands and their products are trademarks or registered trademarks of their respective holders and should be noted as such.
The author of this page and these companies do not have any relationship.