<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Orsevin</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Orsevin"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Orsevin"/>
	<updated>2026-07-05T13:57:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56592</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56592"/>
		<updated>2011-12-12T04:22:28Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: /* Yo-yo problem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|A workflow for anti-patterns]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Object cesspool===&lt;br /&gt;
An object pool is a design pattern in which some initialized objects are kept ready to use rather than allocated and destroyed as they are needed. This can be used for objects that would otherwise have to be created and destroyed often like session objects on a web server, saving computing time.[http://en.wikipedia.org/wiki/Object_pool_pattern]&lt;br /&gt;
&lt;br /&gt;
The object cesspool is an anti-pattern in which the object pool is used improperly, and can result in costly bugs. The cesspool occurs when objects are not reset as they should be after being used. The next time an object is used it may contain state information from the previous instance which should have been reset. This can cause bugs or security issues. Using the the sessions example, if an object pool is used to track sessions and a user logs out, the users details should be completely reset. If they aren't and another session is loaded on that session object when another user logs in, the new user may be able to see private information of the other user such as their login information.&lt;br /&gt;
[http://wiki3.cosc.canterbury.ac.nz/index.php/Object_cesspool]&lt;br /&gt;
&lt;br /&gt;
===Yo-yo problem===&lt;br /&gt;
The yo-yo problem is an anti-pattern in which the inheritance hierarchy becomes so deep that the programmer has to constantly switch back and forth between subclasses and superclasses to understand the program.&amp;lt;ref&amp;gt;[http://wiki3.cosc.canterbury.ac.nz/index.php/Yo-yo_problem]  The Mutable Compendium of Object Oriented Wisdom:Yo-yo problem&amp;lt;/ref&amp;gt;&lt;br /&gt;
This quickly reduces the effectiveness of the programmer. The key to avoiding this is to limit the depth of hierarchy as much as possible and to improve the documentation of classes so that documentation of the lower classes also contains the information the user of that class needs to know about their superclasses.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56591</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56591"/>
		<updated>2011-12-12T04:21:16Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|A workflow for anti-patterns]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Object cesspool===&lt;br /&gt;
An object pool is a design pattern in which some initialized objects are kept ready to use rather than allocated and destroyed as they are needed. This can be used for objects that would otherwise have to be created and destroyed often like session objects on a web server, saving computing time.[http://en.wikipedia.org/wiki/Object_pool_pattern]&lt;br /&gt;
&lt;br /&gt;
The object cesspool is an anti-pattern in which the object pool is used improperly, and can result in costly bugs. The cesspool occurs when objects are not reset as they should be after being used. The next time an object is used it may contain state information from the previous instance which should have been reset. This can cause bugs or security issues. Using the the sessions example, if an object pool is used to track sessions and a user logs out, the users details should be completely reset. If they aren't and another session is loaded on that session object when another user logs in, the new user may be able to see private information of the other user such as their login information.&lt;br /&gt;
[http://wiki3.cosc.canterbury.ac.nz/index.php/Object_cesspool]&lt;br /&gt;
&lt;br /&gt;
===Yo-yo problem===&lt;br /&gt;
The yo-yo problem is an anti-pattern in which the inheritance hierarchy becomes so deep that the programmer has to constantly switch back and forth between subclasses and superclasses to understand the program.&amp;lt;ref&amp;gt;[http://wiki3.cosc.canterbury.ac.nz/index.php/Yo-yo_problem]  The Mutable Compendium of Object Oriented Wisdom:Yo-yo problem&amp;lt;/ref&amp;gt;&lt;br /&gt;
This quickly reduces the effectiveness of the programmer. The key to avoiding this is to limit the depth of hierarchy as much as possible and to improve the documentation of classes so that the lower classes also contain the information the programmer needs to know about their superclasses.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56590</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56590"/>
		<updated>2011-12-12T04:19:42Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: /* Object cesspool */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|A workflow for anti-patterns[http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Object cesspool===&lt;br /&gt;
An object pool is a design pattern in which some initialized objects are kept ready to use rather than allocated and destroyed as they are needed. This can be used for objects that would otherwise have to be created and destroyed often like session objects on a web server, saving computing time.[http://en.wikipedia.org/wiki/Object_pool_pattern]&lt;br /&gt;
&lt;br /&gt;
The object cesspool is an anti-pattern in which the object pool is used improperly, and can result in costly bugs. The cesspool occurs when objects are not reset as they should be after being used. The next time an object is used it may contain state information from the previous instance which should have been reset. This can cause bugs or security issues. Using the the sessions example, if an object pool is used to track sessions and a user logs out, the users details should be completely reset. If they aren't and another session is loaded on that session object when another user logs in, the new user may be able to see private information of the other user such as their login information.&lt;br /&gt;
[http://wiki3.cosc.canterbury.ac.nz/index.php/Object_cesspool]&lt;br /&gt;
&lt;br /&gt;
===Yo-yo problem===&lt;br /&gt;
The yo-yo problem is an anti-pattern in which the inheritance hierarchy becomes so deep that the programmer has to constantly switch back and forth between subclasses and superclasses to understand the program.&amp;lt;ref&amp;gt;[http://wiki3.cosc.canterbury.ac.nz/index.php/Yo-yo_problem]  The Mutable Compendium of Object Oriented Wisdom:Yo-yo problem&amp;lt;/ref&amp;gt;&lt;br /&gt;
This quickly reduces the effectiveness of the programmer. The key to avoiding this is to limit the depth of hierarchy as much as possible and to improve the documentation of classes so that the lower classes also contain the information the programmer needs to know about their superclasses.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56589</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56589"/>
		<updated>2011-12-12T02:13:49Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: /* Yo-yo problem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|A workflow for anti-patterns[http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Object cesspool===&lt;br /&gt;
===Yo-yo problem===&lt;br /&gt;
The yo-yo problem is an anti-pattern in which the inheritance hierarchy becomes so deep that the programmer has to constantly switch back and forth between subclasses and superclasses to understand the program.&amp;lt;ref&amp;gt;[http://wiki3.cosc.canterbury.ac.nz/index.php/Yo-yo_problem]  The Mutable Compendium of Object Oriented Wisdom:Yo-yo problem&amp;lt;/ref&amp;gt;&lt;br /&gt;
This quickly reduces the effectiveness of the programmer. The key to avoiding this is to limit the depth of hierarchy as much as possible and to improve the documentation of classes so that the lower classes also contain the information the programmer needs to know about their superclasses.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56406</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56406"/>
		<updated>2011-12-01T18:13:16Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|A workflow for anti-patterns[http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Object cesspool===&lt;br /&gt;
===Yo-yo problem===&lt;br /&gt;
The yo-yo problem is an anti-pattern in which the inheritance hierarchy becomes so deep that the programmer has to constantly switch back and forth between subclasses and superclasses to understand the program.&amp;lt;ref&amp;gt;[http://wiki3.cosc.canterbury.ac.nz/index.php/Yo-yo_problem]  The Mutable Compendium of Object Oriented Wisdom:Yo-yo problem&amp;lt;/ref&amp;gt;&lt;br /&gt;
 This quickly reduces the effectiveness of the programmer. The key to avoiding this is to limit the depth of hierarchy as much as possible and to improve the documentation of classes so that the lower classes also contain the information the programmer needs to know about their superclasses.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56405</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56405"/>
		<updated>2011-12-01T18:11:37Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Object cesspool===&lt;br /&gt;
===Yo-yo problem===&lt;br /&gt;
The yo-yo problem is an anti-pattern in which the inheritance hierarchy becomes so deep that the programmer has to constantly switch back and forth between subclasses and superclasses to understand the program.&amp;lt;ref&amp;gt;[http://wiki3.cosc.canterbury.ac.nz/index.php/Yo-yo_problem]  The Mutable Compendium of Object Oriented Wisdom:Yo-yo problem&lt;br /&gt;
 This quickly reduces the effectiveness of the programmer. The key to avoiding this is to limit the depth of hierarchy as much as possible and to improve the documentation of classes so that the lower classes also contain the information the programmer needs to know about their superclasses.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56399</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56399"/>
		<updated>2011-12-01T11:11:08Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: e&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the  other, making, and causing memory leaks with reference counting garbage collectors. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Circular dependency is a very broad anti-pattern so there is no one solution or cause. Sometimes the dependency is caused because an object must keep track of another. In this case the observer pattern is a good solution. Tools exist that help detect circular dependencies.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56398</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56398"/>
		<updated>2011-12-01T11:01:58Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
&lt;br /&gt;
[[File:oantipatterndesc.png|upright|400x400px|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
&lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Anemic Domain Model | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia: BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Call super===&lt;br /&gt;
The call super anti-pattern occurs when a method in a subclass must call the method it is overriding in the superclass. Everyone overriding a method with partial functionality has to remember to call super. It seems like a minor annoyance, but there is no reason to force this responsibility on the user of the API.&lt;br /&gt;
&amp;lt;ref&amp;gt;[http://www.martinfowler.com/bliki/CallSuper.html] Call Super | Martin Fowler&amp;lt;/ref&amp;gt;&lt;br /&gt;
As an example, suppose there is a class mammal. The class has a method digest_food. Suppose all mammals digestive systems work the same way except in how they put food in their mouths. For example, humans use a fork and whales just swim around with their mouths open. Instead of detailing everything that happens in the digestion, subclassed mammals just specify how the first part, getting the food in the mouth. &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      swallowFood() ...&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
      super.digest() &lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
The best way to avoid super calls is to refactor the code using the template method pattern.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Call_super] Wikipedia: Call super&amp;lt;/ref&amp;gt; In our example, the anti-pattern in fixed as follows:  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &lt;br /&gt;
  public class Mammal {&lt;br /&gt;
    public void digest() { &lt;br /&gt;
      putFoodInMouth()&lt;br /&gt;
      swallowFood() ... &lt;br /&gt;
    }&lt;br /&gt;
    protected abstract void putFoodInMouth():&lt;br /&gt;
  }&lt;br /&gt;
. public class Human{&lt;br /&gt;
    protected abstract void putFoodInMouth() { &lt;br /&gt;
      liftFork() ...&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
===Circular dependency===&lt;br /&gt;
Circular dependency is an anti-pattern in which two or more modules depend on each other to work properly. This can have many negative effects, including making it impossible to reuse a module without the the other, making , and even causing memory leaks with reference counting garbage collectors. &lt;br /&gt;
&lt;br /&gt;
Often circular dependencies are created when an inexperienced programmer needs objects to communicate in two directions. Objects that need to keep track of eachother. &lt;br /&gt;
[http://en.wikipedia.org/wiki/Circular_dependency] Wikipedia: Circular Dependency super&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Oantipatterndesc.png&amp;diff=56397</id>
		<title>File:Oantipatterndesc.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Oantipatterndesc.png&amp;diff=56397"/>
		<updated>2011-12-01T10:01:04Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: uploaded a new version of &amp;amp;quot;File:Oantipatterndesc.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Antipattern flow chart&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Oantipatterndesc.png&amp;diff=56396</id>
		<title>File:Oantipatterndesc.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Oantipatterndesc.png&amp;diff=56396"/>
		<updated>2011-12-01T09:54:07Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: Antipattern flow chart&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Antipattern flow chart&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56395</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56395"/>
		<updated>2011-12-01T09:45:38Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Martin Fowler's blog&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hashmap are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The solution to this anti-pattern is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia:BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56394</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56394"/>
		<updated>2011-12-01T09:44:11Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Martin Fowler's blog&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
===BaseBean===&lt;br /&gt;
&lt;br /&gt;
	The BaseBean anti-pattern describes a pattern where a utility object is subclassed. The seeming benefit is that the subclassed class can very simply use all the utility’s functionality. Utility objects like Java’s hash are not in the control of the developer, and if they change it . Also, inheritance take place when there is a meaningful “is-a” relationship, which  is usually violated . The easy solution to this is to use composition and change it to a “has-a” relationship, as shown in the diagrams. &amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/BaseBean] Wikipedia:BaseBean&amp;lt;/ref&amp;gt; &lt;br /&gt;
{|&lt;br /&gt;
|[[File:incorrectbasebean.png|framed|BaseBean anti-pattern [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|[[File:correctbasebean.png|framed|Refactored using composition [http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean]]]&lt;br /&gt;
|}&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56393</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56393"/>
		<updated>2011-12-01T09:13:04Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity grows or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [http://en.wikipedia.org/wiki/Design_Patterns Design Patterns]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. &amp;lt;ref&amp;gt;[http://sourcemaking.com/antipatterns] Sourcemaking &amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [http://c2.com/cgi/wiki?AntiPatternsCatalog Cunningham and Cunningham's AntiPattern Catalog].&lt;br /&gt;
==Object-Oriented Anti-patterns==&lt;br /&gt;
===Anemic Domain Model===&lt;br /&gt;
The Anemic Domain Model is an anti-pattern of creating objects which have little behavior aside from getter and setter functions. Rather than including object logic within the objects, the logic is implemented from a higher level. In other words, the methods that describe an object’s behavior are not implemented in the object’s class itself, but instead in a class or other piece of code that contains that object. &amp;lt;ref&amp;gt;[http://martinfowler.com/bliki/AnemicDomainModel.html] Martin Fowler's blog&amp;lt;/ref&amp;gt;&lt;br /&gt;
For example consider a BankAccount class that has getter and setter methods for interest and cash. Rather than including an accrueInterest method in the account itself, the account just contains getter and setter methods for interest and cash. The logic of calculating the interest and updating the cash is implemented in a higher level code, such as the Bank class, which contains BankAccounts. Instead of using object oriented programming advantageously, the BankAccount uses the extra overhead required for a full object without being more useful than a simple data structure or row in a database table.&lt;br /&gt;
==Basebean&lt;br /&gt;
[[File:incorrectbasebean.png]]&lt;br /&gt;
[[File:correctbasebean.png]]&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrectbasebean.png&amp;diff=56392</id>
		<title>File:Incorrectbasebean.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrectbasebean.png&amp;diff=56392"/>
		<updated>2011-12-01T08:57:38Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Basebean antipattern&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Correctbasebean.png&amp;diff=56391</id>
		<title>File:Correctbasebean.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Correctbasebean.png&amp;diff=56391"/>
		<updated>2011-12-01T08:55:08Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: Correct way to refactor Basebean antipattern
http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Correct way to refactor Basebean antipattern&lt;br /&gt;
http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrectbasebean.png&amp;diff=56390</id>
		<title>File:Incorrectbasebean.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrectbasebean.png&amp;diff=56390"/>
		<updated>2011-12-01T08:53:38Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: Correct way to refactor Basebean antipattern
http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Correct way to refactor Basebean antipattern&lt;br /&gt;
http://wiki3.cosc.canterbury.ac.nz/index.php/BaseBean&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56389</id>
		<title>CSC/ECE 517 Fall 2011/ch7 7d os</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch7_7d_os&amp;diff=56389"/>
		<updated>2011-12-01T08:44:43Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: Created page with &amp;quot;=Anti-patterns= ==What is an Anti-pattern== An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective o...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Anti-patterns=&lt;br /&gt;
==What is an Anti-pattern==&lt;br /&gt;
An anti-pattern describes a solution which is commonly used because at first it seems beneficial, but, in fact, it is an ineffective or bad solution. The anti-pattern is usually attractive to inexperienced programmers but as the complexity or context of a problem changes, the problems with the pattern become more obvious.  The term “anti-pattern” was introduced in 1995 by Andrew Koenig in his book AntiPatterns, published shortly after the Gang of Four’s [Design Patterns: Elements of Reusable Object-Oriented Software]. &lt;br /&gt;
&lt;br /&gt;
==Benefits of Anti-patterns==&lt;br /&gt;
The benefit of documenting anti-patterns is that they identify bad solutions and often can point out better solutions. An implemented anti-pattern does not reveal itself until the project grows more complex, so it saves time to be able to know and identify an anti-pattern early.  Because many people have stumbled into the same anti-patterns, better design patterns for many anti-patterns are well-known. &lt;br /&gt;
A useful description of an anti-pattern contains both an indication of why it is a bad solution, and a way to refactor it into a good solution. [http://sourcemaking.com/antipatterns]&lt;br /&gt;
&lt;br /&gt;
Because this class is concerned with Object Oriented programming, the focus of the next sections will be on several object oriented anti-patterns. There are dozens of known anti-patterns spanning all domains of software engineering, from management and organization practices to design issues to coding. For a more comprehensive list see [[http://c2.com/cgi/wiki?AntiPatternsCatalog]].&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51900</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51900"/>
		<updated>2011-10-07T03:16:45Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
method_missing is very powerful and widely used in Ruby on Rails. As one of the dynamic features of Ruby, it is a way of intercepting calls to methods that haven't been defined, which would otherwise raise a NoMethodError. The functionality of method missing is one of the core ingredients of cleanly designed Ruby programs.&amp;lt;ref&amp;gt;Method Missing http://contextr.rubyforge.org/test/method_missing.html&amp;lt;/ref&amp;gt; It is still possible to extend it with context-dependent behavior.&lt;br /&gt;
&lt;br /&gt;
This feature is not unique to Ruby. It also exists in Smalltalk, Python, Groovy, some JavaScripts, and even most CLOS extensions have it.&lt;br /&gt;
&lt;br /&gt;
==Why it is used==&lt;br /&gt;
method_missing gives Ruby objects a way to respond not just to finite numbers of predefined methods, but to handle entire groups of calls of different types. It is therefore used in many ways, from customizing debug information to generating new domain specific languages. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How it is used==&lt;br /&gt;
When we send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with the method_missing.&amp;lt;ref&amp;gt;Ruby Method Missing http://rubylearning.com/satishtalim/ruby_method_missing.html&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Method missing is defined in the Object class. It is very simple to use, simply override it in the subclass where it is needed. The method takes one, two, or three parameters: the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
&lt;br /&gt;
===Adding better debug information on failure===&lt;br /&gt;
One of the most simple but still very powerful ways of using method_missing is to allow it to include more information in the error message.&amp;lt;ref&amp;gt;Patterns of method missing http://ruby.dzone.com/news/patterns-method-missing&amp;lt;/ref&amp;gt; Here is a simple example:&lt;br /&gt;
  class MyFoo&lt;br /&gt;
    def method_missing(method, *args, &amp;amp;block)&lt;br /&gt;
      raise NoMethodError, &amp;lt;&amp;lt;ERRORINFO&lt;br /&gt;
  method: #{method}&lt;br /&gt;
  args: #{args.inspect}&lt;br /&gt;
  on: #{self.to_yaml}&lt;br /&gt;
  ERRORINFO&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Other patterns of method missing===&lt;br /&gt;
There are many other patterns of method_missing. For example, using Ruby’s blocks and method_missing to make it easy to create any kind of output structure, like XML, HTML, graphical UIs and other hierarchical data structures, to lend themselves very well to the builder pattern. By using method_missing, all kinds of test helpers, which can be used to implement factories, delegate and do all kinds of things, are able to be created.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===Roman Numerals===&lt;br /&gt;
The classic example for missing_method, given in the Ruby Docs:&amp;lt;ref&amp;gt;Ruby Docs: Object.missing_method http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing &amp;lt;/ref&amp;gt;&lt;br /&gt;
  class Roman&lt;br /&gt;
    def romanToInt(str)&lt;br /&gt;
      # ...&lt;br /&gt;
    end&lt;br /&gt;
    def method_missing(methId)&lt;br /&gt;
      str = methId.id2name&lt;br /&gt;
      romanToInt(str)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  r = Roman.new&lt;br /&gt;
  r.iv	»	4&lt;br /&gt;
  r.xxiii	»	23&lt;br /&gt;
  r.mm	»	2000&lt;br /&gt;
&lt;br /&gt;
The Roman class has no .iv or .xxiii methods, but the method_missing method turns the message into a string with id2name (which takes symbols and returns them as strings), and passes it to the romanToInt. This example shows how method_missing can make the Ruby language very flexible.&lt;br /&gt;
&lt;br /&gt;
===method_missing in Rails===&lt;br /&gt;
Rails, like many domain specific languages of Ruby, makes heavy use of the method_missing function.  A prominent example is ActiveRecord, where dynamic finders are implemented using method_missing. When a call like find_by_username is called from an ActiveRecord object, the method does not explicitly exist, rather the message is picked apart in [https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb#L1053 ActiveRecord's Base::method_missing] method. The variable part of the message, in this case &amp;quot;username&amp;quot; is turned into an argument to the find method, which is defined. The code below is not exactly what is in the method itself, but outlines what actually happens after calls to helper other methods:&amp;lt;ref&amp;gt;How dynamic finders work http://blog.hasmanythrough.com/2006/8/13/how-dynamic-finders-work &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method_id, *arguments)&lt;br /&gt;
    if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find...&lt;br /&gt;
    elsif match = /find_or_create_by_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find_or_create...&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Considerations==&lt;br /&gt;
&lt;br /&gt;
===Drawbacks===&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods&amp;lt;ref&amp;gt; method_missing: price to pay you http://www.alef1.org/ruby/method_missing/ &amp;lt;/ref&amp;gt;. Ruby looks for it in the receiving object's class first. If it doesn't find the method there, it looks for it in the superclass, and then the superclass and the superclass, and so on, until it eventually reaches the top of the chain (Object in Ruby 1.8, BasicObject in Ruby 1.9).&amp;lt;ref&amp;gt;[3] Method missing in Ruby. Does it make execution of functions in a Rails app any faster. http://www.coderanch.com/t/489410/Ruby/Method-missing-Ruby-Does-it&amp;lt;/ref&amp;gt; Only then, if it still didn't find the method, does Ruby get down in the receiver's class again to look for a method_missing. So, method_missing is generally slower than a regular method.Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. &lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
===Relationship to respond_to?===&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method &amp;lt;ref&amp;gt;Various imlementations in other languages http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html &amp;lt;/ref&amp;gt;.   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object &amp;lt;ref&amp;gt;Javascript documentation https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod&amp;lt;/ref&amp;gt; method, but it is not a JavaScript standard.&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
==External Links==&lt;br /&gt;
[[http://www.thirdbit.net/articles/2007/08/01/10-things-you-should-know-about-method_missing/ 10 Things you should know about method-missing]]&lt;br /&gt;
&lt;br /&gt;
[[http://www.alef1.org/ruby/method_missing/ method_missing, the price to pay]]&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51877</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51877"/>
		<updated>2011-10-07T02:36:24Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Method missing is very powerful and widely used in Ruby on Rails. As one of the dynamic features of Ruby, it is a way of intercepting calls to methods that haven't been defined, which would otherwise raise a NoMethodError. The functionality of method missing is one of the core ingredients of cleanly designed Ruby programs.&amp;lt;ref&amp;gt;Method Missing http://contextr.rubyforge.org/test/method_missing.html&amp;lt;/ref&amp;gt; It is still possible to extend it with context-dependent behavior.&lt;br /&gt;
&lt;br /&gt;
This feature is not unique to Ruby. It also exists in Smalltalk, Python, Groovy, some JavaScripts, and even most CLOS extensions have it.&lt;br /&gt;
&lt;br /&gt;
==Why it is used==&lt;br /&gt;
When we send a message to an object, the object executes the first method it finds on its method lookup path with the same name as the message. If it fails to find any such method, it raises a NoMethodError exception - unless you have provided the object with the method_missing.&amp;lt;ref&amp;gt;Ruby Method Missing http://rubylearning.com/satishtalim/ruby_method_missing.html&amp;lt;/ref&amp;gt; The method_missing method is passed the symbol of the non-existent method, an array of the arguments that were passed in the original call and any block passed to the original method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How it is used==&lt;br /&gt;
When we call a method that doesn't exist, Ruby looks for it in the receiving object's class first. If it doesn't find the method there, it looks for it in the superclass, and then the superclass and the superclass, and so on, until it eventually reaches the top of the chain (Object in Ruby 1.8, BasicObject in Ruby 1.9).&amp;lt;ref&amp;gt;[3] Method missing in Ruby. Does it make execution of functions in a Rails app any faster. http://www.coderanch.com/t/489410/Ruby/Method-missing-Ruby-Does-it&amp;lt;/ref&amp;gt; Only then, if it still didn't find the method, does Ruby get down in the receiver's class again to look for a method_missing. So, method_missing is generally slower than a regular method.&lt;br /&gt;
&lt;br /&gt;
===Adding better debug information on failure===&lt;br /&gt;
One of the most simple but still very powerful ways of using method_missing is to allow it to include more information in the error message.&amp;lt;ref&amp;gt;Patterns of method missing http://ruby.dzone.com/news/patterns-method-missing&amp;lt;/ref&amp;gt; Here is a simple example:&lt;br /&gt;
  class MyFoo&lt;br /&gt;
    def method_missing(method, *args, &amp;amp;block)&lt;br /&gt;
      raise NoMethodError, &amp;lt;&amp;lt;ERRORINFO&lt;br /&gt;
  method: #{method}&lt;br /&gt;
  args: #{args.inspect}&lt;br /&gt;
  on: #{self.to_yaml}&lt;br /&gt;
  ERRORINFO&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
===Other patterns of method missing===&lt;br /&gt;
There are many other patterns of method_missing. For example, using Ruby’s blocks and method_missing to make it easy to create any kind of output structure, like XML, HTML, graphical UIs and other hierarchical data structures, to lend themselves very well to the builder pattern. By using method_missing, all kinds of test helpers, which can be used to implement factories, delegate and do all kinds of things, are able to be created.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
===Roman Numerals===&lt;br /&gt;
The classic example for missing_method, given in the Ruby Docs:&amp;lt;ref&amp;gt;Ruby Docs: Object.missing_method http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing &amp;lt;/ref&amp;gt;&lt;br /&gt;
  class Roman&lt;br /&gt;
    def romanToInt(str)&lt;br /&gt;
      # ...&lt;br /&gt;
    end&lt;br /&gt;
    def method_missing(methId)&lt;br /&gt;
      str = methId.id2name&lt;br /&gt;
      romanToInt(str)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  r = Roman.new&lt;br /&gt;
  r.iv	»	4&lt;br /&gt;
  r.xxiii	»	23&lt;br /&gt;
  r.mm	»	2000&lt;br /&gt;
&lt;br /&gt;
The Roman class has no .iv or .xxiii methods, but the method_missing method turns the message into a string with id2name (which takes symbols and returns them as strings), and passes it to the romanToInt. This example shows how method_missing can make the Ruby language very flexible.&lt;br /&gt;
&lt;br /&gt;
===method_missing in Rails===&lt;br /&gt;
Rails, like many domain specific languages of Ruby, makes heavy use of the method_missing function.  A prominent example is ActiveRecord, where dynamic finders are implemented using method_missing. When a call like find_by_username is called from an ActiveRecord object, the method does not explicitly exist, rather the message is picked apart in [https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb#L1053 ActiveRecord's Base::method_missing] method. The variable part of the message, in this case &amp;quot;username&amp;quot; is turned into an argument to the find method, which is defined. The code below is not exactly what is in the method itself, but outlines what actually happens after calls to helper other methods:&amp;lt;ref&amp;gt;How dynamic finders work http://blog.hasmanythrough.com/2006/8/13/how-dynamic-finders-work &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method_id, *arguments)&lt;br /&gt;
    if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find...&lt;br /&gt;
    elsif match = /find_or_create_by_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find_or_create...&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Considerations==&lt;br /&gt;
&lt;br /&gt;
===Drawbacks===&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. &amp;lt;ref&amp;gt; method_missing: price to pay you http://www.alef1.org/ruby/method_missing/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
===Relationship to respond_to?===&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method &amp;lt;ref&amp;gt;Various imlementations in other languages http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html &amp;lt;/ref&amp;gt;.   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object &amp;lt;ref&amp;gt;Javascript documentation https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod&amp;lt;/ref&amp;gt; method, but it is not a JavaScript standard.&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
==External Links==&lt;br /&gt;
[[http://www.thirdbit.net/articles/2007/08/01/10-things-you-should-know-about-method_missing/ 10 Things you should know about method-missing]]&lt;br /&gt;
&lt;br /&gt;
[[http://www.alef1.org/ruby/method_missing/ method_missing, the price to pay]]&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51772</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51772"/>
		<updated>2011-10-06T23:16:15Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==Examples==&lt;br /&gt;
===Roman Numerals===&lt;br /&gt;
The classic example for missing_method, given in the Ruby Docs:&amp;lt;ref&amp;gt;Ruby Docs: Object.missing_method http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing &amp;lt;/ref&amp;gt;&lt;br /&gt;
  class Roman&lt;br /&gt;
    def romanToInt(str)&lt;br /&gt;
      # ...&lt;br /&gt;
    end&lt;br /&gt;
    def method_missing(methId)&lt;br /&gt;
      str = methId.id2name&lt;br /&gt;
      romanToInt(str)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  r = Roman.new&lt;br /&gt;
  r.iv	»	4&lt;br /&gt;
  r.xxiii	»	23&lt;br /&gt;
  r.mm	»	2000&lt;br /&gt;
&lt;br /&gt;
The Roman class has no .iv or .xxiii methods, but the method_missing method turns the message into a string with id2name (which takes symbols and returns them as strings), and passes it to the romanToInt. This example shows how method_missing can make the Ruby language very flexible.&lt;br /&gt;
&lt;br /&gt;
===method_missing in Rails===&lt;br /&gt;
Rails, like many domain specific languages of Ruby, makes heavy use of the method_missing function.  A prominent example is ActiveRecord, where dynamic finders are implemented using method_missing. When a call like find_by_username is called from an ActiveRecord object, the method does not explicitly exist, rather the message is picked apart in [https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb#L1053 ActiveRecord's Base::method_missing] method. The variable part of the message, in this case &amp;quot;username&amp;quot; is turned into an argument to the find method, which is defined. The code below is not exactly what is in the method itself, but outlines what actually happens after calls to helper other methods:&amp;lt;ref&amp;gt;How dynamic finders work http://blog.hasmanythrough.com/2006/8/13/how-dynamic-finders-work &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method_id, *arguments)&lt;br /&gt;
    if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find...&lt;br /&gt;
    elsif match = /find_or_create_by_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find_or_create...&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Considerations==&lt;br /&gt;
&lt;br /&gt;
===Drawbacks===&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. &amp;lt;ref&amp;gt; method_missing: price to pay you http://www.alef1.org/ruby/method_missing/ &amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
===Relationship to respond_to?===&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method &amp;lt;ref&amp;gt;Various imlementations in other languages http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html &amp;lt;/ref&amp;gt;.   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object &amp;lt;ref&amp;gt;Javascript documentation https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod&amp;lt;/ref&amp;gt; method, but it is not a JavaScript standard.&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
==External Links==&lt;br /&gt;
[[http://www.thirdbit.net/articles/2007/08/01/10-things-you-should-know-about-method_missing/ 10 Things you should know about method-missing]]&lt;br /&gt;
&lt;br /&gt;
[[http://www.alef1.org/ruby/method_missing/ method_missing, the price to pay]]&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51769</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51769"/>
		<updated>2011-10-06T23:00:03Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==Examples==&lt;br /&gt;
===Roman Numerals===&lt;br /&gt;
The classic example for missing_method, given in the Ruby Docs [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing]: &lt;br /&gt;
  class Roman&lt;br /&gt;
    def romanToInt(str)&lt;br /&gt;
      # ...&lt;br /&gt;
    end&lt;br /&gt;
    def method_missing(methId)&lt;br /&gt;
      str = methId.id2name&lt;br /&gt;
      romanToInt(str)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
  r = Roman.new&lt;br /&gt;
  r.iv	»	4&lt;br /&gt;
  r.xxiii	»	23&lt;br /&gt;
  r.mm	»	2000&lt;br /&gt;
&lt;br /&gt;
The Roman class has no .iv or .xxiii methods, but the method_missing method turns the message into a string with id2name (which takes symbols and returns them as strings), and passes it to the romanToInt. This example shows how method_missing can make the Ruby language very flexible.&lt;br /&gt;
&lt;br /&gt;
===method_missing in Rails===&lt;br /&gt;
Rails, like many domain specific languages of Ruby, makes heavy use of the method_missing function.  A prominent example is ActiveRecord, where dynamic finders are implemented using method_missing. When a call like find_by_username is called from an ActiveRecord object, the method does not explicitly exist, rather the message is picked apart in [https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb#L1053 ActiveRecord's Base::method_missing] method. The variable part of the message, in this case &amp;quot;username&amp;quot; is turned into an argument to the find method, which is defined. The code below is not exactly what is in the method itself, but outlines what actually happens after calls to helper other methods:&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method_id, *arguments)&lt;br /&gt;
    if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find...&lt;br /&gt;
    elsif match = /find_or_create_by_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find_or_create...&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Considerations==&lt;br /&gt;
&lt;br /&gt;
===Drawbacks===&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. [http://www.alef1.org/ruby/method_missing/] &lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
===Relationship to respond_to?===&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method [http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html].   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object [https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod] method, but it is not a JavaScript standard.&lt;br /&gt;
==External Links==&lt;br /&gt;
[[http://www.thirdbit.net/articles/2007/08/01/10-things-you-should-know-about-method_missing/ 10 Things you should know about method-missing]]&lt;br /&gt;
&lt;br /&gt;
[[http://www.alef1.org/ruby/method_missing/ method_missing, the price to pay]]&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51768</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51768"/>
		<updated>2011-10-06T22:51:32Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
=Examples=&lt;br /&gt;
==Roman Numerals==&lt;br /&gt;
The classic example for missing_method, given in the Ruby Docs [http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing]: &lt;br /&gt;
  class Roman&lt;br /&gt;
    def romanToInt(str)&lt;br /&gt;
      # ...&lt;br /&gt;
    end&lt;br /&gt;
    def method_missing(methId)&lt;br /&gt;
      str = methId.id2name&lt;br /&gt;
      romanToInt(str)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  r = Roman.new&lt;br /&gt;
Output&lt;br /&gt;
  r.iv	»	4&lt;br /&gt;
  r.xxiii	»	23&lt;br /&gt;
  r.mm	»	2000&lt;br /&gt;
&lt;br /&gt;
The Roman class has no .iv or .xxiii methods, but the method_missing method turns the message into a string with id2name (which takes symbols and returns them as strings), and passes it to the romanToInt. This example shows how method_missing can make the Ruby language very flexible.&lt;br /&gt;
&lt;br /&gt;
==method_missing in Rails==&lt;br /&gt;
Rails, like many domain specific languages of Ruby, makes heavy use of the method_missing function.  A prominent example is ActiveRecord, where dynamic finders are implemented using method_missing. When a call like find_by_username is called from an ActiveRecord object, the method does not explicitly exist, rather the message is picked apart in [https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb#L1053 ActiveRecord's Base::method_missing] method. The variable part of the message, in this case &amp;quot;username&amp;quot; is turned into an argument to the find method, which is defined. The code below is not exactly what is in the method itself, but outlines what actually happens after calls to helper other methods:&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method_id, *arguments)&lt;br /&gt;
    if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find...&lt;br /&gt;
    elsif match = /find_or_create_by_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find_or_create...&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Considerations=&lt;br /&gt;
&lt;br /&gt;
==Drawbacks==&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. [http://www.alef1.org/ruby/method_missing/] &lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
==Relationship to respond_to?==&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method [http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html].   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object [https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod] method, but it is not a JavaScript standard.&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51766</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51766"/>
		<updated>2011-10-06T22:45:26Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
=Examples=&lt;br /&gt;
==Roman Numerals==&lt;br /&gt;
==method_missing in Rails==&lt;br /&gt;
Rails, like many domain specific languages of Ruby, makes heavy use of the method_missing function.  A prominent example is ActiveRecord, where dynamic finders are implemented using method_missing. When a call like find_by_username is called from an ActiveRecord object, the method does not explicitly exist, rather the message is picked apart in [https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb#L1053 ActiveRecord's Base::method_missing] method. The variable part of the message, in this case &amp;quot;username&amp;quot; is turned into an argument to the find method, which is defined. The code below is not exactly what is in the method itself, but outlines what actually happens after calls to helper other methods:&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method_id, *arguments)&lt;br /&gt;
    if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find...&lt;br /&gt;
    elsif match = /find_or_create_by_([_a-zA-Z]\w*)/.match(method_id.to_s)&lt;br /&gt;
      # find_or_create...&lt;br /&gt;
    else&lt;br /&gt;
      super&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Considerations=&lt;br /&gt;
&lt;br /&gt;
==Drawbacks==&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. [http://www.alef1.org/ruby/method_missing/] &lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
==Relationship to respond_to?==&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method [http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html].   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object [https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod] method, but it is not a JavaScript standard.&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51760</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51760"/>
		<updated>2011-10-06T22:36:23Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
=Considerations=&lt;br /&gt;
&lt;br /&gt;
==   Drawbacks==&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. [http://www.alef1.org/ruby/method_missing/] &lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
==Relationship to respond_to?==&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method [http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html]   Firefox's JavaScript implementation now supports a similar __noSuchMethod__ object. [https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod] method, but it is not a JavaScript standard.&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51759</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51759"/>
		<updated>2011-10-06T22:32:11Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
=Considerations=&lt;br /&gt;
&lt;br /&gt;
==   Drawbacks==&lt;br /&gt;
&lt;br /&gt;
All else being equal, method_missing is less efficient at runtime than normally defined methods. Besides the fact that the missing_method will need additional checks to determine the next course of action, method_missing is always the last place the ruby interpreter looks. [http://www.alef1.org/ruby/method_missing/] &lt;br /&gt;
&lt;br /&gt;
Method_missing can make the code more difficult for humans to follow. It is also does not work well with autocomplete and other features of IDE's or editors.  &lt;br /&gt;
&lt;br /&gt;
All of these things should be considered when deciding whether to rely on method_missing.&lt;br /&gt;
&lt;br /&gt;
==Relationship to respond_to?==&lt;br /&gt;
Ruby objects also have a method called respond_to? which checks to see that a given message corresponds to a method of the class. By default, it will only look for explicitly defined methods. If none are found, it has no mechanism to check whether it is handled by method_missing. This issue is important to consider if the class or its children ever need the respond_to? method. It is good practice to always override the respond_to? method when using method_missing in a class that might be subclassed.&lt;br /&gt;
In the stub below, we add a respond_to to the [[Roman Numerals]] class. &lt;br /&gt;
  class Roman&lt;br /&gt;
    def respond_to?&lt;br /&gt;
      if method_sym.to_s =~ ... // regex to see if it's a valid roman numeral&lt;br /&gt;
        true&lt;br /&gt;
      else&lt;br /&gt;
        super&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
  end&lt;br /&gt;
==Similar functionality in other languages==&lt;br /&gt;
&lt;br /&gt;
The method_missing class is defined in the Object class, so it is inherited by all objects. It raises a NoMethodError by default.&lt;br /&gt;
&lt;br /&gt;
There are no similar methods in statically typed languages like Java or C++. Python does not have an equivalent method either, though it can be simulated using the __getattr__ method [http://langexplr.blogspot.com/2008/02/handling-call-to-missing-method-in_06.html]   Firefox's javascript implementation now supports a similar NoMethodFound [2] method, but it is not a javascript standard.&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51729</id>
		<title>CSC/ECE 517 Fall 2011/ch3 3i ws</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch3_3i_ws&amp;diff=51729"/>
		<updated>2011-10-06T04:07:53Z</updated>

		<summary type="html">&lt;p&gt;Orsevin: Created page with &amp;quot;s&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;s&lt;/div&gt;</summary>
		<author><name>Orsevin</name></author>
	</entry>
</feed>