<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://95.179.246.60/mediawiki/index.php?action=history&amp;feed=atom&amp;title=The_Dependency_Mechanism_-_part_2</id>
	<title>The Dependency Mechanism - part 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://95.179.246.60/mediawiki/index.php?action=history&amp;feed=atom&amp;title=The_Dependency_Mechanism_-_part_2"/>
	<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=The_Dependency_Mechanism_-_part_2&amp;action=history"/>
	<updated>2026-05-08T12:47:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>http://95.179.246.60/mediawiki/index.php?title=The_Dependency_Mechanism_-_part_2&amp;diff=183&amp;oldid=prev</id>
		<title>Nmingott: imported material</title>
		<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=The_Dependency_Mechanism_-_part_2&amp;diff=183&amp;oldid=prev"/>
		<updated>2025-05-12T20:42:13Z</updated>

		<summary type="html">&lt;p&gt;imported material&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* In &amp;#039;&amp;#039;&amp;#039;Cuis-6&amp;#039;&amp;#039;&amp;#039; there isn&amp;#039;t anymore a &amp;#039;&amp;#039;&amp;#039;Model&amp;#039;&amp;#039;&amp;#039;, there instead an &amp;#039;&amp;#039;&amp;#039;ActiveModel&amp;#039;&amp;#039;&amp;#039; class, but the name &amp;#039;model&amp;#039; a very frequent in the code. You can still find &amp;#039;&amp;#039;&amp;#039;Model&amp;#039;&amp;#039;&amp;#039; in &amp;#039;&amp;#039;&amp;#039;Squeak-5.3&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;VisualWorks-8.3&amp;#039;&amp;#039;&amp;#039; if you wish to check out some implementation.&lt;br /&gt;
* We have seen (here) how to manage Dependency with the Parent / Dependent strategy. But where do all the relations involving objects are stored ?&lt;br /&gt;
* There relations are stored by default in the class variable &amp;#039;&amp;#039;&amp;#039;DependentsFields&amp;#039;&amp;#039;&amp;#039; of the class &amp;#039;&amp;#039;&amp;#039;Object&amp;#039;&amp;#039;&amp;#039; which is a specialized dictionary, where at every key corresponds an object who is Parent and its values are a list of Dependents objects.&lt;br /&gt;
* You can well understand that if there are a lot of dependencies the dictionary in DependentsFields becomes very large and also, there is another problem. If a dependent lost all references in the VM except for a forgotten relationship link in DependentsFields it will stay there and will not be garbage collected.&lt;br /&gt;
* To avoid these two problems, and for performance reasons, it was introduced the class &amp;#039;&amp;#039;&amp;#039;Model&amp;#039;&amp;#039;&amp;#039; which is a subclass of &amp;#039;&amp;#039;&amp;#039;Object&amp;#039;&amp;#039;&amp;#039; and a has an instance variable field called &amp;lt;code&amp;gt;dependents&amp;lt;/code&amp;gt; where all the dependents are stored.&lt;br /&gt;
* In this way, if &amp;#039;&amp;#039;&amp;#039;objA&amp;#039;&amp;#039;&amp;#039; is a intended to be a Parent and you make it as a &amp;#039;&amp;#039;&amp;#039;Model&amp;#039;&amp;#039;&amp;#039; subclass instance,  all its depency relationships will be localized into &amp;#039;&amp;#039;&amp;#039;objA&amp;#039;&amp;#039;&amp;#039; itself avoiding a large centralized permanent dictionary and also, once you delete &amp;#039;&amp;#039;&amp;#039;objA&amp;#039;&amp;#039;&amp;#039;, you are sure all its dependents will be free to be garbage collected, when necessary.&lt;/div&gt;</summary>
		<author><name>Nmingott</name></author>
	</entry>
</feed>