object-oriented-analysis

how to create an interface around classes that already exist but cannot be modified in java

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 15:51:22
问题 Suppose I already have 2 classes in my code: class SomeOrder { String getOrderId() { return orderId; } } class AnotherOrder { String getOrderId() { return orderId; } } How to create an interface around both these classes which is: interface Order { String getOrderId(); } Ideally, I would modify the code so that SomOrder implements Order and AnotherOrder implements Order but the catch here is that they belong in a package that I cannot control or edit (i.e. they come from an external jar). My

What is the exact difference between Adapter and Proxy patterns?

被刻印的时光 ゝ 提交于 2019-12-30 08:11:47
问题 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. 回答1: Adapter: It allows two unrelated interfaces to work together through the

Clarification on the inability of javascript deleting inherited properties.

风流意气都作罢 提交于 2019-12-30 07:29:29
问题 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

Identifying Bounded Context

十年热恋 提交于 2019-12-25 09:12:41
问题 everytime i think i understand how to recognize bounded context's i realize the waters are still murky. so here goes... i am developing a customer portal that contains the following features: Customers, Users, Announcements, Feedback, Documents, and Reimbursements. We are just putting a pretty UI over reimbursement approvals from another system, so this one is easy to see it's another BC we integrate with. Now with the others, I'm not sure how to group these together. Would all these belong

How to eliminate hard dependecies on Java Beans

℡╲_俬逩灬. 提交于 2019-12-25 01:35:16
问题 I've a question about DIP Principle. One of the guidelines says that we should not hold references to a concrete class (if it changes then I'll have to modify all clients that use it). So, what can I follow this guideline when I use POJOs ? For Example: I have a Bean 'Foo' with some attributes (it could represent a Domain object) class Foo { private String one; private String two; //getters and setters } Multiple clients instantiate this object, for example, to persist it in the Database

Storing meta information to class properties

限于喜欢 提交于 2019-12-23 15:47:14
问题 I've been agaonizing about this problem for some days: I have a class Info public class Info { private int _no; public int No { get { return _no; } set { _no = value; } } } That class can be used anywhere in any classes (inherited or as property). The property can be considered as security relevant or not. That information is known at design time and needs to be stored for that particular property. So for some classes which uses that class as property I want the member "No" to be set

Why is a class called an abstraction of an object?

馋奶兔 提交于 2019-12-23 10:49:37
问题 I understand that a class is essentially a blueprint of an object, but the idea that a class is an 'abstraction' of an object is a little hard for me to wrap my head around... If anyone could tell me the real meaning of the statement: "A class is an abstraction of an object", I'd be really grateful. My confusion is because this statement has been interpreted differently by different people... Does 'abstraction' mean: Dealing with the basics of a system, and not the deep intricacies of that

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

社会主义新天地 提交于 2019-12-19 10:26:12
问题 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(); 回答1: What happens exactly is that you are creating an

Routing an object in C# without using switch statements

折月煮酒 提交于 2019-12-13 06:48:28
问题 I am writing a piece of software in c# .net 4.0 and am running into a wall in making sure that the code-base is extensible, re-usable and flexible in a particular area. We have data coming into it that needs to be broken down in discrete organizational units. These units will need to be changed, sorted, deleted, and added to as the company grows. No matter how we slice the data structure we keep running into a boat-load of conditional statements (upwards of 100 or so to start) that we are

What is the difference between Dynamic, Static and Late binding?

元气小坏坏 提交于 2019-12-13 00:57:54
问题 I was going through Object-Oriented Programming in Objective-C guide by Apple. Under the topic of Dynamism-->Dynamic Binding, there were three concepts: Dynamic Binding Late Binding Static Binding I've almost understood the difference(s) between Dynamic and Late binding, but Static Binding confuses a lot. Can somebody please explain the differences between these three concepts with examples either in Objective-C or C++? Note: Before you think to mark this question as duplicate, there is no