Afficher/masquer le menu
Liens Ecyseo
  • Tags cloud
  • Daily
  • Pictures wall
  • Search
  • Display options
    • Links per page :
    • 20 links
    • 50 links
    • 100 links
  • RSS Feed
  • Login

J'ai besoin d'intimité. Non pas parce que mes actions sont douteuses, mais parce que votre jugement et vos intentions le sont.

5200 links 

page 223 / 260

Liste des liens

PHP: Interfaces - Manual
2014-09-7 13:1 - permalink -

"It seems like many contributors are missing the point of using an INTERFACE. An INTERFACE is not specifically provided for abstraction. That's what a CLASS is used for. Most examples in this article of interfaces could be achieved just as easily using just classes alone.

An INTERFACE is provided so you can describe a set of functions and then hide the final implementation of those functions in an implementing class. This allows you to change the IMPLEMENTATION of those functions without changing how you use it.

For example: I have a database. I want to write a class that accesses the data in my database. I define an interface like this:

interface Database {
function listOrders();
function addOrder();
function removeOrder();
...
}

Then let's say we start out using a MySQL database. So we write a class to access the MySQL database:

class MySqlDatabase implements Database {
function listOrders() {...
}
we write these methods as needed to get to the MySQL database tables. Then you can write your controller to use the interface as such:

$database = new MySqlDatabase();
foreach ($database->listOrders() as $order) {

Then let's say we decide to migrate to an Oracle database. We could write another class to get to the Oracle database as such:

class OracleDatabase implements Database {
public function listOrders() {...
}

Then - to switch our application to use the Oracle database instead of the MySQL database we only have to change ONE LINE of code:

$database = new OracleDatabase();

all other lines of code, such as:

foreach ($database->listOrders() as $order) {

will remain unchanged. The point is - the INTERFACE describes the methods that we need to access our database. It does NOT describe in any way HOW we achieve that. That's what the IMPLEMENTing class does. We can IMPLEMENT this interface as many times as we need in as many different ways as we need. We can then switch between implementations of the interface without impact to our code because the interface defines how we will use it regardless of how it actually works."

ET :

"When should you use interfaces? What are they good for?
Here are two examples.

  1. Interfaces are an excellent way to implement reusability.
    You can create a general interface for a number of situations
    (such as a save to/load from disk interface.) You can then
    implement the interface in a variety of different ways (e.g. for
    formats such as tab delimited ASCII, XML and a database.)
    You can write code that asks the object to "save itself to
    disk" without having to worry what that means for the object
    in question. One object might save itself to the database,
    another to an XML and you can change this behavior over
    time without having to rewrite the calling code.

This allows you to write reusable calling code that can work
for any number of different objects -- you don't need to know
what kind of object it is, as long as it obeys the common
interface.

  1. Interfaces can also promote gradual evolution. On a
    recent project I had some very complicated work to do and I
    didn't know how to implement it. I could think of a "basic"
    implementation but I knew I would have to change it later.
    So I created interfaces in each of these cases, and created
    at least one "basic" implementation of the interface that
    was "good enough for now" even though I knew it would have
    to change later.

When I came back to make the changes, I was able to create
some new implementations of these interfaces that added the
extra features I needed. Some of my classes still used
the "basic" implementations, but others needed the
specialized ones. I was able to add the new features to the
objects themselves without rewriting the calling code in most
cases. It was easy to evolve my code in this way because
the changes were mostly isolated -- they didn't spread all
over the place like you might expect."

Enfin, je comprends à quoi sert une interface (Merci à dlovell2001 at yahoo dot com et erik dot zoltan at msn dot com) ! Je n'avais jamais lu les commentaires associés à cette page. J'aurais dû le faire plus tôt.

Moralité : TOUJOURS LIRE LES COMMENTAIRES DES PAGES DE LA DOCUMENTATION PHP !

php tutoriels
- http://php.net/manual/fr/language.oop5.interfaces.php
Fabius : un seul point vous manque, et tout est dépeuplé... - Retourne Au CM1 !
2014-09-7 11:28 - permalink -

Je ne vois pas ce qui gène... :)

orthographe
- http://www.retourneaucm1.com/index.php?post/2014/09/04/Fabius-Un-seul-point-vous-manque%2C-et-tout-est-d%C3%A9peupl%C3%A9...
Note : Utilisez LibreOffice Draw pour éditer les fichiers PDF - Le Hollandais Volant
2014-09-7 11:21 - permalink -

Merci pour l'astuce. À tester.

libreoffice pdf
- http://lehollandaisvolant.net/?mode=links&id=20140906180120
thumbnail
hollande+jacques+a+dit.png (Image PNG, 930 × 653 pixels)
2014-09-6 2:28 - permalink -

Arf :(
Et en plus, il a le charisme d'une huître...

politique
- https://lh5.googleusercontent.com/-uReHN0_hiy4/VAnJQajN-QI/AAAAAAAAIK8/PZlbCPXEiCA/w930-h653-no/hollande%2Bjacques%2Ba%2Bdit.png
0sec - Minuteur et alarme - le hollandais volant
2014-09-6 2:25 - permalink -

Pas mal :)
Je pense que je vais m'en servir pour le boulot afin de débaucher enfin à l'heure...

javascript
- http://lehollandaisvolant.net/tout/tools/timer/
Bookmark Bronco
2014-09-5 16:50 - permalink -

Ça fait du bien de temps en temps de remettre les pendules à l'heure.

opinion
- http://www.warriordudimanche.net/shaarli/?AGmtKA
Petit sondage shaarlieurs: Combien avez-vous d'onglets ouverts en général ? - Shaarli-Tech
2014-09-5 16:40 - permalink -

Au boulot, 17 épinglés, 11 non épinglés mini.
À la maison, minimum 5 mais aucun d'épinglés.

shaarli
- https://tech-services.fr/shartech/?Onw2Cw
27 idées étonnantes qui rendront votre maison extravagante - Des idées
2014-09-4 20:18 - permalink -

Pas mal :)

design
- http://desidees.net/27-idees-etonnantes-qui-rendront-votre-maison-extravagante/
Stroke 7 Icon Font Set | Icon Fonts | Pixeden
2014-09-3 23:19 - permalink -

Icones façon iOS.

design icones
- http://www.pixeden.com/icon-fonts/stroke-7-icon-font-set
Articles – Sara Soueidan – Freelance Front-end Web Developer
2014-09-3 23:9 - permalink -

Articles sur svg à lire. Beaucoup de choses intéressantes et bien expliquées.

tutoriels
- http://sarasoueidan.com/articles.html
How Gravity Makes Things Fall - YouTube - Le Hollandais Volant
2014-09-2 19:1 - permalink -

Pas mal et très bien expliqué. Et en plus, il y a les plans pour en faire de même à la maison...

gravité sciences
- http://lehollandaisvolant.net/index.php?mode=links&id=20140902161332
Fappening day : la solution | CommitStrip - Blog relating the daily life of web agencies developers - Le Hollandais Volant
2014-09-2 18:51 - permalink -

Plutôt qu'un autocollant, il faudrait en faire une vraie coque (pour android aussi...)

accessoire vie-privée
- http://lehollandaisvolant.net/index.php?mode=links&id=20140902162449
OpenStreetMap : le prochain projet libre vraiment indispensable, par Glyn Moody - Framablog
2014-09-2 14:24 - permalink -

"C’est le problème habituel du contrôle. Si le logiciel sur votre ordinateur n’est pas un logiciel libre, ce n’est pas réellement votre ordinateur, mais juste un que le fournisseur de logiciel propriétaire vous autorise à utiliser d’une certaine façon, définie par lui."
Tout le problème du logiciel propriétaire est résumé dans cette phrase...

internet logiciel
- http://www.framablog.org/index.php/post/2014/09/02/10-ans-openstreetmap
YouTube thumbnail
▶ Say Something - A Great Big World & Christina Aguilera (Official Music Cover) by Kina Grannis - YouTube
2014-09-2 1:20 - permalink -

J'adore !!! Et en plus, elle est trop belle (in love) <3

Musique
- https://www.youtube.com/watch?v=4_o95IyLL_U
La police saisit près de huit tonnes de socialisme contrefait au siège du PS | Le Gorafi.fr Gorafi News Network
2014-09-2 0:57 - permalink -

:) via le hollandais volant

Humour
- http://www.legorafi.fr/2014/09/01/la-police-saisit-pres-de-huit-tonnes-de-socialisme-contrefait-au-siege-du-ps/
Les objets connectés sont-ils nos amis ? | la spirale digitale
2014-09-1 23:50 - permalink -

Que de vérités, malheureusement...

internet politique
- http://spiraledigitale.com/les-objets-connectes-sont-nos-amis/
Un pps plutôt précis sur les retraites
2014-09-1 15:51 - permalink -

D'autres choix politiques sont possibles, autres que ceux que les médias et nos "chers" élus nous assènent.

politique retraites
- http://www.scoplepave.org/archives/docus/Retraites.pps
Bookmark Bronco
2014-09-1 15:43 - permalink -

Oui bien sûr, c'est tiré du pavé dans la mare (http://www.scoplepave.org/travailler-moins-pour-gagner-plus)

politique
- http://www.warriordudimanche.net/shaarli/?4me5Ag
L'inattendu du salaire
2014-09-1 1:33 - permalink -

Une vision différente sur ce qu'on croit savoir sur le salaire.

politique économie
- http://www.scoplepave.org/archives/ledico/auteurs/Bernard%20Friot%20-%20l%20innatendu%20du%20salaire.htm
Le pouvoir invisible - AgoraVox le média citoyen
2014-09-1 1:15 - permalink -

A lire et méditer et à faire circuler. "Comme hier, la corde est tendue... très..."

politique
- http://www.agoravox.fr/tribune-libre/article/le-pouvoir-invisible-104666
page 223 / 260


Tags


  • shaarli
  • wikipedia

Tags cloud

Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation
Affiches "loi aviva" créées par Geoffrey Dorne le 13 Mai, 2020 - Mastodon 1 - Mastodon 2