Enter your email address:

    Delivered by FeedBurner

Package Diagrams

- Package diagrams and package dependencies result from class diagrams.
- Class A depends on class B, A B, if changes to the definition of class B may cause an effect on class A.
Examples :
• class A sends a message to class B;
• class A has class B as part of its data;
• class A mentions class B as parameter to an operation.
- In an ideal oo-world, modifications which don’t change a class interface should not affect any other classes.

Dependencies in Programming Languages
1. Java
- Imports are non-transitive.
- Optional package visibility to reduce the level of nested details.
- Possibility of generating Facades which are explicit interface classes between packages.
2. C++
- Includes in C++ are transitive.
- No compiler supported “hide” option for nested classes.
- Complex makefiles which include tests on already defined objects.

Nested Packages
- Instead of drawing many separate dependencies, the technique of sub-packages reduces redundant dependency information.
- Instead of drawing many separate dependencies, the technique of sub-packages reduces redundant dependency information.
- Draw dependencies to and from the overall package, instead of many separate dependencies.
- An overall package can contain :
• classes
• class diagrams
• package diagrams
- Dependencies on an overall package represent dependencies on all members of the package.
- Separate dependencies on single members of the overall package can still occur.

Dependencies : Visibility
What does it mean to draw a dependency to a package that contains subpackages ?
- Convention “transparent”: gives visibility to the classes in the package and in the subpackage.
- Convention “opaque”:gives visibility to the top-level classes only, not to the nested classes.
- Make clear, which convention you use in your project (by use of <> or <> stereotypes).

Package Generalization
- Generalization between packages means that the specific package must conform to the interface of the general package.
- To emphasize the role of a general interface, the package can be marked as {abstract}.
- Example: An abstract database interface consisting of several classes is implemented either for Oracle or for Sybase.

When to Use Package Diagrams
- Use package diagrams for distributing and balancing work between development groups.
- Package diagrams are helpful to explore the possibilities of partitioning tasks in the development process.
- Package diagrams are extremely useful for testing purposes: rather apply tests on packages (i.e., several interdependent classes) than on single routines.

Read More

Unified Modeling Language

What Is the UML ?
The Unified Modeling Language (UML) is a language for
• Specifying
• Visualizing
• Constructing
• Documenting

Rational Unified Process
  • The Unified Modeling Language (UML) is a language for specifying, visualizing, constructing, and documenting the artifacts of a software-intensive system
  • A software development process defines Who is doing What, When and How in building a software product
  • The Rational Unified Process has four phases : Inception, Elaboration, Construction and Transition
  • Each phase ends at a major milestone and contains one or more iterations
  • An iteration is a distinct sequence of activities with an established plan and evaluation criteria, resulting in an executable release

The Unified Modeling Language
Booch and Rumbaugh started working towards a Unified Modeling Language (UML) in 1994 under the auspices of Rational Inc. UML only offers a model notation, not a methodology for how to do modeling. UML is used by the development method Objectory (Jacobson at Rational). UML was proposed by Rational Inc. and by Hewlett-Packard as a standard for object-oriented analysis and design and was adopted by the OMG. Vendors modify their CASE tools to make them consistent with UML.

UML Diagrams
- Use Case Diagrams
- Class Diagrams
- Interaction Diagrams
- State Diagrams
- Activity Diagrams
- Package Diagrams
- Deployment Diagrams

Read More


* Era of Digitalisasi cause depended to and computer software
* Mistake in making of software can cause loss
* To overcome that thing, is needed examination process : ascertaining software conducting what ought to be conducted and do not conduct what do not be expected.

Process to measure the quality of product :
  1. Correctness
  2. Completeness
  3. Security
  4. Capability
  5. Reliability
  6. Efficiency
  7. Portability
  8. Maintainability
  9. Compatibility
  10. Usability

Software development process
1. Plan
2. Do/Execute
3. Check <-- Testing 4. Act Duty of tester : determining do software have fulfilled requirement consumer, including finding mistake ( bug) VERIFICATION AND VALIDATION
Process of checking that a software system meets specifications and that it fulfils its intended purpose Checking and analysis processes that ensure that software conforms to its specification and meets the needs of the customers who are paying for that software.From requirements review, design review, code inspections, until product testing

- Error, flaw, mistake, failure, a in fault or program computer of that from it prevents ace behaving of intended pregnant
- Software many bug referred as with buggy
- Owning different effect variation of
system of Crash
wrong Calculation
Chaos / chaos

An abnormal condition or defect at the component, equipment, or sub-system level which may lead to a failure.
Fault type :
1. Systematic : mistake of mistake effect in specification
2. Random : mistake of effect of is existence of decrease.

