Thursday 1 January 2015

Object Behavioural Concept


हम तीन तरह के object behaviour define कर सकते हैं- simple, state, continuous.

Simple Behaviour:
Simple behaviour के साथ Object तभी कार्य करता है जब इसे request किया जाता है. यह पिछले step का कोई memory नही रखता है. Simple object हमेशा दिये हुए input के लिए एक तरह से respond करता है ये previous executed history से change नही होते हैं. कुछ उदाहण इस प्रकार है-
  • Simple mathematics function जैसे cosine, square root etc. ये किसी input के लिए एक निश्चित output देता है। ये अपने पिछले step का information store कर के नही रखता है।
  • किसी static data structure का search operation जो हमेशा एक ही point से start होता है. जैसे static binary search tree. ईसका उदाहरण एक find() है जो हमेशा एक ही point से search करना start करता है। next() और previous() ईसका उदाहरण नही हो सकता है क्योकि इस function मे पिछले step का information store कर के रखा जाता है।
  • Sort operation, इस operation को भी perform करने के लिए state को store करके रखना पडता है।


State behaviour:
दूसरे प्रकार का behaviour State, state-driven or reactive होता है। state एक object की ऐसी स्थिती होती है जो ईसे दूसरे object से अलग करती है। एक transition के द्वारा कोई state अपना कुछ input लेकर अपना state बदलता है। किसी object की finite state machine के रूप मे modelling करके उसकी complexity को कम किया जाता है। ईसके लिए कुछ assumption किये जाते हैं ये following हैं-

  • System,  जिसके लिए modelling किया जाता है, मे assume किया जाता है कि इसमे finite number of condition हैं। इसे state कहा जाता है।
  • किसी system का behaviour उस state को identically identify करता है।
  • System का state ईस valid set of state के बिच ही transition होता है।
  • FSM किसी operation को execute करने के लिए constraint लगाता है कि किस condition मे execute होंगे।


Continuous behaviour:
तीसरे तरह का object behaviour -Continuous behaviour होता है। बहुत सारे object  इस behaviour को दर्शाते है। इसमें current state का output previous history पे depend करता है। Object का continuous behaviour किसी object के infinite,  unbounded set of condition होता है। PID control system, fuzzy set and neural network continuous behaviour को show करता है। token flow semantics के द्वारा भी continuous behaviour को  define किया जा सकता है, इसे किसी algorithm को बहुत सारे differential equation के द्वारा represent किया जाता है। activity diagram के through हम किसी object के continuous behaviour को दिखा सकते है। कभी-कभी continuous और state behaviour को mix करना appropriate होता है। उदाहरण के लिए अलग-अलग set of trajectory differential equation को use किया जा सकता है अलग-अलग situation (space craft undergoing launch, achieving orbit, in orbit or cruising) के लिए। इसे हम overall object behaviour को state machine  के रुप मे modelling कर के कर सकते हैं। जैसे ही कोई state  new state मे आता है, new set of differential equation activate हो जाते हैं।

Reference: en.wikipedia.org, The Internet

No comments:

Post a Comment