Wednesday, February 22, 2012

State, behavior, and identity

Objects
Much of the power and flexibility of modern software analysis and design derives from its use of objects.

The use of objects allows designers to create programs that are more easily maintained and extended. And it makes it easier to design very complex or large-scale programs.

The advantage of using objects in programming is that they allow us to model the real world more accurately.

Procedural programming represents the world as a series of processes acting on data.
However, object-oriented programming represents it the way we really see it – as a set of objects interacting with each other.
Use cases and problem statements allow you to define the problem domain you're analyzing.

After use cases and problem statements have been created, you need to model how the problem domain actually behaves.
By using objects, you can translate features of the problem domain into conceptual models that can be used to create software.

So creating objects is usually the next stage in a design project after use cases or problem statements have been drawn up.
An object is a distinct entity that represents something significant in the problem domain.

It has clear boundaries. And it has a well-defined behavior and a definite purpose.


Classes
Classes are the moulds or templates for the creation of objects. They set out rules for how the objects that they contain may behave.
Classes are part of the abstract structure of a program, and are created when the program is created.

But objects are created only when a program runs. In contrast to classes, they exist at a definite point in time.
Grouping objects into a class allows you to simplify the problem you're modeling.

Classes create an abstract representation of the world, letting you discard unnecessary details.
A class includes objects with similar
  • properties
  • behavior
  • relationships to other objects
The way you group objects into classes depends on the problem you're modeling.

Different problem domains have different requirements, even when they contain the same objects. You will need to create specific classes that suit the needs of each problem domain.
For example, the following are objects relevant to a bank application domain:
  • bank teller
  • manager
  • customer
  • ATM
  • Computer
  • mainframe
To model different aspects of the bank, you need to create classes that will capture the essential features of the problem domain.

So a class named ComputerSystem will capture the essential features of ATMs, computers, and the bank mainframe.
Alternatively, you could create separate classes for each of these objects if you wanted to analyze the problem domain in more detail.
Let's say you want to model the way users interact with the bank computer system.

You can create a class to model the behavior of bank tellers, customers, and managers. And all of these things will be instances of the ComputerSystemUser class.
You may need to rearrange the classes you've chosen if you want to model other aspects of the bank. For example, you might create a class named Employee to model the roles of staff in the bank.
But you would need to split this into an Employee class and a class named Manager if you also wanted to model the bank's chain of command.


State
All objects have three essential features:
  • state
  • behavior
  • identity
An object's state is defined by the attributes of the object and by the values these have.
An attribute is a feature of an object, which distinguishes it from other kinds of objects. For example, one of the attributes of any car object is that it is capable of movement – it has a speed.
An attribute is usually something static. This means that it cannot be removed or altered without changing the essential nature of the object to which it belongs.

For example, a car that could never be moved would not be a typical car.
Though attributes themselves are usually static, the value an attribute can have is usually dynamic.

So you can alter the state of an object by changing the value of its attributes.

Behavior and identity
You can model the states of a system by defining the states of the objects that represent it. But to capture the complexity of real world problems, you also need to consider how these objects behave.
Objects always exist in some kind of relation to other objects.

Sometimes they act on other objects, or even on themselves. And sometimes they are acted on by other objects.
The ways in which an object behaves are determined by its operations. So when an object needs to act on another object – to retrieve data, for instance – it uses an operation.
An operation occurs when a message is passed between two objects, allowing some function to be performed.
For structural and security reasons, some operations and attributes in a class or object are not visible to other classes.

This protects a program against malicious damage. And it prevents data being accidentally deleted or overwritten by other parts of the computer program.
The hidden parts of a class can be accessed only indirectly, through the visible parts of the class.

Together, the visible operations and attributes of a class make up its interface. This is the part of a class that is acted on by operations from other classes or system users.

The three most common types of operations that a class can have are
  • modifiers
  • selectors
  • iterators
modifiers
A modifier operation alters the state of an object.
selectors
A selector operation lets you access the state of an object without changing it.
iterators
An iterator operation allows all the parts of an object to be accessed in a definite order. Object-oriented programmers often create a separate class that is responsible for using the iterator function on an object.
Modifiers, selectors, and iterators are not part of any programming language, but are used to characterize the effects operations have.
Two types of operation are needed to create and destroy instances of a class. These are:
  • Constructor
  • Destructor
Constructor
The constructor operation creates an object and fixes its initial state.
Destructor
The destructor operation destroys an object.
Together, state and behavior define the roles that an object may play. And an object may play many roles during its lifetime.

For example, an object in the bank's Employee class could be involved with the payroll system, with the customer database, or with the command hierarchy.
The functions you require an object to perform are its responsibilities. And an object's responsibilities are fulfilled by its roles – by its state and behavior combined.

So you can capture all the meaningful functionality of an object by specifying its state and behavior.
Objects are characterized by a third feature in addition to state and behavior – identity.

Even objects with the same properties and behavior have their own individual identity. For instance, two blue station wagons that were built in the same year by the same manufacturer are still separate and unique cars.
The identity of an object is independent of its attributes or operations. So an object will retain its identity no matter what values its properties have.

You can, for example, respray your car or fit another engine, and it will still be the same car.

Summary

Objects are representations of abstract or real things. Their use in object-oriented programming is to allow designers to model the world accurately.

Objects represent particular instances of things, and classes represent types of object. Different classes are used for different problem domains.

States are the conditions in which objects exist. An object's state is defined by its attributes. An object's attributes are usually static, and the values of the attributes are usually dynamic.

The term "behavior" refers to how objects interact with each other, and it is defined by the operations an object can perform. There are five kinds of operations: modifiers, selectors, iterators, constructors, and destructors. No matter what its attributes and operations are, an object is always uniquely itself. It retains its identity regardless of changes to its state or behavior.