- State or condition of not meeting a desirable or intended objective
- Reverse of success
- Failure Commercial : product which do not reach successfulness expectation storey;level
- Can have negative effect to consumer if happened.

1. Requirements misinterpretation
2. Wrong requirements by users
3. Requirements not recorded correctly
4. Wrong design specification
5. Error in code
6. Data entry error
7. Testing error
8. Mistake in error correction
9. 1 Fix cause another bug

Read More

Polymorphism Java

Abstract Classes
• May Contain abstract methods
• Some methods and data may be defined
abstract class ColouredShape {
private Colour c; // storage allocated for each
public abstract void draw();
public Colour getColour() {
return c;
public abstract void erase();
• No instances allowed
• Subclasses must implement all abstract methods or they are also abstract

• Contains no implementation
• Method signatures + static final data members
Method signature =
return type + method name + argument lis
• Establishes a protocol
• Public or friendly
interface Shape {
Point zero = Point(0,0);
// Cannot have method implementations:
void erase();
void draw();

Interfaces and Classes
• A class may implement one or more interfaces
class Circle implements Shape {
pivate int radius;
public void erase() {
public String draw() {
public int getRadius(){
• An interface may extend one or more other interface

Read More

Packages Java

Package : the Library Unit
• Managing “name spaces”
– Class members are already hidden inside class
– Class names could clash
– Need completely unique name
• Packages
– organize classes into libraries
– structure name space for classes
– restrict visibility
– may be nested

Creating a Library of Classes
package mypackage;
public class Class1{ ... }
package mypackage.mysubpackage1;
public class Class5{ ... }
• public class is under the umbrella mypackage
• Client programmer must import the package
import mypackage.*;
import java.util.Vector;

Compilation Units
• Compilation units (.java files)
– Name of .java file == name of single public class
– Other non-public classes are not visible
– Each class in file gets its own .class file
– Program is a bunch of .class files

Class Access
• Classes as a whole can be public or “friendly”
• Only one public class per file, usable outside the library
• All other classes “friendly,” only usable within the library

Read More

Objects and Classes in Java

Reference Types
• Predefined or user-defined Classes
• String
• Array
• The values of reference types are not manipulated directly.
• Instead handles (references) to the actual values are used.

Comparing Objects
Comparing two reference type variables means
comparing the references they contain and, thus,
comparing the identity of the referenced objects.

Comparing the Contents of Objects
• The contents of objects belonging to pre-defined classes can be compared using the method equals.
• If you define a class of your own, equals by default only compares references, as == does.
=> You have to override equals for newly defined classes.

Creating New Data Types : class
• Class keyword introduces definition of new data type
class ATypeName { /* class body goes here */ }
ATypeName a = new ATypeName();
• Data members
class DataOnly {
int i;
float f;
boolean b;
• Each instance of DataOnly gets its own copy of the data members
• In a class, primitives get default values.

Methods, Arguments and Return
• Methods: “how you get things done in an object“
– May inspect and change the state of the object
– Traditionally called “functions”
– Can only be defined inside classes
returnType methodName(/* argument list */) {
/* Method body */
• Example method call :
int x = a.f(); // For object a

The Argument List
• Types of the objects to pass in to the method
• Name (identifier) to use for each one
• Whenever you seem to be passing objects in Java, you‘re actually passing handles
void reset(Cell c) {
Cell cell1 = new Cell();

Method Overloading
class SuperWasher{
void wash(Shirt s) { ... }
void wash(Car c) { ...}
void wash(Dog d) { ...}
• One word, many meanings :
• Unique argument type combinations distinguish overloaded methods

Overloading on Return Values
• Why not also use return values in method
void f() {...}
int f() {...}
• Then what would this mean ?

Default Constructor
• Constructors are needed to create instances (objects) of a class
• Compiler provides one for you if you write no constructor
class Bird {
int i;
public class DefaultConstructor {
public static void main(String args[]) {
Bird nc = new Bird(); // default!

Constructor Definition
class Rock {
Rock() { // This is the constructor
System.out.println("Creating Rock");
public class SimpleConstructor {
public static void main(String args[]) {
for(int i = 0; i < style="font-weight: bold;">Constructor Overloading
Like methods constructors may be overloaded
class Tree {
int height;
Tree() {
System.out.println("A seedling");
height = 0;
Tree(int i) {
System.out.println("A new Tree, "
+ i + " feet tall");
height = i;

this in Constructors
A very common kind to use this is in constructors to
initialize data members with the constructor's
public class Animal {
private int numberOfLegs;
Animal(int numberOfLegs) {
this.numberOfLegs = numberOfLegs;

Member Initialization
void f() {
int i; // No initialization
• Produces compile-time error
• Inside class, primitives are given default values if you
don’t specify values
class Data {
int i = 999;
long l; // defaults to zero
// ...

Constructor Initialization
• Order of initialization
– Order that data members are defined in class
• Static data initialization
class Cupboard {
Bowl b3 = new Bowl(3);
static Bowl b4 = new Bowl(4);
// ...
– b4 only created on first access or when first object of class Cupboard is created

Arrays and Array Initialization
• Arrays are objects
int a1[]; // this...
int[] a1; // is the same as this!
Creates a handle, not the array. Can’t size it.
• To create an array of primitives:
int [] a1 = { 1, 2, 3, 4, 5 };
• Bounds are checked, length produces size of the array a1.length
• If you do anything wrong either the compiler will catch it or an exception will be thrown

Multi-dimensional Arrays
• It is possible to define multi-dimensional arrays.
int[][] a;
• The brackets even may be distributed between type and identifier.
int[] a[];
• Initialization can be done directly
int[][] a = { { 1, 2, 3 }, { 5, 6} };
• It can also be done by nested iterations over the array and its components.

• Strings are immutable objects of the class String.
• String literals are zero, one or more characters included within double quotes.
• When a binding to a string literal is executed for the first time, a new String object is created.
• If any other bindings to this literal appear, the respective variables will hold reference to the same object.
String a = "abc";
String b = "abc";

String Constructors
• String objects can also be created by calling a constructor.
• String constructors create new objects whenever they are called.
String c = new String("abc");
• There are several constructors defined for strings.

String Concatenation
• Strings can be concatenated by using +.
String c = "A " + "concatenation";
• The concatenation also creates a new String object.
• Values of other types can be concatenated to strings, too.
• They are implicitly converted to String.
String n = "Number " + 49;

Inside the Method Body
• Variable declaration and assignments
• Operations on primitive data types
• Object creation
• Message sending
• Iteration
• Conditionals

Read More

Java Programming

• Rapid development
• 1990: developed for use in electronic devices
• about 1995: gained popularity because of possible use in the Internet
• by now: accepted as scalable programming language for different purposes

Java is Designed For
• A fresh start (no backwards compatibility)
• Pure OOP: C++ syntax, Smalltalk style
• Improvements over C++, near guarantee that you can’t run a bad program
• Internet programming: probably can’t create viruses, programmability at the browser end, easier client/server programming
• Larger, more complex programs; smaller teams, less time
• There is the speed issue, which we’ll examine

How does Java generally work ?
• Compilation creates bytecode
• Platform-independent
• Interpreted
• Bytecode is either :
– interpreted statement by statement => "slow"
– once compiled to a program in machine language
=> "fast"

Naming Conventions
• Words run together, no underscores
• Intermediate words capitalized (getValue)
• Classes: first word capitalized (Cell)
• Methods and variables: first word lower case (value, getValue)
• Constants: all caps with underscores to separate words (like C).

Using Other Components
• Bring in a library of components using import keyword
• Can specify specific element in library :
import utility.MyTools;
• Can specify entire library :
import java.util.*;

Java Applications - Important Steps
• Create some source code within your text editor like the class Cell
• Save it as .java - file, use the name of the (primary) class plus the extension .java (e.g. Cell.java)
• Compile the source file :
javac Cell.java
• You get bytecode within a .class - files, for all the classes included (Cell.class)
• Run your application by interpreting the primary class' bytecode java Cell
• The Java interpreter looks for the main-method and executes it.

• The primitive type used to express that something can have exactly two different states is called boolean.
• The two literals are true and false.
• Operations on booleans:
– Comparison: ==, !=
– Negation: !
– binary logic: &, |, ^
– short-circuit-evaluation logic: &&, ||

• There are two general kinds of statement
– simple statements
– compound statements
• Simple statements end with a semicolon.
• Compound statements encompass several statements and are enclosed in brackets.
• Compound statements are also called blocks.
• Blocks are important for scoping.

What does switch do ?
• Tests all case-conditions and executes the statement behind the colon, if the condition is true.
• If a condition is true and the attached statement is followed by a break, switch is finished.
• If no match occurs, the default-statement is executed.
• switch only works on integral values like int or char.

Writing a Java Program
import java.util.*;
class Cell {
int value = ...
void printValue(){
System.out.println(“Date: “ + new Date());
System.out.println(“Value: “+ this.value);
public static void main(String [] args){
Cell cell1 = new Cell();

Read More

Recent Articles

Blog Archive