Reply to comment
operation vs. method
I often mix up the term "operation" with the term "method".
Because I think that many software engineers have the same problem, I would like to explain the differences today in this post:
Operation
An operation is the abstract definition of a functionality. So to say operations are only the functions head, not the body / implementation.
They describe (by comment and name) WHAT the function does, but not HOW the function achieves this.
Example:
- interface Example {
- /**
- * Executes an example function.
- **/
- public function execute();
- }
So typically interfaces may only contain operations but not methods, because they do not implement the HOW, just tell WHAT the operation should do.
The concrete implementation is being done by the inheriting classes.
Method
A method is a concrete implementation of an operation and contains a method body though. The method represents the HOW.
Example:
- class ExampleClass implements Example {
- /**
- * @see Example::execute()
- **/
- public function execute(){
- echo("Execution successful! Have a nice day :)");
- }
- }
I hope to help you with my little explanation / definition.
Reply
Julian Pustkuchen ist passionierter Software- & Webentwickler mit den Schwerpunkten Softwaredesign, Objektorientierung, Ablaufoptimierung und Usability bei webks. Ein weiterer Schwerpunkt ist die Entwicklung im CMS Drupal.
Er besitzt einen Abschluss als B.Sc. Wirtschaftsinformatik (dual) und studiert derzeit für seinen Abschluss als Master of Science Wirtschaftsinformatik.
Entwickelt Julian gerade keine Software, fährt er Ski, Mountainbike, spielt Badminton, segelt oder verbringt Zeit mit Freunden.
Dieser Blog dient als sein "öffentlicher Notizblo(ck/g)".
Neueste Blogeinträge
-
05.02.2012 - 09:52
-
03.02.2012 - 18:14
-
27.01.2012 - 00:12
Tags in Blogeintrag - Kategorie
Webbasierte Lösungen? Machen wir!
webks: websolutions kept simple
http://www.webks.de