240 comments:

«Oldest   ‹Older   201 – 240 of 240   Newer›   Newest»

http://coltf.blogspot.com/2010/11/androids-management-of-processes.html

Good Post! , it was so good to read and useful to improve my knowledge as an updated one, keep blogging.After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts likethis
https://www.3ritechnologies.com/course/online-python-certification-course/

Really impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing.360digitmg

Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
Digital Marketing Training in Chennai
Digital Marketing Training in Bangalore
Digital Marketing Training in Delhi
Digital Marketing Online Training

Thanks, this is generally helpful.
Still, I followed step-by-step your method in this Java online training
Learn Java online

In the wake of going over a modest bunch of the blog articles on your site, I really appreciate your procedure of composing a blog. live I bookmarked it to my bookmark site page list and will return sooner rather than later. Kindly look at my site also and let me understand your opinion.

PYTHON TRAINING IN CHENNAI | INFYCLE TECHNOLOGIES:

Infycle Technologies Chennai’s BEST PYTHON training facility accepts specific module training for any software to improve your skills and shine in your career development. Infycle is the only software training center in Chennai, equipped with more than 150 customized courses to meet the job requirements of candidates, including top positions in multinational companies. Our whole goal is not just to teach theory, but to make you a teacher by providing you with on-site practical training. Therefore, people will be required to process real-time tasks and use cases in real-time, thus bringing you the ultimate encoder. To get all of this, please call 7502633633 for a free demo.

Python training in Chennai

Grab the Digital Marketing Training in Chennai from Infycle Technologies, the best software training institute, and Placement center in Chennai which is providing professional software courses such as Data Science, Artificial Intelligence, Cyber Security, Big Data, Java, Hadoop, Selenium, Android, and iOS Development, DevOps, Oracle etc with 100% hands-on practical training. Dial 7502633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.
Best software training in chennai

In case such mistakes attack your structure and interrupt your business productivity, by then the chance has as of now come and gone for you to download the Quickbooks file doctor Tool to discard the huge number of blunders.

To fix Quickbooks log:lvl_Error, you should correct the customer ID in the chart of accounts option of the Quickbooks’ list menu.

hi thanku so much this information this blog is very useful
cs executive
freecseetvideolectures/

AximTrade Offers A Safe And Secure Platform To Do Forex Trading And CFDs And Our Customer Support Is Ready To Help You 24/7. You Can Easily Sign Up Your Aximtrade Login Account Here.

There Are Many Complaints About XM REVIEW Broker In The Internet But You Should Read This Review Before Investing Your Money With Them. We Have Personally Tested XM Fx And Found It To Be A Scam, Avoid Them At All Costs!

Are You Thinking About Joining AVATRADE REVIEW ? If You Are Then Read The Review On AVATRADE Fx In This Article. We, Will, Tell You About The Company, The Brokers, The Platform, And All The Information You Need To Know. Read More Here.

State, Behavior, And Identity ~ Java Tutorials >>>>> Download Now

>>>>> Download Full

State, Behavior, And Identity ~ Java Tutorials >>>>> Download LINK

>>>>> Download Now

State, Behavior, And Identity ~ Java Tutorials >>>>> Download Full

>>>>> Download LINK

Thank you so much for sharing this information. Do visit research projects in Chennai

thanks for your information really good and very nice
Girvi Software
Girvi Software

Nice Blog, Object, Class, and State these are some concept of java. You can learn java online. there are many institutes provides online java training in Kanpur, Gorakhpur, Mumbai, Delhi, and other cities in India.

This is one of the great blog. very nice and creative information.iam really impressive your topic.Thanks for sharing.
Online Java Course in Kurukshetra

You're very welcome! I'm glad to hear that you found the tips and hints helpful. If you have any more questions or if there's anything else you'd like assistance with, feel free to reach out. I'm here to help!
python training in marathahalli
python course in marathahalli
python full stack training institute in marathahalli

Thanks for sharing this kind of information. this blog was very helpful for me and others. I always curious to know more about how we can enhance our skill.you can also visit: EFFECTIVE STRATEGIES FOR SOFTWARE QUALITY ASSURANCE

"Thanks for sharing your ideas with us. It is very interesting post and it will be informative for Data Science because the point which you gave are very relevant.Top 22 Best Data Science Courses In Kolkata
hope it will be helpful and informative for you.
"

Thanks for sharing such an informative and useful blog with us.
Java Classes in Pune

In Java, "state," "behavior," and "identity" are fundamental concepts related to object-oriented programming.

State: The state of an object refers to the data it holds at any given time. In Java, an object's state is represented by its instance variables. These variables define the characteristics or properties of the object. For example, if you have a class representing a car, the state of each car object could include its make, model, color, and current speed.
Behavior: Behavior in Java refers to the actions or operations that an object can perform. These actions are represented by methods within the class definition. Methods define what an object can do or how it can interact with other objects or its environment. Continuing with the car example, behaviors of a car object could include accelerating, braking, turning, and honking.
Identity: Identity refers to the unique characteristics that distinguish one object from another. In Java, every object has a unique identity provided by the JVM (Java Virtual Machine). This identity is represented by the object's memory address or reference. Even if two objects have the same state and behavior, they are considered distinct if they have different identities.
In summary, state represents the data an object holds, behavior represents the actions it can perform, and identity distinguishes it from other objects. These concepts are foundational to understanding and designing object-oriented systems in Java.

Java Classes in Pune

«Oldest ‹Older   201 – 240 of 240   Newer› Newest»

Post a Comment