An open source collective initiative.
- Business
- Code
Interfaces for collections
License: MIT License
An open source collective initiative.
Time to take a shot again at the problem described in #4. The requirements have changed, and the goals became clearer.
has()
into a new interface HasCapableInterface
.intersect()
(which could compute a mapping of values/keys that are similar between two collections) is not the concern of the collection itself.This time, interfaces will look like this:
Issue #4 mentions multiple subtypes of collections, which are not inter-compatible, but are all compatible with collections themselves. One such subtype should be the Set, which represents an un-ordered key-less collection of unique items.
Create SetInterface
, exposing all functionality of a set.
There's no interface that would allow to remove an item from a set.
With the dhii/data-container-interface
repo deprecated, parties still need interoperability with regard to containers. This appears to fit rather well with the concept of collections, which includes maps, which are inherently containers.
Add the missing interfaces.
Interfaces are currently quite monolithic. For many purposes, a collection that can have items added and removed is suitable. But there are cases where a read-only, or a write-only collection is necessary. Or one that can have items added and accessed, but not removed.
Break interfaces into multiple smaller interfaces. This should be done with the following considerations in mind:
ReadableMapInterface extends BaseMapInterface
.BaseMapInterface extends BaseCollectionInterface
.WritableMapInterface extends WritableCollectionInterface
This way, a very large level of generalization and specialization can be achieved, because the consumer can implement any set of interfaces to expose only the functionality that they wish, and their consumers can depend on only that also.
Additionally, "composite" interfaces can be created to help consumers overcome the problem of not being able to typehint more than one type for the same parameter.
Add a MapFactoryInterface
. It should extend ContainerFactoryInterface
and IteratorFactoryInterface
. This could be problematic, because the config key that stores the items must also be the same for LSP.
It's useful to be able to write items to a set.
Extend set interface with method add()
.
In php-fig/container@6c2bc7f (see comments), BC is broken, and parameters now require typehints. On top of that, the min PHP version is also increased. Furthermore, there will likely be other BC-breaking changes on the master
branch, which will break this package.
Add a stability flag to psr/container
dep, e.g. ^1.0@stable
. This will allow installation of only released versions. Hopefully, in the future BC-breaking releases the major version wil be increased...
PHP 5 is just too much trouble. Discontinue support, upgrade the environment, add features where necessary for clarity.
AddCapableInterface#add()
does not accept an item. This is clearly a mistake.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.