abstraction

Abstraction away from CSS

久未见 提交于 2019-12-03 10:43:13
Let me make something quite clear. I. Hate . CSS. It is a never-ending nightmare. Every minor layout change feels like a hack. Solutions to problems seem to often involve jiggering numbers around like some chef trying to work out exactly how much nutmeg to put in his soon-to-be famous rice pudding. Then comes the multiple browser issue, the multiple resolution issues.. .. to cut a long story short, it's a pain. A PITA, if you will. Many frameworks seek to abstract away from HTML (custom tags, JSFs component system) in an effort to make dealing with that particular kettle of fish easier. Is

Abstracting away from data structure implementation details in Clojure

試著忘記壹切 提交于 2019-12-03 10:40:23
I am developing a complex data structure in Clojure with multiple sub-structures. I know that I will want to extend this structure over time, and may at times want to change the internal structure without breaking different users of the data structure (for example I may want to change a vector into a hashmap, add some kind of indexing structure for performance reasons, or incorporate a Java type) My current thinking is: Define a protocol for the overall structure with various accessor methods Create a mini-library of functions that navigate the data structure e.g. (query-substructure-abc

A brilliant example of effective encapsulation through information hiding?

陌路散爱 提交于 2019-12-03 09:36:52
问题 " Abstraction and encapsulation are complementary concepts: abstraction focuses on the observable behavior of an object... encapsulation focuses upon the implementation that gives rise to this behavior... encapsulation is most often achieved through information hiding , which is the process of hiding all of the secrets of object that do not contribute to its essential characteristics." - Grady Booch in Object Oriented Analysis and Design Can you show me some powerfully convincing examples of

Is it better to use List or Collection?

随声附和 提交于 2019-12-03 08:10:56
问题 I have an object that stores some data in a list. The implementation could change later, and I don't want to expose the internal implementation to the end user. However, the user must have the ability to modify and access this collection of data. Currently I have something like this: public List<SomeDataType> getData() { return this.data; } public void setData(List<SomeDataType> data) { this.data = data; } Does this mean that I have allowed the internal implementation details to leak out?

How Does One Make Scala Control Abstraction in Repeat Until?

喜你入骨 提交于 2019-12-03 06:15:58
I am Peter Pilgrim. I watched Martin Odersky create a control abstraction in Scala. However I can not yet seem to repeat it inside IntelliJ IDEA 9. Is it the IDE? package demo class Control { def repeatLoop ( body: => Unit ) = new Until( body ) class Until( body: => Unit ) { def until( cond: => Boolean ) { body; val value: Boolean = cond; println("value="+value) if ( value ) repeatLoop(body).until(cond) // if (cond) until(cond) } } def doTest2(): Unit = { var y: Int = 1 println("testing ... repeatUntil() control structure") repeatLoop { println("found y="+y) y = y + 1 } { until ( y < 10 ) } }

more advantages or disadvantages to delegate members over classic functions?

吃可爱长大的小学妹 提交于 2019-12-03 05:59:10
问题 class my_class { public int add_1(int a, int b) {return a + b;} public func<int, int, int> add_2 = (a, b) => {return a + b;} } add_1 is a function whereas add_2 is a delegate. However in this context delegates can forfill a similar role. Due to precedent and the design of the language the default choice for C# methods should be functions. However both approaches have pros and cons so I've produced a list. Are there any more advanteges or disadvantages to either approach? Advantages to

How to get the name of the calling class (in PHP)

拥有回忆 提交于 2019-12-03 04:49:18
define('anActionType', 1); $actionTypes = array(anActionType => 'anActionType'); class core { public $callbacks = array(); public $plugins = array(); public function __construct() { $this->plugins[] = new admin(); $this->plugins[] = new client(); } } abstract class plugin { public function registerCallback($callbackMethod, $onAction) { if (!isset($this->callbacks[$onAction])) $this->callbacks[$onAction] = array(); global $actionTypes; echo "Calling $callbackMethod in $callbacksClass because we got {$actionTypes[$onAction]}" . PHP_EOL; // How do I get $callbacksClass? $this->callbacks[$onAction

Is an ORM redundant with a NoSQL API?

北慕城南 提交于 2019-12-03 04:19:43
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 simplify that? Is an ORM or other "database abstraction device" required on top of a decent NoSQL API? Well,

What is exact difference between Inheritance and Abstract class?

淺唱寂寞╮ 提交于 2019-12-03 03:39:28
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 Parent { // This method will remain same for all child classes.No need to override public void abc() {

Access Control List (ACL) abstraction layer in .net

邮差的信 提交于 2019-12-03 03:37:23
Is there an ACL abstraction layer available in .net? I have seen some "best practices" documents but no good base implementation. What about the System.Security.AccessControl? Is this a good starting point? The ACL's should work with Roles stored in DB as well as Roles by the system and for in-memory-object definitions as well as db objects or files. So it should be generic and/or easy to extend. Should this rely on IPrincipal, IIdentity from the .net framework? Zend has something similar in their Framework for PHP and I am searching this kind of stuff for C# instead of porting that (if there