object-oriented-analysis

Difference between Sequence & Communication Diagram (UML) [closed]

不羁岁月 提交于 2019-12-04 17:17:10
Closed . This question needs to be more focused . It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post . Closed 2 years ago . What is the difference between sequence diagrams and communication (collaboration) diagrams in UML? Quoting Wikipedia : Communication diagrams show a lot of the same information as sequence diagrams, but because of how the information is presented, some of it is easier to find in one diagram than the other . Communication diagrams show which elements each one interacts with

“Hello World” in MVC Pattern

浪尽此生 提交于 2019-12-04 07:24:40
问题 In an interview for some company, I was asked this question. What design patterns do you know...then I was told to write simplest "hello world" application based on MVC Design Pattern. I came up with a JavaScript program var arr = ["a","b","c","d"]; // this is an array, same as store or model alert(arr[0]); // this is controller //and browser alert is a view. later I was told that alert is a view. The basic concept about MVC I know is any changes in Model are reported to View. And there is a

objects with state and behavior in oop

点点圈 提交于 2019-12-03 09:40:23
问题 I keep hearing the term object has behavior and state or just one of them. But what is the difference or what does it mean, and if anyone can give an example I would really appreciate it. 回答1: Lamp is an object. The "state" in lamp:on and off. The "behavior" in lamp:turn on and turn off. In programming you declare states in "fields" and behaviors in "methods" etc.. Read and learn object-oriented. 回答2: class Door { boolean isOpen; void close(){ isOpen = false; } } Look at this simple snippet.

objects with state and behavior in oop

故事扮演 提交于 2019-12-02 20:40:00
I keep hearing the term object has behavior and state or just one of them. But what is the difference or what does it mean, and if anyone can give an example I would really appreciate it. bong bang Lamp is an object. The "state" in lamp:on and off. The "behavior" in lamp:turn on and turn off. In programming you declare states in "fields" and behaviors in "methods" etc.. Read and learn object-oriented . class Door { boolean isOpen; void close(){ isOpen = false; } } Look at this simple snippet. We have class Door , it has a state isOpen - variable describes current state of this door. Method

“Hello World” in MVC Pattern

左心房为你撑大大i 提交于 2019-12-02 13:53:51
In an interview for some company, I was asked this question. What design patterns do you know...then I was told to write simplest "hello world" application based on MVC Design Pattern. I came up with a JavaScript program var arr = ["a","b","c","d"]; // this is an array, same as store or model alert(arr[0]); // this is controller //and browser alert is a view. later I was told that alert is a view. The basic concept about MVC I know is any changes in Model are reported to View. And there is a controller in between to call the methods. Can you correct my approach, or come up with an alternate

What is the concept of creating class instance using interface name?

非 Y 不嫁゛ 提交于 2019-12-01 11:34:54
what is the concept of set variable or object or i don't know what it's called when i create instance of class and putting in left hand the name of interface,,, I Know that we can't create and object of type interface. Only I need more clarification what this process named or what is the details done by .Net when I declare these type of object. IDataReader oSQLReader = new SqlDataReader(); IDataReader oOLEReader = new OleDbDataReader(); What happens exactly is that you are creating an instance of the specific class, then you are upcasting the reference to the type of the interface. The type of

What is the exact difference between Adapter and Proxy patterns?

旧街凉风 提交于 2019-12-01 03:14:45
As I understood both Adapter and Proxy patterns make two distinct/different classes/objects compatible with each for communication. And both of them are Structural patterns. I am getting that both of them are pretty much similar with each other. Can some one explain what exactly make(s) them different? EDIT: I went through this question. But I'd rather like to have a close comparison between Adapter and Proxy. Ravindra babu Adapter: It allows two unrelated interfaces to work together through the different objects, possibly playing same role. It modifies original interface. UML diagram: You can

UML class diagram: how to model relations about calling a method or starting an activity or service

橙三吉。 提交于 2019-12-01 02:43:50
问题 I'm creating my first Android app. I have avoided to label associations with user or system interactions (e.g. I have labeled starts instead startsWhenClick ; I have labeled starts instead startsWhenDetection ). However, after reading this, I'm considering to change the starts associations by << create >> dependencies. I'm confused! The app works as follow. When the app starts, LauncherActivity will call the methods of BaseActivity to start the activity marked in SettingsActivity (it could be

Clarification on the inability of javascript deleting inherited properties.

别等时光非礼了梦想. 提交于 2019-12-01 01:05:28
guys. I'm studying up on properties for objects and one thing caught my eye on a source of info. There was this one part of the whole document that stated this about JS. Prototype Properties JavaScript objects inherit the properties of their prototype. The delete keyword does not delete inherited properties, but if you delete a prototype property, it will affect all objects inherited from the prototype. I'm kinda lost here... I know that sounds dumb but I need to understand exactly what that means during processes and applications where that might come to play. delete removes a property from

Is This Use of the “instanceof” Operator Considered Bad Design?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 03:57:36
In one of my projects, I have two "data transfer objects" RecordType1 and RecordType2 that inherit from an abstract class of RecordType. I want both RecordType objects to be processed by the same RecordProcessor class within a "process" method. My first thought was to create a generic process method that delegates to two specific process methods as follows: public RecordType process(RecordType record){ if (record instanceof RecordType1) return process((RecordType1) record); else if (record instanceof RecordType2) return process((RecordType2) record); throw new IllegalArgumentException(record);