abstraction

Is it possible to use JDBC as an abstraction layer for RDBMS?

情到浓时终转凉″ 提交于 2019-12-22 18:07:13
问题 JDBC provides an API, which may be used to connect to different RDBMS or similar datastores. But the datastores differ in implementation (e.g. SQL dialects). Is it possible to use JDBC in such a way, that my queries and statements work on most common RDBMS (e.g.: Oracle, PostgreSQL, SQL Server, MySQL)? That question is interesting for me at two aspects: * Common SQL (INSERT, UPDATE, SELECT etc.) * Accessing Meta data (getting information about tables and columns) I am currently experimenting

Message forwarding in Smalltalk

人盡茶涼 提交于 2019-12-22 08:54:11
问题 So I'm writing an application where one object has a bunch of delegate objects that it forwards messages to. The idea is that I can say someObject sendMessage:aMessage and aMessage will be sent to all of someObject's delegates (for any value of aMessage). The only way I've been able to do this is something like: sendMessage:aMessage | sel chunks kwords arglist msg | chunks := aMessage findTokens:' '. kwords := Array new:(chunks size). arglist := Array new:(chunks size). 1 to: (chunks size) do

Is 'invariant' property part of the definition of Abstraction?

别说谁变了你拦得住时间么 提交于 2019-12-21 21:27:48
问题 As part of my learning i think the best answer(with meaning) for definition of abstraction that i found is from stackoverflow: What is abstraction? Besides that, As part of current online course cs61B Fall 2006, Berkeley, i learnt the similar below definition of ADT close to above definition but added an extra word 'invariant'. Shall i consider this word as corollary to the above definition? or Is this word part of the definition? An _Abstract_Data_Type_ (ADT) is a class that has a well

Is an ORM redundant with a NoSQL API?

北慕城南 提交于 2019-12-20 17:35:27
问题 with MongoDB (and I assume other NoSQL database APIs worth their salt) the ways of querying the database are much more simplistic than SQL. There is no tedious SQL queries to generate and such. For instance take this from mongodb-csharp: using MongoDB.Driver; Mongo db = new Mongo(); db.Connect(); //Connect to localhost on the default port. Document query = new Document(); query["field1"] = 10; Document result = db["tests"]["reads"].FindOne(query); db.Disconnect(); How could an ORM even

What is exact difference between Inheritance and Abstract class?

我怕爱的太早我们不能终老 提交于 2019-12-20 14:36:44
问题 I know the fundamentals of OOP concepts[Inheritance, Abstraction, Encapsulation, Polymorphism] We use Inheritance in case of Parent-Child relationship[Child can have all functionalities which Parent have and can add more functionality to itself too] And we use Abstract class (In java) for a partial set of default implementations of methods in a class, which also can be implemented by simple Inheritance. Look below example which makes my point clear. Inheritance: Parent class public class

overriding equals method when dealing with inheritance

拈花ヽ惹草 提交于 2019-12-20 03:30:21
问题 I have been reading about how best to override the equals method when dealing with subclasses and here I have found quite a few posts. They recommend different ways of implementing a solution using instanceof or getClass() to compare objects of different sub classes. However with reference to Effective Java, my understanding is (and I am new to this so I may well be wrong!) Bloch argues that in the end both can be problematic, “There is no way to extend an instantiable class and add a value

Working with Sets as Functions

我的未来我决定 提交于 2019-12-20 03:29:09
问题 From a FP course: type Set = Int => Boolean // Predicate /** * Indicates whether a set contains a given element. */ def contains(s: Set, elem: Int): Boolean = s(elem) Why would that make sense? assert(contains(x => true, 100)) Basically what it does is provide the value 100 to the function x => true . I.e., we provide 100, it returns true . But how is this related to sets? Whatever we put, it returns true . Where is the sense of it? I understand that we can provide our own set implementation

package visibility [closed]

*爱你&永不变心* 提交于 2019-12-19 17:45:28
问题 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 4 years ago . Why use package visibility (the default), unless the class should be public in java 回答1: As Rostislav Matl said, it's useful for when you want to make something that doesn't form part of your package's interface. As an example, imagine you have a package and it provides an

JAVA - Abstraction

孤人 提交于 2019-12-19 10:52:41
问题 I am little confused about abstraction in java. I have checked many pages stating that abstraction is data hiding(Hiding the implementation). What I understand about abstraction is it is 'partial implementation'. Just define what you are going to need in an abstract class/interface and afterwards extend/implement them and add your own functionality. What I don't understand is how this is a data hiding? You are going to get access to the code once you implement the class/interface and you will

JAVA - Abstraction

筅森魡賤 提交于 2019-12-19 10:52:09
问题 I am little confused about abstraction in java. I have checked many pages stating that abstraction is data hiding(Hiding the implementation). What I understand about abstraction is it is 'partial implementation'. Just define what you are going to need in an abstract class/interface and afterwards extend/implement them and add your own functionality. What I don't understand is how this is a data hiding? You are going to get access to the code once you implement the class/interface and you will