<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="it">
	<id>http://wiki.netsitech.com/index.php?action=history&amp;feed=atom&amp;title=Programmazione%3AJava%2FSingleton_with_interface</id>
	<title>Programmazione:Java/Singleton with interface - Cronologia</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.netsitech.com/index.php?action=history&amp;feed=atom&amp;title=Programmazione%3AJava%2FSingleton_with_interface"/>
	<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;action=history"/>
	<updated>2026-05-05T01:16:09Z</updated>
	<subtitle>Cronologia della pagina su questo sito</subtitle>
	<generator>MediaWiki 1.34.4</generator>
	<entry>
		<id>http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;diff=2785&amp;oldid=prev</id>
		<title>Rimondini il 08:31, 14 apr 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;diff=2785&amp;oldid=prev"/>
		<updated>2008-04-14T08:31:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;it&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Versione meno recente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Versione delle 08:31, 14 apr 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Riga 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Riga 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Programmazione:Java|&amp;lt;&amp;lt; Back to Java]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Generalmente i singleton vengono gestisti con la classica '''proprietà statica''' in combinazione con la funzione statica '''getInstance''':&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Generalmente i singleton vengono gestisti con la classica '''proprietà statica''' in combinazione con la funzione statica '''getInstance''':&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rimondini</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;diff=2533&amp;oldid=prev</id>
		<title>Rimondini il 08:44, 26 mar 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;diff=2533&amp;oldid=prev"/>
		<updated>2008-03-26T08:44:28Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;it&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Versione meno recente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Versione delle 08:44, 26 mar 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot; &gt;Riga 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Riga 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;questo codice però fa si che ogni volta che è necessario utilizzare questo oggetto vi si acceda tramite una funzione. Oltre a questo, quando &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;però &lt;/del&gt;il codice che &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;utilizza questi &lt;/del&gt;singleton diventa abbastanza esteso, necessariamente &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;si &lt;/del&gt;riduce la fattibilità di '''refactoring''' &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;futuri&lt;/del&gt;, dovendo modificare ogni singolo punto in cui si accede &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ai singleton&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;questo codice però fa si che ogni volta che è necessario utilizzare questo oggetto vi si acceda tramite una funzione. Oltre a questo, quando il codice che &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;accede al &lt;/ins&gt;singleton diventa abbastanza esteso, necessariamente riduce la fattibilità di '''refactoring''', dovendo modificare ogni singolo punto in cui si accede &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;all'oggetto&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Per ovviare a questi due problemi è possibile utilizzare un'interfaccia come entry point del singleton:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Per ovviare a questi due problemi è possibile utilizzare un'interfaccia come entry point del singleton:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rimondini</name></author>
		
	</entry>
	<entry>
		<id>http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;diff=2532&amp;oldid=prev</id>
		<title>Rimondini: Nuova pagina: Generalmente i singleton vengono gestisti con la classica '''proprietà statica''' in combinazione con la funzione statica '''getInstance''':  &lt;code java&gt; public class Singleton {    p...</title>
		<link rel="alternate" type="text/html" href="http://wiki.netsitech.com/index.php?title=Programmazione:Java/Singleton_with_interface&amp;diff=2532&amp;oldid=prev"/>
		<updated>2008-03-26T08:42:45Z</updated>

		<summary type="html">&lt;p&gt;Nuova pagina: Generalmente i singleton vengono gestisti con la classica &amp;#039;&amp;#039;&amp;#039;proprietà statica&amp;#039;&amp;#039;&amp;#039; in combinazione con la funzione statica &amp;#039;&amp;#039;&amp;#039;getInstance&amp;#039;&amp;#039;&amp;#039;:  &amp;lt;code java&amp;gt; public class Singleton {    p...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nuova pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Generalmente i singleton vengono gestisti con la classica '''proprietà statica''' in combinazione con la funzione statica '''getInstance''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
public class Singleton {&lt;br /&gt;
   protected static Singleton self;&lt;br /&gt;
   &lt;br /&gt;
   protected Singleton() {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public static Singleton getInstance() {&lt;br /&gt;
      if(self == null) {&lt;br /&gt;
         self = new Singleton();&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public void addProp(String prop, Object value) {&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
Singleton.getInstance().addProp(&amp;quot;PROP&amp;quot;, null); // modalità d'accesso al singleton&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
questo codice però fa si che ogni volta che è necessario utilizzare questo oggetto vi si acceda tramite una funzione. Oltre a questo, quando però il codice che utilizza questi singleton diventa abbastanza esteso, necessariamente si riduce la fattibilità di '''refactoring''' futuri, dovendo modificare ogni singolo punto in cui si accede ai singleton.&lt;br /&gt;
&lt;br /&gt;
Per ovviare a questi due problemi è possibile utilizzare un'interfaccia come entry point del singleton:&lt;br /&gt;
{| cellspacing=15 width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|width=&amp;quot;50%&amp;quot;|&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
public interface ISingleton {&lt;br /&gt;
   ISingleton self = new Singleton();&lt;br /&gt;
&lt;br /&gt;
   void addProp(String prop, Object value);   &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
|width=&amp;quot;50%&amp;quot;|&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
public class Singleton implements ISingleton {&lt;br /&gt;
   public Singleton() {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public void addProp(String prop, Object value) {&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code java&amp;gt;&lt;br /&gt;
ISingleton.instance.addProp(&amp;quot;PROP&amp;quot;, null); // modalità d'accesso al singleton&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Facendo in questo modo ci si slega completamente dall'implementazione del singleton ed è possibile in ogni momento sostituirla con un'altra implementazione. Per di più l'accesso è più veloce, dato che si accede tramite una proprietà e non un metodo.&lt;/div&gt;</summary>
		<author><name>Rimondini</name></author>
		
	</entry>
</feed>