Created August 8, 2009
Last updated August 8, 2009
[ Japanese | English ]

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.

1. What is an instance-scope operation?
2. When to define an instance-scope operation?
3. What is a class-scope operation?
4. When to define a class-scope operation?
5. Reference


1. What is an instance-scope operation?

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

Back to Top

2. When to define an instance-scope operation?

  I define an instance-scope operation at the following.
  1. 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.
  2. 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.
Back to Top

3. What is a class-scope operation?

  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).
Back to Top

4. When to define a class-scope operation?

  I define a class-scope operation at the following.
  1. 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.)
  2. 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.
Back to Top

5. Reference

  The following tables are pages that I referred to create this page.

No.

Linked Website Name

Description

Linked date

1 OMG Document -- UML Superstructure Specification, v2.0 August 8, 2009
2 Overview (Java 2 Platform SE v1.4.2) API Specification of Java August 8, 2009
Prev Up Next  Top
Back to Top

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.