<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    <title>Devia News</title>
    <link>http://www.devia.be/news</link>
    <description>Devia news</description>
    <dc:language>en</dc:language>
    <dc:creator>Stefaan.Lesage@pandora.be</dc:creator>
    <dc:rights>Copyright 2010</dc:rights>
    <dc:date>2010-03-30T13:55:53+00:00</dc:date>
    <admin:generatorAgent rdf:resource="http://www.expressionengine.com/" />
    

    <item>
      <title>Simplify your Delphi Code using some basic rules, OO techniques and some refactoring (Part 4)</title>
      <link>http://www.devia.be/news/article/delphi-code-using-some-basic-rules-oo-techniques-refactoring-part-4/</link>
      <guid>http://www.devia.be/news/article/delphi-code-using-some-basic-rules-oo-techniques-refactoring-part-4/#When:12:55:53Z</guid>
      <description>Part 4 in the series.  Actually it&#39;s the rest of Part 3, since for some strange reason I couldn&#39;t get it into a single post.</description>
      <dc:subject>Software DevelopmentWindowsDelphi</dc:subject>
      <content:encoded><![CDATA[Part 4 in the series.  Actually it's the rest of Part 3, since for some strange reason I couldn't get it into a single post.<h3>Continued</h3>

<p>Since for some strange reason I couldn't fit everything in a single post, I had to split it up, so this is the rest of it</p>

<h4>The TdvStringSetting class</h4>

<h5>The explanation</h5>

<p>Basically the TdvSetting provides us with a skeleton we can use for our new Setting descendants.  I ended up with a TdvStringSetting, TdvIntegerSetting, TdvBooleanSetting and quite a few others, but lets start with the TdvStringSetting first.</p>

<h5>The Code</h5>

<pre>
<code><span style="font: 10pt Courier New;"><span class="pas1-space">  TdvStringSetting </span><span class="pas1-symbol">=</span><span class="pas1-space"> </span><span class="pas1-reservedword">class</span><span class="pas1-symbol">(</span><span class="pas1-space"> TdvSetting </span><span class="pas1-symbol">)
</span><span class="pas1-space">  </span><span class="pas1-reservedword">private
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetDefaultValueAsString</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">protected
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsBoolean</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsDateTime</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsFloat</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsInteger</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsString</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsVariant</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetValue</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">var</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">):</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsBoolean</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsDateTime</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsFloat</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsInteger</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> aValue</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetVarValue</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> aValue</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">public
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SaveToRegIni  </span><span class="pas1-symbol">(</span><span class="pas1-space"> aRegIni </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> LoadFromRegIni</span><span class="pas1-symbol">(</span><span class="pas1-space"> aRegIni </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> DefaultValue  </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space">       </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetDefaultValueAsString</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> Value         </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-space">       </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsString
                                          </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsString</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

...

</span><span class="pas1-comment">{ TdvStringSetting }

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsBoolean</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  S</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  S </span><span class="pas1-symbol">:=</span><span class="pas1-space"> GetAsString</span><span class="pas1-symbol">;
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-identifier">Length</span><span class="pas1-symbol">(</span><span class="pas1-identifier">S</span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-symbol">&gt;</span><span class="pas1-space"> </span><span class="pas1-number">0</span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">and</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-identifier">S</span><span class="pas1-symbol">[</span><span class="pas1-number">1</span><span class="pas1-symbol">]</span><span class="pas1-space"> </span><span class="pas1-reservedword">in</span><span class="pas1-space"> </span><span class="pas1-symbol">[</span><span class="pas1-string">'T'</span><span class="pas1-symbol">,</span><span class="pas1-space"> </span><span class="pas1-string">'t'</span><span class="pas1-symbol">,</span><span class="pas1-space"> </span><span class="pas1-string">'Y'</span><span class="pas1-symbol">,</span><span class="pas1-space"> </span><span class="pas1-string">'y'</span><span class="pas1-symbol">]);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsDateTime</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> StrToDateTime</span><span class="pas1-symbol">(</span><span class="pas1-identifier">GetAsString</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsFloat</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> StrToFloat</span><span class="pas1-symbol">(</span><span class="pas1-identifier">GetAsString</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsInteger</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> StrToInt</span><span class="pas1-symbol">(</span><span class="pas1-identifier">GetAsString</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsString</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">if</span><span class="pas1-space"> </span><span class="pas1-reservedword">not</span><span class="pas1-space"> GetValue</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Result</span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">then</span><span class="pas1-space"> Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-string">''</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsVariant</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  S</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">if</span><span class="pas1-space"> GetValue</span><span class="pas1-symbol">(</span><span class="pas1-identifier">S</span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">then</span><span class="pas1-space"> Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> S </span><span class="pas1-reservedword">else</span><span class="pas1-space"> Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Null</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetDefaultValueAsString</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> FDefaultValue</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetValue</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">var</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">):</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Value  </span><span class="pas1-symbol">:=</span><span class="pas1-space"> FValue</span><span class="pas1-symbol">;
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> True</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">LoadFromRegIni</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aRegIni</span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> LoadFromRegIni</span><span class="pas1-symbol">(</span><span class="pas1-space"> aRegIni</span><span class="pas1-symbol">,</span><span class="pas1-space"> aSection </span><span class="pas1-symbol">);

</span><span class="pas1-space">  Value </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aRegIni</span><span class="pas1-symbol">.</span><span class="pas1-identifier">ReadString</span><span class="pas1-symbol">(</span><span class="pas1-space"> aSection</span><span class="pas1-symbol">,</span><span class="pas1-space"> Identifier</span><span class="pas1-symbol">,</span><span class="pas1-space"> DefaultValue </span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SaveToRegIni</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aRegIni</span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> SaveToRegIni</span><span class="pas1-symbol">(</span><span class="pas1-space"> aRegIni</span><span class="pas1-symbol">,</span><span class="pas1-space"> aSection </span><span class="pas1-symbol">);

</span><span class="pas1-space">  aRegIni</span><span class="pas1-symbol">.</span><span class="pas1-identifier">WriteString</span><span class="pas1-symbol">(</span><span class="pas1-space"> aSection</span><span class="pas1-symbol">,</span><span class="pas1-space"> Identifier</span><span class="pas1-symbol">,</span><span class="pas1-space"> Value </span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsBoolean</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">const
</span><span class="pas1-space">  Values</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">array</span><span class="pas1-symbol">[</span><span class="pas1-identifier">Boolean</span><span class="pas1-symbol">]</span><span class="pas1-space"> </span><span class="pas1-reservedword">of</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">[</span><span class="pas1-number">1</span><span class="pas1-symbol">]</span><span class="pas1-space"> </span><span class="pas1-symbol">=</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-string">'F'</span><span class="pas1-symbol">,</span><span class="pas1-space"> </span><span class="pas1-string">'T'</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Values</span><span class="pas1-symbol">[</span><span class="pas1-identifier">Value</span><span class="pas1-symbol">]);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsDateTime</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-identifier">DateTimeToStr</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Value</span><span class="pas1-symbol">));
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsFloat</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-identifier">FloatToStr</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Value</span><span class="pas1-symbol">));
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsInteger</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-identifier">IntToStr</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Value</span><span class="pas1-symbol">));
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> aValue</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  FValue </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aValue</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvStringSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetVarValue</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> aValue</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aValue</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;


</span></span>
</code></pre>

<h5>What does it do ?</h5>

<p>Since we had the skeleton of the TdvSetting in place, the only thing we needed to do was to override the necessary methods and implement our own features.  As you can see, we added approximately the same code as can be found in the TStringField in the VCL.</p>

<p>The only additional code is the implementation of the SaveToRegIni and LoadFromRegIni methods.  These methods will actually load and save the value of the Setting to the Registry.  Additionally when loading the value we will be using the Default value if the setting can't be found in the regsitry.  The Section where we will read / write the value can be supplied to the method and we will be using the identifier (name) of the setting as the key</p>

<h4>Creating the TdvSettings class</h4>

<h5>The explanation</h5>

<p>Well, now that we can make different type of Setting objects, we also need some kind of container to hold them.  For example our application might have quite a few settings : PrintInColor, CheckForUpdates, AutoConnect, ... but we will need some way to access them.  As mentioned before I created the TdvSettings class as a simple TObjectList.  It will hold a reference to the individual TdvSetting objects and we will be able to access them</p>

<h5>The Code</h5>

<pre>
<code><span style="font: 10pt Courier New;"><span class="pas1-space">  TdvSettings </span><span class="pas1-symbol">=</span><span class="pas1-space"> </span><span class="pas1-reservedword">class</span><span class="pas1-symbol">(</span><span class="pas1-space"> TObjectList </span><span class="pas1-symbol">)
</span><span class="pas1-space">  </span><span class="pas1-reservedword">private
</span><span class="pas1-space">    FRootKey</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">protected
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> CreateSettings</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetItems</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">):</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetItems</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;</span><span class="pas1-space"> ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">public
</span><span class="pas1-space">    </span><span class="pas1-reservedword">constructor</span><span class="pas1-space"> Create</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aRootKey </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-symbol">);

</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> Add</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> Extract</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Item</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> Remove</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> IndexOf</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> First</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> Last</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> SettingByIdentifier</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aIdentifier </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> LoadFromRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SaveToRegistry</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> Insert</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;</span><span class="pas1-space"> ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-reservedword">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">]:</span><span class="pas1-space"> TdvSetting </span><span class="pas1-reservedword">read</span><span class="pas1-space"> GetItems </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetItems</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">default</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> RootKey </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-reservedword">read</span><span class="pas1-space"> FRootKey </span><span class="pas1-reservedword">write</span><span class="pas1-space"> FRootKey</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-space">  </span><span class="pas1-symbol">...

</span><span class="pas1-comment">{ TdvSettings }

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Add</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Add</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">constructor</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> aRootKey</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Create</span><span class="pas1-symbol">(</span><span class="pas1-space"> True </span><span class="pas1-symbol">);
</span><span class="pas1-space">  FRootKey </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aRootKey</span><span class="pas1-symbol">;
</span><span class="pas1-space">  CreateSettings</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-comment">// Read the settings from the Registry once the Settings object list has
</span><span class="pas1-space">  </span><span class="pas1-comment">// been initialised.
</span><span class="pas1-space">  LoadFromRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">CreateSettings</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin

end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Extract</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Item</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Extract</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Item</span><span class="pas1-symbol">));
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">First</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> First</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetItems</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">):</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">]);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">IndexOf</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> IndexOf</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aSetting</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Insert</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;</span><span class="pas1-space"> ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Insert</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">,</span><span class="pas1-space"> aSetting</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Last</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Last</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">LoadFromRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  lIndex   </span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-space">  lSetting </span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-space">  lRegIni  </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  lRegIni </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">(</span><span class="pas1-string">''</span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">try
</span><span class="pas1-space">    </span><span class="pas1-reservedword">for</span><span class="pas1-space"> lIndex </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-number">0</span><span class="pas1-space"> </span><span class="pas1-reservedword">to</span><span class="pas1-space"> Pred</span><span class="pas1-symbol">(</span><span class="pas1-space"> Count </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">do
</span><span class="pas1-space">    </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">      lSetting </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-space"> lIndex </span><span class="pas1-symbol">];
</span><span class="pas1-space">      lSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">LoadFromRegIni</span><span class="pas1-symbol">(</span><span class="pas1-space"> lRegIni</span><span class="pas1-symbol">,</span><span class="pas1-space"> RootKey </span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">finally
</span><span class="pas1-space">    FreeAndNil</span><span class="pas1-symbol">(</span><span class="pas1-space"> lRegIni </span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Remove</span><span class="pas1-symbol">(</span><span class="pas1-identifier">ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">):</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Remove</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aSetting</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SaveToRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  lIndex   </span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-space">  lSetting </span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-space">  lRegIni  </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  lRegIni </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">(</span><span class="pas1-string">''</span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">try
</span><span class="pas1-space">    </span><span class="pas1-reservedword">for</span><span class="pas1-space"> lIndex </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-number">0</span><span class="pas1-space"> </span><span class="pas1-reservedword">to</span><span class="pas1-space"> Pred</span><span class="pas1-symbol">(</span><span class="pas1-space"> Count </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">do
</span><span class="pas1-space">    </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">      lSetting </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-space"> lIndex </span><span class="pas1-symbol">];
</span><span class="pas1-space">      lSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SaveToRegIni</span><span class="pas1-symbol">(</span><span class="pas1-space"> lRegIni</span><span class="pas1-symbol">,</span><span class="pas1-space"> RootKey </span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">finally
</span><span class="pas1-space">    FreeAndNil</span><span class="pas1-symbol">(</span><span class="pas1-space"> lRegIni </span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetItems</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;</span><span class="pas1-space"> ASetting</span><span class="pas1-symbol">:</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">inherited</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-identifier">Index</span><span class="pas1-symbol">]</span><span class="pas1-space"> </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aSetting</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SettingByIdentifier</span><span class="pas1-symbol">(
</span><span class="pas1-space">  </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aIdentifier</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">):</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  lcv </span><span class="pas1-symbol">:</span><span class="pas1-space"> Integer</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-reservedword">Nil</span><span class="pas1-symbol">;

</span><span class="pas1-space">  </span><span class="pas1-reservedword">for</span><span class="pas1-space"> lcv </span><span class="pas1-symbol">:=</span><span class="pas1-space"> </span><span class="pas1-number">0</span><span class="pas1-space"> </span><span class="pas1-reservedword">to</span><span class="pas1-space"> Pred</span><span class="pas1-symbol">(</span><span class="pas1-space"> Count </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">do
</span><span class="pas1-space">  </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">    </span><span class="pas1-reservedword">if</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-space"> lcv </span><span class="pas1-symbol">].</span><span class="pas1-identifier">Identifier </span><span class="pas1-symbol">=</span><span class="pas1-space"> aIdentifier </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">then
</span><span class="pas1-space">    </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">      Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Items</span><span class="pas1-symbol">[</span><span class="pas1-space"> lcv </span><span class="pas1-symbol">];
</span><span class="pas1-space">      Break</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span></span>
</code></pre>

<h5>What does it do ?</h5>

<p>Well, it is simply a container for a number of TdvSetting objects.  It has some basic code which will allow us to access the individual TdvSetting objects using their index or their Identifier (name).  We will be able to set the RootKey of the TdvSettings object and that is the base key which will be used when loading / storing the individual TdvSetting objects.</p>

<p>You willl notice that I added a CreateSettings method which is currently empty.  The goal is to implement this in descendant classes.  At the TdvSettings level we don't yet know which individual settings we will need, how they are called and what type they are ... Yet, I wanted to be able to create those settings from within the base class and once that is done read the settings if necessary.</p>

<p>In my TdvMyApplicationSettings I will override this method and add the necessary code to set up the individual TdvSetting objects I need for my applicaiton.</p>

<h3>What's next ?</h3>

<p>Currently we have a basic skeleton in place and we are able to continue from here.  If you're up for a challenge, you might want to create your own TdvSetting descendants.  I noticed I needed one for Integer values, DataTime values and Boolean values, so you could try to implement those.</p>

<p>As I mentioned at the end of the previous article, this isn't the only way, nor THE way to solve this problem, and I actually did try a few other approaches as well.  It did take me a few iterations to get to this stage.  For example, initial versions had the actual code for creating the TRegistryIniFile class inside the individual TdvSetting objects.</p>

<p>Quickly I noticed though that I had the exact same code in all my TdvSetting descendants LoadFromRegIni and SaveToRegIni methods so I started thinking again.  I thought that constructing & destroying the TRegistryIniFile might be something I don't want to execute for the 20 individual application settings so I ended up refactoring the code to it's current status</p>

<h3>Feedback</h3>

<p>I'm quite sure the code could be simplified and maybe improved, and I do welcome all suggestions and feedback.  So feel free to post all comments on this blog and I'll try to respond ASAP.  Maybe your feedback will shape the next article in this series ...</p>]]></content:encoded>
      <dc:date>2010-03-30T12:55:53+00:00</dc:date>
    </item>

    <item>
      <title>Simplify your Delphi Code using some basic rules, OO techniques and some refactoring (Part 3)</title>
      <link>http://www.devia.be/news/article/delphi-code-using-some-basic-rules-oo-techniques-refactoring-part-3/</link>
      <guid>http://www.devia.be/news/article/delphi-code-using-some-basic-rules-oo-techniques-refactoring-part-3/#When:12:37:15Z</guid>
      <description>Now that we have a basic idea of what we want to achieve and how we could do it, it&#39;s time to write some code and create some classes.</description>
      <dc:subject>Software DevelopmentWindowsDelphi</dc:subject>
      <content:encoded><![CDATA[Now that we have a basic idea of what we want to achieve and how we could do it, it's time to write some code and create some classes.<h3>Introduction</h3>

<p>So, basically we need a class / object which we can use to read and write some application settings from and to the Windows Registry.  Sounds pretty straightforward ... but we did some additional thinking and found out that we might need to add some stuff in the future.</p>

<h3>Basic Requirements of the code</h3>

<h4>Compatibility with Delphi 7</h4>

<p>Although quite a few new features were added to the language in the last years, we won't be using them 'yet'.  Our goal is that the code should compile / work under Delphi 7.</p>

<p>You may be asking yourselves "Who going though all that trouble for an old Delphi version ?", well I noticed that even today some of my clients still have older projects which get compiled in Delphi 7.  In later articles I might show you how to do it using some newer techniques, but for now lets just stick with something that will compile under Delphi 7</p>

<h4>Not limited to the Windows Registry</h4>

<p>Although we will be writing the code based on using the Windows Registry to Load and Save our data.  We want an easy way to adapt our code for some other things like storing the data in XML or an Ini file.  After all, we don't know what the future will bring yet.  We might be able to build applications for Windows Mobile, the Mac, iPhone or even iPad in the future (Would that be nice), and the  Windows Registry might not be available on those devices.</p>

<p>For now we will focus on the Windows Registry, but as you notice it is a good idea to keep a few other possibilities ready.  In the end, the only thing we care about is that we can store / load some settings.  How or where these settings are stored isn't all that important, it just needs to get done !</p>

<h4>Additional Things</h4>
	
<p>So far, we know we will need something to hold a set of settings.  We need to be able to load and save those settings.  We will probably be supplying a name for each individual setting, maybe even a default value and a description.  We need to be able to store Integers, Strings, but who knows even Passwords, Dates, ...</p>

<h3>Lets get Coding !</h3>

<h4>... well almost ...</h4>
<p>Well, ... actually before we start coding we could take a look at how some of these things get solved in the VCL.  Of course, we could do all the coding ourselves, but it might be a good idea to let our new classes inherit from some existing classes.  Since we need a list of things, you might want to take a look at the TList for example.</p>

<p>In my case, I knew I want to have a Setting which I will use to store Strings, one to store Integers and another one to store Booleans.  Once I had those, I quickly noticed I wanted some others for DateTime values and quite a few other things as well.  I actually ended up doing something quite similar to TField and TIntegerField, TStringField, ...</p>

<p>So, now that I know I will be using different types of Setting objects and I want to keep a list of those Setting Objects, I quickly decided that the TObjectList was a very good class to start with.</p>

<h4>Creating the TdvSetting class</h4>

<h5>The explanation</h5>

<p>Basically I need an object with a few properties like an Identifier (or Name, Caption), a Description (or Hint) and of course a Value.  I will need to be able to read the value from the Registry and write it to the registry.  Additionally when reading the value from the Registry I want to check if there is already something in the registry for the setting, and if nothing is found, the Default value should be used.</p>

<p>Just as with the TField and TStringField, I want to be able to get the Value of the TdvSetting as a String or as a Variant, so I added that code as well.  Additionally I want to set the value of the TdvSetting as well.  In the end, the descendant classes will implement most of this, but like with the TField in the VCL, I added some code which will raise an exception if a descendant class doens't implement a specific accessor.</p>

<p>This might sound a bit complex, but lets compare it with the TField and TStringField again.  With a TStringField, you can set the value using aField.Value := theValue or with aField.AsString := theValue.  Both things will work, but if aField is in instance of TField instead of TStringField an exception will be raised.  What I did was implement that functionality as well.</p>

<p>For now we will focus on the Windows Registry, but as you notice it is a good idea to keep a few other possibilities ready.  In the end, the only thing we care about is that we can store / load some settings.  How or where these settings are stored isn't all that important, it just needs to get done !</p>

<h5>The Code</h5>

<pre>
<code><span style="font: 10pt Courier New;"><span class="pas1-space">  TdvSetting </span><span class="pas1-symbol">=</span><span class="pas1-space"> </span><span class="pas1-reservedword">class</span><span class="pas1-symbol">(</span><span class="pas1-space"> TObject </span><span class="pas1-symbol">)
</span><span class="pas1-space">  </span><span class="pas1-reservedword">private
</span><span class="pas1-space">    FValue        </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">;
</span><span class="pas1-space">    FDefaultValue </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">;
</span><span class="pas1-space">    FIdentifier   </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-space">    FCaption      </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetCaption</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetVisible</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">protected
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsBoolean</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsDateTime</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsFloat</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsInteger</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsString</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> GetAsVariant</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsBoolean</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsDateTime</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetHint</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsFloat</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetIdentifier</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsInteger</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetAsVariant</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">protected
</span><span class="pas1-space">    </span><span class="pas1-reservedword">function</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> TypeName</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">):</span><span class="pas1-space"> Exception</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">dynamic</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SetVarValue</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant </span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">public
</span><span class="pas1-space">    </span><span class="pas1-reservedword">Constructor</span><span class="pas1-space"> Create</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aIdentifier</span><span class="pas1-symbol">,</span><span class="pas1-space"> aCaption </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-space">                        </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aDefaultValue </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant </span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">destructor</span><span class="pas1-space"> Destroy</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">override</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> SaveToRegIni  </span><span class="pas1-symbol">(</span><span class="pas1-space">       aRegIni  </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-space">                              </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> LoadFromRegIni</span><span class="pas1-symbol">(</span><span class="pas1-space">       aRegIni  </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-space">                              </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space"> </span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> Clear</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">virtual</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> DefaultValue  </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant       </span><span class="pas1-reservedword">read</span><span class="pas1-space">  FDefaultValue</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> AsBoolean     </span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean       </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsBoolean
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsBoolean</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> AsDateTime    </span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime     </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsDateTime
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsDateTime</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> AsFloat       </span><span class="pas1-symbol">:</span><span class="pas1-space"> Double        </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsFloat
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsFloat</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> AsInteger     </span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint       </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsInteger
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsInteger</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> AsString      </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-space">        </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsString
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsString</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> AsVariant     </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant       </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsVariant
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsVariant</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> Identifier  </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space">          </span><span class="pas1-reservedword">read</span><span class="pas1-space">  FIdentifier
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetIdentifier</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> Caption     </span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-space">          </span><span class="pas1-reservedword">read</span><span class="pas1-space">  FCaption
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetCaption</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">property</span><span class="pas1-space"> Value       </span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant         </span><span class="pas1-reservedword">read</span><span class="pas1-space">  GetAsVariant
                                           </span><span class="pas1-reservedword">write</span><span class="pas1-space"> SetAsVariant</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

...

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">AccessError</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> TypeName</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">):</span><span class="pas1-space"> Exception</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">resourcestring
</span><span class="pas1-space">  SSettingAccessError </span><span class="pas1-symbol">=</span><span class="pas1-space"> </span><span class="pas1-string">'Cannot access Setting ''%s'' (%s) as type %s'</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Exception</span><span class="pas1-symbol">.</span><span class="pas1-identifier">CreateResFmt</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-symbol">@</span><span class="pas1-identifier">SSettingAccessError</span><span class="pas1-symbol">,
</span><span class="pas1-space">                                    </span><span class="pas1-symbol">[</span><span class="pas1-space"> Identifier</span><span class="pas1-symbol">,</span><span class="pas1-space"> Caption</span><span class="pas1-symbol">,</span><span class="pas1-space"> TypeName </span><span class="pas1-symbol">]</span><span class="pas1-space"> </span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Clear</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  FValue </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Null</span><span class="pas1-symbol">;</span><span class="pas1-space">  
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">constructor</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> aIdentifier</span><span class="pas1-symbol">,</span><span class="pas1-space"> aCaption</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aDefaultValue</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Create</span><span class="pas1-symbol">(</span><span class="pas1-space"> aIdentifier</span><span class="pas1-symbol">,</span><span class="pas1-space"> aCaption</span><span class="pas1-symbol">,</span><span class="pas1-space"> aCaption</span><span class="pas1-symbol">,</span><span class="pas1-space"> True</span><span class="pas1-symbol">,</span><span class="pas1-space"> aDefaultValue </span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsBoolean</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Boolean'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsDateTime</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'DateTime'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsFloat</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Float'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsInteger</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Integer'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsString</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Result </span><span class="pas1-symbol">:=</span><span class="pas1-space"> ClassName</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">function</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">GetAsVariant</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Variant'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">LoadFromRegIni</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aRegIni</span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Assert</span><span class="pas1-symbol">(</span><span class="pas1-space"> Assigned</span><span class="pas1-symbol">(</span><span class="pas1-space"> aRegIni </span><span class="pas1-symbol">),</span><span class="pas1-space"> </span><span class="pas1-string">'The aRegIni parameter should contain a TRegIni Instance'</span><span class="pas1-space"> </span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SaveToRegIni</span><span class="pas1-symbol">(</span><span class="pas1-identifier">aRegIni</span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistryIniFile</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">const</span><span class="pas1-space"> aSection</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  Assert</span><span class="pas1-symbol">(</span><span class="pas1-space"> Assigned</span><span class="pas1-symbol">(</span><span class="pas1-space"> aRegIni </span><span class="pas1-symbol">),</span><span class="pas1-space"> </span><span class="pas1-string">'The aRegIni parameter should contain a TRegIni Instance'</span><span class="pas1-space"> </span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsBoolean</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Boolean</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Boolean'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsDateTime</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> TDateTime</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'DateTime'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsFloat</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Double</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Float'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsInteger</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Longint</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Integer'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsString</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">string</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'String'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetAsVariant</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">if</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-space"> VarIsNull</span><span class="pas1-symbol">(</span><span class="pas1-space"> Value </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">then
</span><span class="pas1-space">  </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">    Clear</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end
</span><span class="pas1-space">  </span><span class="pas1-reservedword">else
</span><span class="pas1-space">  </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">    SetVarValue</span><span class="pas1-symbol">(</span><span class="pas1-space"> Value </span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetCaption</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  FCaption </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Value</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetHint</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  FHint </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Value</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetIdentifier</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> </span><span class="pas1-reservedword">String</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  FIdentifier </span><span class="pas1-symbol">:=</span><span class="pas1-space"> Value</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TdvSetting</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SetVarValue</span><span class="pas1-symbol">(</span><span class="pas1-reservedword">const</span><span class="pas1-space"> Value</span><span class="pas1-symbol">:</span><span class="pas1-space"> Variant</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  </span><span class="pas1-reservedword">raise</span><span class="pas1-space"> AccessError</span><span class="pas1-symbol">(</span><span class="pas1-string">'Variant'</span><span class="pas1-symbol">);</span><span class="pas1-space"> </span><span class="pas1-comment">{ Do not localize }
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span></span>
</code></pre>

<h5>What does it do ?</h5>
	
<p>Actually this piece of code doesn't do all that much.  It just provides us with a base class we can now use as an ancestor for our other classes.  Basically we have some ErrorHandling and a skeleton for our specific Setting classes.</p>

<h3>Continued in Part 4</h3>

<p>For some reason I had problems fitting everything into one single post, so I had to split it up an two parts.  Go ahead and <a href="http://www.devia.be/news/article/delphi-code-using-some-basic-rules-oo-techniques-refactoring-part-4/" title="read the rest in part 4">read the rest in part 4</a>.</p>]]></content:encoded>
      <dc:date>2010-03-30T12:37:15+00:00</dc:date>
    </item>

    <item>
      <title>Simplify your Delphi Code using some basic rules, OO techniques and some refactoring (Part 2)</title>
      <link>http://www.devia.be/news/article/simplify-your-delphi-code-using-some-basic-rules-oo-techniques-refacto/</link>
      <guid>http://www.devia.be/news/article/simplify-your-delphi-code-using-some-basic-rules-oo-techniques-refacto/#When:08:40:02Z</guid>
      <description>In the First part of this series, we gave a brief overview of some general rules.  Meanwhile we&#39;ve had some time to think about what our code is supposed to do, so it&#39;s a good idea to continue with the second part.</description>
      <dc:subject>Software DevelopmentWindowsDelphi</dc:subject>
      <content:encoded><![CDATA[In the First part of this series, we gave a brief overview of some general rules.  Meanwhile we've had some time to think about what our code is supposed to do, so it's a good idea to continue with the second part.
<h3>Introduction</h3>

<p>Well, we did get some time to think a little more about what our code is supposed to do, so we have a pretty good idea about it already.  Sadly the people who originally created the code didn't really think about it.  In this article we'll take a close look at how everything was programmed and we'll have a look at some of the disadvantages and how we should solve them.</p>

<h3>The Old Code</h3>

<p>Basically the developers though about it and they had the idea that settings should be read from the registry when the user wanted to edit them.  Once the user finished changing the settings the code should store the new settings in the registry.  Apparently they also had the idea to load the settings when the first form gets displayed and save them when it gets closed.</p>

<p>So, in the main form they had some code which looks like this :</p>

<pre>
<code><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TfrmMain</span><span class="pas1-symbol">.</span><span class="pas1-identifier">FormShow</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Sender</span><span class="pas1-symbol">:</span><span class="pas1-space"> TObject</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  aRegistry </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  aRegistry </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">try
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">OpenKey</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;THE_REGISTRY_PATH&gt;'</span><span class="pas1-symbol">,</span><span class="pas1-space"> True</span><span class="pas1-symbol">);
</span><span class="pas1-space">    </span><span class="pas1-comment">// FString, FInteger and FBoolean are private field declarations on
</span><span class="pas1-space">    </span><span class="pas1-comment">// TfrmMain.
</span><span class="pas1-space">    FString  </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">ReadString</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;STRING_SETTING_KEY'</span><span class="pas1-space">  </span><span class="pas1-symbol">);
</span><span class="pas1-space">    FInteger </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">ReadInteger</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;STRING_SETTING_KEY'</span><span class="pas1-space">  </span><span class="pas1-symbol">);
</span><span class="pas1-space">    FBoolean </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">ReadBool</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;STRING_SETTING_KEY'</span><span class="pas1-space">  </span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">finally
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Free</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TfrmMain</span><span class="pas1-symbol">.</span><span class="pas1-identifier">FormClose</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Sender</span><span class="pas1-symbol">:</span><span class="pas1-space"> TObject</span><span class="pas1-symbol">;</span><span class="pas1-space"> </span><span class="pas1-reservedword">var</span><span class="pas1-space"> Action</span><span class="pas1-symbol">:</span><span class="pas1-space"> TCloseAction</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  aRegistry </span><span class="pas1-symbol">:</span><span class="pas1-space"> TRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  aRegistry </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">try
</span><span class="pas1-space">    </span><span class="pas1-comment">// FString, FInteger and FBoolean are private field declarations on
</span><span class="pas1-space">    </span><span class="pas1-comment">// TfrmMain.
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">OpenKey</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;THE_REGISTRY_PATH&gt;'</span><span class="pas1-symbol">,</span><span class="pas1-space"> True</span><span class="pas1-symbol">);
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">WriteString</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;STRING_SETTING_KEY'</span><span class="pas1-symbol">,</span><span class="pas1-space"> FString  </span><span class="pas1-symbol">);
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">WriteInteger</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;STRING_SETTING_KEY'</span><span class="pas1-symbol">,</span><span class="pas1-space"> FInteger  </span><span class="pas1-symbol">);
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">WriteBool</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;STRING_SETTING_KEY'</span><span class="pas1-symbol">,</span><span class="pas1-space"> FBoolean  </span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">finally
</span><span class="pas1-space">    aRegistry</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Free</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;

</span><span class="pas1-reservedword">procedure</span><span class="pas1-space"> TfrmMain</span><span class="pas1-symbol">.</span><span class="pas1-identifier">mnuEditSettingsClick</span><span class="pas1-symbol">(</span><span class="pas1-identifier">Sender</span><span class="pas1-symbol">:</span><span class="pas1-space"> TObject</span><span class="pas1-symbol">);
</span><span class="pas1-reservedword">var
</span><span class="pas1-space">  aEditSettingsForm </span><span class="pas1-symbol">:</span><span class="pas1-space"> TfrmEditSettings</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  aEditSettingsForm </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TfrmEditSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">(</span><span class="pas1-space"> Self </span><span class="pas1-symbol">);
</span><span class="pas1-space">  </span><span class="pas1-reservedword">try
</span><span class="pas1-space">    aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">TheString</span><span class="pas1-space"> </span><span class="pas1-symbol">:=</span><span class="pas1-space"> FString</span><span class="pas1-symbol">;
</span><span class="pas1-space">    aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">TheInteger </span><span class="pas1-symbol">:=</span><span class="pas1-space"> FInteger</span><span class="pas1-symbol">;
</span><span class="pas1-space">    aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">TheBoolean </span><span class="pas1-symbol">:=</span><span class="pas1-space"> FBoolean</span><span class="pas1-symbol">;

</span><span class="pas1-space">    </span><span class="pas1-reservedword">if</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-space"> aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">ShowModal </span><span class="pas1-symbol">=</span><span class="pas1-space"> mrOK </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">then
</span><span class="pas1-space">    </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">      FString  </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">TheString</span><span class="pas1-symbol">;
</span><span class="pas1-space">      FInteger </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">TheInteger</span><span class="pas1-symbol">;
</span><span class="pas1-space">      FBoolean </span><span class="pas1-symbol">:=</span><span class="pas1-space"> aEditSettingsForm</span><span class="pas1-symbol">.</span><span class="pas1-identifier">TheBoolean</span><span class="pas1-symbol">;
</span><span class="pas1-space">    </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-space">  </span><span class="pas1-reservedword">finally
</span><span class="pas1-space">    FreeAndNil</span><span class="pas1-symbol">(</span><span class="pas1-space"> aEditSettingsFrom </span><span class="pas1-symbol">)
</span><span class="pas1-space">  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span>
</code></pre>

<h3>Will this work ?</h3>

<p>As you can see, the code will be working.  It will read the settings when the main form gets shown and store it in some private variables.  When the main form gets closed, the settings will be stored.  And there is even some code which will open a Edit Settings form, pass some values to it, and get some results back when the user closes the Edit Settings form by pressing the OK Button.</p>

<h3>So what's the problem ?</h3>

<h4>Is the code executed at the right time ?</h4>

<p>In my opinion the OnShow and OnClose events on the form arn't really the best places to execute this code.  What if the settings included things related to the visual appearance of the form ? Do you want to read and change those each time this form gets shown ? Maybe you have some other settings which should get read even before the first form is shown ?</p>

<p>In any case you might want to read the settings or store them at different points during the execution of your application.  In this example, that would require you to execute the OnShow event of the main form to load the settings.  Even worst is having to rewrite  or copy / paste the loading code in other locations.  Believe it or not, but that's what's happening in a lot of cases.</p>

<h4>What happens when a problem occurs while loading / saving the settingss ?</h4>

<p>The code isn't perfect, and strange things will happen when a certain registry key doesn't exist.  The code will raise an exception causing it to read or save only part of the settings and ending up with invalid settings.  In our case, it would be nice if a default value was used when a certain registry key doesn't exist.</p>

<p>Additionally when the user opens the form to change the settings, and closes it using the OK button, the new settings are passed back to the main form, but are not stored in the registry yet.  If some other part of your application now reads the settings from the registry again you might end up with different settings than the ones on your main form.</p>

<h4>Is it really the responsibility of the main form to Load or Save settings ?</h4>

<p>Well, in short NO ! Not at all ! </p>

<p>What if we had to create a command line version of our application ? We might still need to read some settings from the registry, but we won't need any forms at all.  What if I need to start a thread for some background processing, and need to read the settings in that thread as well ?</p>

<p>As you can see the Main From really shouldn't be responsible for the Loading and Saving of the settings.  It can call a method to do the job, but the actual code should never be in the main form.</p>

<p>Another rule of mine is that a form should only contain code which has an influence on the visual aspect of the form or its components / controls.  Reading settings and Writing settings doesn't have a visual inflence on the form, so it's code shouldn't be in a form.  You might need to change some visual aspects based on what you read from the registry, but the actual reading itself isn't the responsibility of a form.</p>

<h3>Is there a better alternative ?</h3>

<p>Well, it's one thing to say that something is incorrect, but when doing so you should at least try to tell how to do it correctly.  So, lets think a bit more about what we want and what we need.  Generally speaking we want something to load and save application settings.  It would be nice if we had some code we could use in whatever application we create in the future.  It really doesn't matter how many settings we need to read, or what they are called, and what format they are the only thing we care about is that we can Load / Save / Edit and Use them.  How this is done isn't our responsability but something the ApplicationSettings class should take care about.</p>

<p>If we need to use the settings in our applications we only need to use code which will look like this :</p>

<pre>
<code><span class="pas1-reservedword">var
</span><span class="pas1-space">  aApplicationSettings </span><span class="pas1-symbol">:</span><span class="pas1-space"> TApplicationSettings</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">begin
</span><span class="pas1-space">  aApplicationSettings </span><span class="pas1-symbol">:=</span><span class="pas1-space"> TApplicationSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">Create</span><span class="pas1-symbol">(</span><span class="pas1-space"> </span><span class="pas1-string">'&lt;OUR Registry Key&gt;'</span><span class="pas1-space"> </span><span class="pas1-symbol">);</span><span class="pas1-space">  
  </span><span class="pas1-reservedword">try
</span><span class="pas1-space">    </span><span class="pas1-comment">// Code used to load our settings  
</span><span class="pas1-space">    aApplicationSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">LoadFromRegistry</span><span class="pas1-symbol">;
</span><span class="pas1-space">    
    </span><span class="pas1-comment">// Code used to edit our settings
</span><span class="pas1-space">    </span><span class="pas1-reservedword">if</span><span class="pas1-space"> </span><span class="pas1-symbol">(</span><span class="pas1-space"> aApplicationSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">EditSettings </span><span class="pas1-symbol">)</span><span class="pas1-space"> </span><span class="pas1-reservedword">then</span><span class="pas1-space">    
    </span><span class="pas1-reservedword">begin
</span><span class="pas1-space">      </span><span class="pas1-comment">// Our settings got changed so we might want to do
</span><span class="pas1-space">      </span><span class="pas1-comment">// something if necessary.
</span><span class="pas1-space">    </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-space">        
    </span><span class="pas1-comment">// Code used to save our settings
</span><span class="pas1-space">    aApplicationSettings</span><span class="pas1-symbol">.</span><span class="pas1-identifier">SaveToRegistry</span><span class="pas1-symbol">;</span><span class="pas1-space">    
  </span><span class="pas1-reservedword">finally
</span><span class="pas1-space">    FreeAndNil</span><span class="pas1-symbol">(</span><span class="pas1-space"> aApplicationSettings </span><span class="pas1-symbol">);</span><span class="pas1-space">  
  </span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span><span class="pas1-reservedword">end</span><span class="pas1-symbol">;
</span></span>
</code></pre>


<h4>Who's responsible for what ?</h4>

<p>As you can see, our application / form or whatever doesn't really need to know how it should read the settings, it shouldn't really need to know how it is saving the settings, nor how we will display or edit the settings.  The only thing it has to know is that we have Application Settings and we can use them.</p>

<p>Our Application Settings class on the other hand needs to know which settings the application needs, what kind of settings they are and how it should load / save each of those settings.</p>

<h4>Are there any advantages to this approach ?</h4>

<p>Absolutely, otherwise I wouldn't have taken the time to write all this down.  Our main goal here is to use Delphi as an Object Oriented programming language, not just a RAD tool.  We will be creating some classes based on our new approach, and our goal is to reuse those classes whenever necessary.  </p>

<p>If we need to write another application tomorrow and it needs to save / load some application settings we will only have to let the system know which settings are needed, how they are called and what data type they are.  All the rest of the code will simply be reused.  We will spend a little more time creating the base classes and their code, but next time we need it, everything will be (almost) ready for us.</p>

<h4>What's next ?</h4>

<p>Well, we've been thinking and talking a lot so far, but we havn't really done any true coding yet.  Maybe a few people are thinking they could have written the code in the time they read these two articles.</p>  

<p>I'm quite sure that's possible, and I've seen it done ... </p>

<p>Sadly I've also been the guy who got hired 5 years after the application got written to debug the whole application in search of why something didn't work in some cases.  I've also been the person who had to search through thousands of lines of code wondering why one setting never got saved or got replaced by an incorrect value.  And yes, I've been that person who wished they had taken the time to think about their code before they actually started working on it :-P</p>

<p>Anyway, next time I'll show you how I would do it, and hopefully share some code with you.</p>]]></content:encoded>
      <dc:date>2010-03-17T08:40:02+00:00</dc:date>
    </item>

    <item>
      <title>Simplify your Delphi Code using some basic rules, OO techniques and some refactoring (Part 1)</title>
      <link>http://www.devia.be/news/article/simplify-your-delphi-code-using-some-basic-rules-oo-techniques-and-som/</link>
      <guid>http://www.devia.be/news/article/simplify-your-delphi-code-using-some-basic-rules-oo-techniques-and-som/#When:10:36:18Z</guid>
      <description>Quite often clients require me to work on their existing code to fix some problems or add some new features.  Most of the time the code was initially written many years ago, and has never been refactored or improved.  Most of the times this is causing the code to become hard to read,  understand and even maintain.</description>
      <dc:subject>Software DevelopmentWindowsDelphi</dc:subject>
      <content:encoded><![CDATA[Quite often clients require me to work on their existing code to fix some problems or add some new features.  Most of the time the code was initially written many years ago, and has never been refactored or improved.  Most of the times this is causing the code to become hard to read,  understand and even maintain.<h3>Introduction</h3>

<p>In this series of articles I will try to show how you could easily improve your 'old' code with some simple OO techniques and some refactoring.  When writing some Delphi Code I presonally have a few rules I abide by.  It would probably require my a few pages to explain them all, but here are just a few to get you started with :</p>

<ul>
	<li>Write down what your code is supposed to do</li>
	<li>Think before you start writing your first line of code !</li>
	<li>Sketch a little Class Diagram / Class Hierarchy if necessary</li>
	<li>If you copy / pasted the same lines of code more than twice, it's time to refactor it ! (same rule applies if you are writing the same code more than two times)</li>
	<li>Classes should do what they are responsible for, nothing more, nothing less</li>
	<li>Try to think in Objects with their responsibilities instead of thinking in procedures and processes !</li>
</ul>

<p>To illustrate this I will be using a little example of some code which could be used in almost any application : Saving & Loading some applicaiton settings.  It's a pretty simple task, but in quite a few occasions the code used to do it is ... well ... not the best example of OO development.  So, lets take this example and see what we can do with our few simple rules.</p>

<h3>A closer look at 'The Rules'</h3>

<h4>Write down what your code is supposed to do</h4>

<p>I think pretty much every application will be storing some settings.  It doens't really matter if you use a ClientDataSet, and INI File, a simple Text file or even the Windows Registry to do it.  What really matters is that an application can have some settings, they user might be able to change those settings and the application will probably need to read the settings and save them.</p>  

<p>Well that's about it really, we have written down what our code should do.  Of course we might change this in the future or add some new things to it, but basically we have everything we need to get started.</p>  

<p>An additional advantage we have now is that we have already written some very basic documentation for our code ! This is really a good way to do it, since most of the time, if you have to write the documentation once everything is finished, chances are you'll never have any documentation.  Of course we still need the discipline to update our documentation if things change, but we have something to get started.</p>

<h4>Think before you start writing your first line of code !</h4>

<p>While writing out what your code is supposed to do, you should also get into the habit of thinking about how it's going to do it, what it will need, ... So, what our piece of code will need is :</p>

<ul>
	<li>Some Application Settings</li>
	<li>Some way to load the settings</li>
	<li>Some way to save the settings</li>
	<li>Some place to save to and load from</li>
	<li>Some way to display the settings</li>
	<li>Some way to edit the settings</li>
	<li>Some form we will use for display / editing purposes</li>
	<li>Some way to use the settings in our application</li>
</ul>

<p>In order to make it simple, we will assume that we will be storing our Application Settings in the Windows Registry for now.  We could make it quite generic though and have a load / save mechanism for the Windows Registry / INI Files or any other presistance mechanism, but that's not the main focus (yet), so we'll stick with the Windows Registry.</p>

<h4>What's next ?</h4>

<p>Well, this is a good place to end this first article.  In the next installment we'll be taking a look at some of the other rules, and maybe have a look at some 'old' code too and check how we could improve it.  Meanwhile we have some time to think about what our code needs to do, and some time to sketch out a little Class Diagram as well ...</p>]]></content:encoded>
      <dc:date>2010-03-09T10:36:18+00:00</dc:date>
    </item>

    <item>
      <title>Our review of the JVC GY&#45;HM100 Camcorder</title>
      <link>http://www.devia.be/news/article/our-review-of-the-jvc-gy-hm100-camcorder/</link>
      <guid>http://www.devia.be/news/article/our-review-of-the-jvc-gy-hm100-camcorder/#When:16:56:41Z</guid>
      <description>First of all, let me tell you this is by no means a complete and technical review of the new JVC GY&#45;HM100.  I&#39;m not a cinematographer, so I won&#39;t be throwing too many technical details at you guys...</description>
      <dc:subject>New MediaVideo Editing</dc:subject>
      <content:encoded><![CDATA[First of all, let me tell you this is by no means a complete and technical review of the new JVC GY-HM100.  I'm not a cinematographer, so I won't be throwing too many technical details at you guys...
<p><h3>Introduction</h3>

<div class="small-photo-left"><img src="http://devia.ehclients.com/images/uploads/news/hm100_palm.jpg" alt="image" width="300" height="186" /> <p>JVC GY-HM100</p></div><p>From time to time I have to video tape something, which could be a special occasion or some session at a conference.  For that task I've been using my Sony HDR-HC1E camcorder, which captures 1080i50 footage on HDV tapes.  It's a great device and I'm really loving it, but my biggest concern now is the time I have to spend waiting while the tapes are importing into final cut pro.</p>

<p>So, I decided to have a look at a camera I could use which shoots HD footage on memory cards, so I could switch to a tapeless workflow instead.  I noticed a <a href="http://bit.ly/6dH6Aw" title="JVC GY-HM100">JVC GY-HM100</a> at a Final Cut Studio session organized by Apple, and was hoping I could get my hands on one to give it a try.  It took me a while to get a Camcorder for some testing, but after a while I found a company called <a href="http://www.stake5.be/" title="Stake5.be - Professioneel in Pixels">Stake5</a> here in Belgium which was <a href="http://www.stake5.be/verhuur/video/camera/jvc-gy-hm100e" title="Verhuur Jvc GY-HM100E bij Stake5.be">renting the JVC GY-HM100</a>.</p>

<p>Last week I contacted the friendly folks at <a href="http://www.stake5.be/" title="Stake5.be - Professioneel in Pixels">Stake5</a> and apparently they had a few of them available, so I immediately drove up there to rent one.  So the review you are reading here is based on the week I spent with the JVC GY-HM100, shooting some footage, importing it into Final Cut Pro and editing it.</p>

<h3>Supported Video Formats</h3>

<p>The <a href="http://bit.ly/6dH6Aw" title="JVC GY-HM100">JVC GY-HM100</a> can record HD footage in quite a few different formats including the standard PAL and NTSC modes (50i/60i, 25p/30p) but even a 24p mode and in quite a few different resolutions (1920x1080, 1440x1080, 1280x720).  Sadly it doesn't seem to record in Standard Definition format, but I have to say I only used that when I switched from SD to HD anyway.  So personally I'm not really missing that feature.</p>

<h3>Native Final Cut Workflow</h3>

<p>The <a href="http://bit.ly/6dH6Aw" title="JVC GY-HM100">JVC GY-HM100</a> is sometimes advertised as the first camera which offers a full / native Final Cut Format.  Since I'm using Final Cut Studio myself, I had to check if it really lived up to that promise.  If I'm correct the actual format used is XDCAM EX, but you have the opportunity to capture your footage in one of the 2 different formats.  So I did a few tests with the each of the formats supported by the Camcorder.</p>

<h4>Using the Quicktime Format</h4>

<p>This is what is supposed to give you a native Final Cut Pro format.  The movies get recorded on the memory cards in a QuickTime format.  I decided to give that a try, and indeed you can simply drag the QT Files from the memory card directly into Final Cut Pro and start editing.</p>

<p>But personally I was missing something, perhaps caused by my the habit of my tape based workflow.  For that reason I'm used to the Log and Capture feature in Final Cut Pro.  I used that to skim through my tapes and indicate which parts of a tape I want to import into Final Cut.  While doing that I give my clips a decent name / description, ... Once I'm done with that I would batch capture the selected clips and everything would be tagged / organized properly.</p>

<p>So, I thought I could achieve the same thing with the Log and Transfer feature.  It works in a similar way to the Log and Capture feature, except it is based on files.  Sadly I couldn't use that feature to log and transfer the QT files from the device into Final Cut Pro.  It didn't work when I first copied the files to a HD neither.</p>

<p>Drag and drop seemed to work perfectly, but I couldn't indicate which parts of specific clips I wanted to import into my project.  I had to import the whole clip.</p>

<h4>Using the MP4 Format</h4>

<p>It is possible to set the device up so that it stores the captures in MP4 files.  This file structure isn't the default file structure used by Final Cut, but it is used by a few other editing systems and thus is supposed to be more compatible.</p>

<p>I checked a few things on the internet before I tried that format, and noticed the folks at JVC are offering a Log and Transfer plugin for Final Cut Pro which supports the MP4 format.  So now they have me hesitating ... do I want to have native Quicktime files so I can edit them directly in Final Cut Pro, or do I want the Log and Transfer feature which I could use in combination with the MP4 files.</p>

<p>Choices ... always choices</p>

<h3>Audio</h3>

<div class="small-photo-left"><img src="http://devia.ehclients.com/images/uploads/news/GY-HM100_XLR.png" alt="image" width="300" height="151" /><p>The GY-HM100 comes with 2 XLR inputs</p></div><p>By default the JVC GY-HM100 seems to have a lot more audio features than my current camcorder.  By default it comes with a microphone jack and mini headphone output and a built-in microphone.  Nothing special here, but what's quite interesting is that it also comes with a shotgun type microphone which you can connect to one of the two XLR inputs on the handle which you can attach to the camcorder.</p>

<h3>Still Images</h3>

<p>The only thing I will say here is that the <a href="http://bit.ly/6dH6Aw" title="JVC GY-HM100">JVC GY-HM100</a> can capture 2 megapixel still photos if you need them.  Most of the time I'm carrying my DSLR around so I probably wouldn't be using that feature a lot.  But hey, it is quite useful if you don't have any other still camera with you.</p>

<h3>Memory Cards</h3>

<p>The camcorder records to SDHC Cards, which are commonly used in other devices as well.  These SDHC cards are actually rather cheap compared to some of the other systems / memory cards used in professional Camcorders.  You can actually put 2 of those cards in your camcorder and choose on which card you want to record.  The camcorder can be configured so it automatically switches from Card A to Card B when the card is full.</p>

<p>I recorded some material at 1080p25 and I could fit about 55 minutes of footage on a single 16 Gb SDHC card.  With 2 cards in the device I could record almost 2 hours of footage.  Using 2 32 GB cards you could probably record 3,5 hours of footage in 1080p25 format.</p>

<h3>Manual Controls</h3>

<div class="small-photo-left"><img src="http://devia.ehclients.com/images/uploads/news/GY-HM100_Back_Controls.png" alt="image" width="300" height="197" /><p>Controls on the back are sometimes hard to use</p></div><p>My Sony HDR-HC1E offers quite a lot of manual controls, so I was looking for similar things in the JVC GY-HM100 and it offered almost the same set of manual controls.  Of course you can use the Auto Mode and let the device configure itself, but in some situations you want to have manual control over things like Focus, Aperture, Shutter Speed, Exposure and especially White Balance.</p>

<p>The JVC GY-HM100 offers all of that and even some more.  I have to say that in some occasions using the dial to modify the Aperture / Shutter Speed / Exposure is a little cumbersome.  The dial is a bit small and placed right next to the battery making it difficult to use, especially in cold weather when using gloves.</p>

<p>There is one thing I'm really missing on the <a href="http://bit.ly/6dH6Aw" title="JVC GY-HM100">JVC GY-HM100</a> though ... On my Sony HDR-HC1E, I can turn on an option which would display a grid of 9 blocks on the LCD display.  A great tool to compose your image using the rule of thirds, but I happened to be using that a lot to see if I was holding the camera horizontally.  I have been looking through the JVC GY-HM100 menus, but sadly I couldn't find that option.</p>

<h3>Ease of use</h3>

<div class="small-photo-left"><img src="http://devia.ehclients.com/images/uploads/news/GY-HM100_USER_CONTROLS.jpg" alt="image" width="300" height="201" /><p>3 user configurable buttons</p></div>
<p>Well, the JVC GY-HM100 is a bit larger than my Sony HDR-HC1E, but if you detach the handle with the shotgun microphone it still is a quite portable camcorder.  The LCD and Viewfinder are similar to what you will find on similar devices and I didn't have any problems with them.</p>

<p>The Menu system is quite intuitive, and easy to use.  I found that everything was well organized and most things were self explanatory.  When I took the camera out for the first few test shots the weather here in Belgium was actually pretty cold, so I was wearing gloves.  That made it a bit more difficult to use the joystick to navigate through the menus and select what I needed, but everything worked fine without the gloves.</p>

<p>There are 3 buttons on the camcorder which you can configure to your own preferences.  2 of them are easily accessible at the front of the device (close to the focus ring) and the third one is accessible when you open the LCD display.</p>

<h3>Conclusion</h3>

<p>Well, if you're a Final Cut user and are looking for a descent prosumer level camera which offers a Tapeless HD based workflow, then the JVC GY-HM100 might be the camera you are looking for.  It offers great features and wonderful footage.  It's quite easy to use and actually offers a few really neat features.  The media it used (SDHC) is quite affordable which even improves it's usability.</p>

<h4>Pro's</h4>

<ul><li>Great Video quality</li>
<li>Many different video modes to choose from</li>
<li>Native FCP workflow (if you're a FCP user of course)</li>
<li>Lots of manual control</li>
<li>2 XLR Inputs !!! So you can use pro level microphones with your camcorder</li>
<li>Focus assist which will color everything in focus in a specific color allowing you to easily focus</li>
<li>Tapeless workflow with 2 SDHC memory cards</li>
<li>Light, Portable and easy to use</li>
<li>Shotgun microphone included</li></ul>

<h4>Cons</h4>

<ul><li>Missing the Grid I have on my Sony HDR-HC1E.  So used to it to see if I'm holding the camera horizontally or to get a better composition</li>
<li>Battery Life ! Think the default battery only lasted for about 80 minutes.  Maybe there is an option to buy more powerful batteries (I did that for my Sony as well)</li>
<li>Only a single ring for both Focus and Zoom</li>
<li>Controls on the back are too close to the battery making them harder to use</li></ul>
]]></content:encoded>
      <dc:date>2010-01-18T16:56:41+00:00</dc:date>
    </item>

    <item>
      <title>How to use Social Media to improve your Product, Service or Brand.</title>
      <link>http://www.devia.be/news/article/how-to-use-social-media-to-improve-your-product-service-or-brand/</link>
      <guid>http://www.devia.be/news/article/how-to-use-social-media-to-improve-your-product-service-or-brand/#When:11:24:52Z</guid>
      <description>In our last article we gave a brief overview of what Social Media is and what it&#39;s all about.  Today we would like to talk about how you could use Social Media to improve your product or brand.</description>
      <dc:subject>New MediaSocial Media</dc:subject>
      <content:encoded><![CDATA[In our last article we gave a brief overview of what Social Media is and what it's all about.  Today we would like to talk about how you could use Social Media to improve your product or brand.
<h3>Introduction</h3>
<p>Now that we know what Social Media is, it is important to think a few minutes about how you could use Social Media to make your product, service or brand better.  It doesn't really matter if you have a big company with a lot of products or services, or if you are a small company only providing a single product or service.  What is important is that Social Media is here, everyone is using it, and you could use Social Media to get better at what you do.</p>

<h3>Monitor what people are saying about your Product, Service or Brand</h3>
<p>It is a good idea to start monitoring what people are saying about your product or service.  Wether that's on Twitter, Facebook, Blogs or in Podcasts, you should be able to keep an eye on what your customers are saying.</p>

<h3>Positive Feedback is always nice, negative feedback is priceless !</h3>
<p>I know a lot of you (myself included) look for positive feedback on the things you do.  It's always great to get compliments and see people say you're doing a great job.  But personally I pay special attention to people giving negative feedback.  The main reason here is that I can use that information to learn from my mistakes, and make sure that I do a better job next time.</p>

<h3>Feedback has become personal again</h3>
<p>Since Social Media is allowing everyone to express their opinions (good or bad), it can become a big source of information.  Before the era of Social Media, people would express their opinions about a product or a service, but chances are that by the time that feedback reaches you, you have no idea where it originally came from.  That makes it pretty hard to work with that feedback.</p>

<p>With Social Media everything is becoming personal again.  If you notice some feedback on Facebook or Twitter, it is now pretty easy to determine who actually gave that feedback.  You can even contact that person directly and ask for more information !</p>

<h3>Use the negative feedback to get more information from your customers</h3>
<p>A few days ago, I upgraded a software product I bought and started to notice some problems with the new version of the product.  I created a few tweets about it, asking if other users had the same problems.  Apparently the company was monitoring the Tweets about their product and they noticed my feedback.</p>

<p>It didn't take them long to contact me personally through Twitter and ask me what the actual problem was.  A few tweets later we shared information and our email addresses in order to communicate.  They asked me additional questions and even asked me if I could prepare some sample files for them to analyze, hoping they could locate the problem and possibly solve it in a next version.</p>

<h3>Final Word</h3>
<p>As you can see, it might take some practicing and some time to actually start using Social Media to improve your product, service or brand.  But you should take a moment to monitor what people are saying about you.  While monitoring, chances are you will also encounter some negative feedback.</p>
<p>Your main goal now isn't to tell them to shut up or make them delete that feedback, but instead use that negative feedback to get more information.  Set up a personal communication with the person in question and try to see how you can help them fix their problems or issues.</p>
<p>You might even want to get into Social Media yourselves and create a Twitter of Facebook account for your product, service or brand in order for your customers to target their feedback directly to you.</p>
<p>One thing is certain, no matter how you actually use Social Media, it can be an immense source of information which should allow you to learn from previous mistakes and improve your product, service or brand !</p>]]></content:encoded>
      <dc:date>2009-12-02T11:24:52+00:00</dc:date>
    </item>

    <item>
      <title>What is Social Media, and what is it all about ?</title>
      <link>http://www.devia.be/news/article/what-is-social-media-and-what-is-it-all-about/</link>
      <guid>http://www.devia.be/news/article/what-is-social-media-and-what-is-it-all-about/#When:12:05:49Z</guid>
      <description>Social Media is hot, everyone talks about it, and everyone is using that phrase lately.  But there are still a lot of misunderstandings as to what Social Media actually is, what it&#39;s advantages are, what the pitfalls are and how you could use Social Media to your own advantage.  That is why I decided to start with a series of articles on Social Media, and this article is the first installment.</description>
      <dc:subject>New MediaSocial Media</dc:subject>
      <content:encoded><![CDATA[Social Media is hot, everyone talks about it, and everyone is using that phrase lately.  But there are still a lot of misunderstandings as to what Social Media actually is, what it's advantages are, what the pitfalls are and how you could use Social Media to your own advantage.  That is why I decided to start with a series of articles on Social Media, and this article is the first installment.<h3>Introduction</h3>

<p>Social Media is hot, everyone talks about it, and everyone is using that phrase lately.  But there are still a lot of misunderstandings as to what Social Media actually is, what it's advantages are, what the pitfalls are and how you could use Social Media to your own advantage.  Quite a lot of people seem to thing that Twitter is Social Media, or Facebook is Social Media.  Those two examples are actually only part of the equation, and are often referred to as Social Networks.</p>

<h3>What exactly is Social Media then ?</h3>

<p>Well, in short Social Media is content created by real people, people with faces, opinions and influences.  It is actually a term used to describe various activities which integrate technology, discussions, communication and lots more.  But the most important thing might be that it's content created by users just like you and me.</p>

<h4>Social Media encourages Participation</h4>

<p>Social Media is a new form of media (at least when compared to the more traditional forms of media like Newspapers, TV, ...) which encourages participation.  Everyone who is interested in the topic is encouraged to contribute and give feedback.  This is actually a big difference with the traditional forms of media.  In the traditional media communication goes in one direction, which is from the Media to the end user.  Social Media opens new opportunities because it allows a bi-directional form of communication.  For example, I'm writing this article, and if it would appear in a newspaper or magazine it would be rather static.  Giving feedback isn't all that easy using the traditional media.</p>

<p>Instead of using traditional media, this article is posted on a Blog.  The blog is open to anyone, allowing any user who reads this article to give feedback, share his opinions and even correct me if I'm saying something wrong.</p>

<h4>It's all about Conversation and Communication</h4>

<p>Social Media really depends in interaction between people.  Wether the topic is Personal or Professional it is always meant to be a bi-directional communication.  I could create some content on a Product or Service I'm offering, but if I'm unable to get feedback on it, it's actually pretty worthless to me.  Using Social Media I can actually interact with others, hear their opinions about my Product or Service.  What's even better is that I can actually use that feedback to improve my Product or Service, and that is actually something which is often forgotten.</p>

<h4>It's also about building a Community</h4>

<p>Using Social Media it is actually quite easy to quickly build a community which shares a common interest.  I could easily be a New Media or Social Media evangelist, but if I'm talking to myself constantly, then what's the point ? Whatever content you are creating, there are people out there who share that interest.  And if your content is informative to them, they will probably start to give feedback.  After a while you will have a community of like-minded people.  If you start to use that feedback you will probably even get better at creating the content and might even gain the thrust of your community.</p>

<h3>So, what is Social Media (in 140 characters or less)</h3>

<p>At some point someone asked me if I could describe what Social Media is in a single Tweet, which is actually in 140 characters or less.  Well, that's actually a bit hard to do, but here is my attempt :</p>

<blockquote><p>"Social Media is a form of New/Online Media which encourages participation, conversation, openness and a community aspect."</p><p class="by">&mdash; Stefaan Lesage - Devia</p></blockquote>

<p>This will probably not cover everything, but I couldn't describe it better in such a small amount of characters.</p>

<h3>Forms of Social Media</h3>

<p>Now that we have an idea about what Social Media is, and what it is all about, lets have a look at the different forms of Social Media.  There are actually a few different kinds of social media, and this list is by no means complete.  Due to constant innovation and changes, this list might even get obsolete pretty soon.  Still, lets try to give a few examples :</p>

<h4>Social Networks</h4>

<p>Social Networks are sites that allow users to connect with friends, colleagues and share content with them.  There are plenty of those, but the biggest ones are Facebook, LinkedIn, MySpace, Ning, Netlog, ... Each of these Social Network sites might have it's own targeted audience.</p>

<h4>Blogs</h4>

<p>Blogs are a form of online journals in which the different posts or entries appear in a chronological order.  Most of the time they appeal to a smaller niche of users than the Social Networks, although some of the blogs are actually pretty big.  Blogs can have one or more authors who create the different entries, but in most cases anyone can post comments and feedback on those articles.</p>

<h4>Podcasts</h4>

<p>People often tend to forget Podcasts, but they do form a part of what's called Social Media.  Podcasts offer similar content to blogs, most of the time in audio or video format.  The content is made available to the end user be form of a subscription.  In many cases Podcasts also have a website or blog associated to them.</p>

<h4>Forums</h4>

<p>We probably all know what forums are.  They are a form of Social Media, since they actually encourage online discussions.  Most of the forums are created around specific areas of interests.  Forums actually existed long before anyone used the term "social media", but they are an inherent part of it.</p>

<h4>Content Communities</h4>

<p>Quite similar to Social Networks, the Content Communities focus around a specific type of content.  This could be photos (Flickr), bookmaked links (delicious), videos (YouTube, Vimeo, Viddler, ...).  Content Communities allow you to share that specific type of content with other users, and quite often are open for feedback on specific content.</p>

<h4>Microblogging</h4>

<p>Microblogging is often referred to as a Social Network in which all users can create very small 'blog' posts.  These small pieces of content (often called updates or status updates) are available online and offline (quite often there is a mobile phone client).  The best example here is Twitter of course.</p>

<h3>Final Word </h3>

<p>Well, this is of course my view on what Social Media actually is, and what it is about.  If you do not agree with my view or have anything to add, please feel free to use the Comments section below this article.  After all, we are trying to create Social Media and start a conversation with the Community :-)</p>]]></content:encoded>
      <dc:date>2009-11-02T12:05:49+00:00</dc:date>
    </item>

    <item>
      <title>Blogworld &amp;amp; New Media Expo 2009</title>
      <link>http://www.devia.be/news/article/blogworld-new-media-expo-2009/</link>
      <guid>http://www.devia.be/news/article/blogworld-new-media-expo-2009/#When:04:58:07Z</guid>
      <description>Last week I was in Las Vegas for the 2009 edition of Blogworld &amp; New Media Expo.  The conference was great, packed with a lot of good sessions, and I got the opportunity to meet up with quite a few people ...</description>
      <dc:subject>New MediaPodcastingSocial Media</dc:subject>
      <content:encoded><![CDATA[Last week I was in Las Vegas for the 2009 edition of Blogworld & New Media Expo.  The conference was great, packed with a lot of good sessions, and I got the opportunity to meet up with quite a few people ...<h3>Expensive ? Yes, but worth every penny</h3>
<div class="small-photo-left"><img src="http://devia.ehclients.com/images/uploads/news/150.gif" alt="image" width="150" height="150" /><p>Blogworld & New Media Expo</p></div><p>It took me a while before I actually decided to go to Las Vegas for the Blogworld and New Media Expo.  After all it is quite a long and expensive trip from Belgium.  But now that I have been there, I have to admit that the cost of the whole trip was nothing compared to the information and knowledge I gathered during the many sessions.  I learned quite a lot of new things from people with a lot more knowledge about New and Social Media than myself.</p>
<p>If you would ask me if it was worth it's money, I would definitely answer YES !</p>
<p>If you would ask me if I will be attending next year ... well if I can fit it into my schedule, then surely YES !</p>

<h3>What I expected from Blogworld & New Media Expo</h3>
<p>Before I actually left for Blogworld & New Media Expo, I had some expectations, and the most important ones were to learn and to network.  If I could succeed in both then the trip would have been worth it to me.  I was hoping to learn a lot of new things about Podcasting and everything related to Podcasting.</p>

<h3>What did I get at Blogworld & New Media Expo</h3>
<h4>The tracks and sessions at Blogworld & New Media Expo</h4>
<p>The first day of the Expo sadly didn't have any Podcasting related sessions at all, but pretty soon I noticed there were a lot of other great sessions that day.  There was a whole track about using Social Media for non-profit organizations which was actually very interesting.</p>

<p>That track was not only interesting for the non-profit organizations but were also packed with great information for general use.  At one point someone mentioned that it isn't the number of people you know which will allow you to raise the most money.  You actually need to put out regular updates, progress reports, keep people engaged and get them wrapped up in the Cause.  I believe that most of this is actually true for anything you wish to do with social media, even with Podcasting.</p>

<h4>Networking Opportunities</h4>
<p>The conference was actually a great opportunity to meet new people, and meet up with the faces behind some podcasts I have been listening to.  I met up with a lot of people from the Mac Roundtable Crew and a few others.  Some of the podcasters and other people I met were Allison Sheridan (<a href="http://www.podfeet.com/" title="NosillaCast mac macintosh podcast how-to tips freeware shareware software reviews">Nosillacast</a>), Victor Cajaio (<a href="http://typicalmacuser.com/" title="Typical Mac User Podcast">Typical Mac User</a> and <a href="http://typicalshutterbug.com/wordpress/" title="Typical Shutterbug Podcast">Typical Shutterbug Podcast</a>), Don McAllister (<a href="http://www.screencastonline.com/" title="ScreenCastsOnline">ScreenCastsOnline</a>), John Chambers (<a href="http://www.oneminutetip.com/" title="One Minute Tip - What Will You learn Today?">One Minute Tip</a>), George Starcher, Dave Hamilton, John F Braun, Jean MacDonald (<a href="http://www.smileonmymac.com/" title="SmileOnMyMac: Mac Software for PDF Editing, CD Labels, Text Expansion and Faxing">Smile on my mac</a>), Chuck Joiner (<a href="http://www.macvoices.com/wordpress/" title="MacVoices">MacVoices</a>), David Sparks (<a href="http://www.macsparky.com/" title="MacSparky">MacSparky</a>), Israel Hyman (<a href="http://www.izzyvideo.com/" title="Izzy Video - Learn How to Shoot, Edit, and Produce Better Video">IzzyVideo</a>) and Dr. Talli van Sunder (<a href="http://www.beinghealthy.tv/" title="Being Healthy for Busy People">Being Healthy for Busy People</a>).  I really hope I didn't forget anyone in this list.</p>

<h3>What did I miss at Blogworld & New Media Expo</h3>
<h4>The Blogworld Expo Website</h4>
<p>I don't know why, but I had the impression, during the months leading up to the event, that there were a few things missing.  Even till a week before Blogworld & New Media Expo I had that impression.  Most of the Sessions on the Calendar and the Website didn't have any detailed description at all.  Even when checking the Schedule and the details for the sessions I attended, all of them say '<em>Session description coming soon</em>'.  Without details on the different sessions it was actually hard to choose, and I guess a few people (including me) might have missed a few very interesting sessions.</p>

<h4>Famous in the US might be unknown elsewhere</h4>
<p>In some of the Keynote sessions people were brought on to the stage which should be famous, but I never heard of them.  For example, The Bloggess might be famous and well known in the US, but I had never heard of her before.  She was funny, but she gave me the impression she had too much of something before she showed up on stage.  That whole last keynote was quite funny, but in my humble opinion it didn't add anything of value to Blogworld & New Media Expo.</p>

<h4>The Expo floor felt a bit strange to me</h4>
<p>Well, I did expect a lot more audio and video equipment vendors on the exhibit floor, sadly only Shure was there with some interesting goodies.  During the many sessions I attended, I noticed that there was a great interest in Video for blogging and podcasting, but yet not Video Equipment Vendors were actually present.  Maybe something to look at for next year ?</p>

<h3>What will the future bring for Blogworld & New Media Expo</h3>
<p>Well, I hope the people behind this convention will learn from the small problems and mistakes they made.  After all, we are all human and we do all make mistakes, but we need to learn from those.  I'm quite sure that next years Blogworld & New Media Expo will be even bigger and better, and if I can squeeze it into my schedule I will surely be part of it.  And if there is any additional need for speakers to fill the Podcasting track, I might even be interested to help with that.</p>]]></content:encoded>
      <dc:date>2009-10-21T04:58:07+00:00</dc:date>
    </item>

    <item>
      <title>Podcamp Barcelona Educational Podcasting</title>
      <link>http://www.devia.be/news/article/podcamp-barcelona-educational-podcasting/</link>
      <guid>http://www.devia.be/news/article/podcamp-barcelona-educational-podcasting/#When:07:59:35Z</guid>
      <description>This weekend I was invited to go to Podcamp Barcelona and give a presentation there.  It took me a while to decide on the topic of my presentation, but I decided to go with Educational Podcasting.</description>
      <dc:subject>New MediaPodcasting</dc:subject>
      <content:encoded><![CDATA[This weekend I was invited to go to Podcamp Barcelona and give a presentation there.  It took me a while to decide on the topic of my presentation, but I decided to go with Educational Podcasting.<h3>My Presentation</h3>
<h4>Goal</h4>
<p>Before leaving for <a href="http://09en.podcampbarcelona.org/" title="Podcamp Barcelona">Podcamp Barcelona</a> I had a specific goal in mind.  I didn't want to convince everyone in the room to start using Podcasts in the Classroom, although that would have been nice.  My goal was to share my opinion with them, tell them why I think podcasting is a great educational tool and show them a few examples of existing podcasts.  My only goal was to inspire them, get them interested at looking into the subject of Educational Podcasting and make them think about how it could be used in an educational environment.</p>
<h4>Result</h4>
<p>I have uploaded the Presentation to Slideshare and included it in this post.</p>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=podcampbc-090919133506-phpapp01&rel=0&stripped_title=educational-podcasting-podcamp-barcelona-19092009-devia" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=podcampbc-090919133506-phpapp01&rel=0&stripped_title=educational-podcasting-podcamp-barcelona-19092009-devia" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
<p>Apparently the session has been video taped as well, and is currently being processed.  Once the video is available somewhere, I'll make sure to post a link to it on the website.</p>
<h3>Other Presentations</h3>
<p>Of course I wasn't the only one presenting at Podcamp Barcelona, and there were plenty of other interesting sessions.  Thanks to the simultaneous translation of Spanish / Catalan presentations into English, I was able to understand what they were saying, and actually learned quite a few new things.</p>
<h4>Steve Lawson : "Amplified'09"</h4>
<p>I met <a href="http://www.stevelawson.net/wordpress/" title="Steve Lawson">Steve Lawson</a> on Friday.  He's a great guy with fantastic ideas and in my opintion an excellent 'communication starter'.  At podcamp he was telling us about <a href="http://www.amplified09.com/" title="Amplified '09">Amplified '09</a>.  The concept is easier to understand, than it is to explain it.  They are actually Amplifying events and bringing different networks together.  He explained it to me as a network of networks.  He talked about how Social Media can be used to gather ideas, start inter company projects and share knowledge.</p>
<h4>David Allen : Creating a Succesful Podcast</h4>
<p><a href="http://twitter.com/wizardgold" title="David">David</a> is the guys behind the <a href="http://mac20q.com/" title="Mac20Q (Mac 20 Questions) podcast">Mac20Q (Mac 20 Questions) podcast</a>, and a few other podcasts as well.  His goal is to show us the tools he is using to create his podcasts and how he uses Twitter and other Social Media to connect with people he can then interview for one of his podcasts.</p>
<p>He was also talking about 'protecting your brand', and tells us we should register on all Social Media related websites (Twitter, Facebook, Tumblr, Ping.Fm, ...) using our brand namen, even if we don't plan on using it.  That way you protect your brand and register it's name, prohibiting others to use it in your place.</p>
<h4>Catavino : Wine and Social Media</h4>
<p><a href="http://catavino.net/" title="Catavino">Catavino</a> is a website with information on Spanish and Portuguese wines and has a worldwide audience.  They started as one of the first Wine related blog, and are active in a small niche.  Meanwhile they are the most comprehensive and educational website covering Spanish and Portuguese wine, iberian food, culture and travel.  One of the things they organize is wine tastings, and that is exactly what they did at Podcamp Barcelona as well.</p>
<h4>Dolores Reig : Free</h4>
<p><a href="http://www.dreig.eu/caparazon/" title="Dolores">Dolores</a> did a great speach on changes in Education.  She talked about some of the problems we currently have with education being and even suggested a few ways in which we could solve those.  She presented some new business models which could be used to solve a few problems (copyright for example) and also discussed some options and tools for free education.</p>
<h4>Gregor Gimmy : Sclipo</h4>
<p><a href="http://sclipo.com/" title="Sclipo">Sclipo</a> is actually one of those Online Education related websites and is somehow a mix of Slideshare, Flickr, Youtube, ... The whole website is designed to help people learn and tech better using things like a Webcam-based classroom for live teaching & Webinars.  Gregor gave us a quick demo of Sclipo.  I have been using Sclipo to upload some video tutorials to it, but I didn't know it had all those additional features.  I will have to check it out.</p>
<h4>Delphine Lebédel : Woman & Mozilla</h4>
<p><a href="http://blog.lebedel.net/index.php?post/2009/05/19/Women-and-Mozilla!" title="Delphine">Delphine</a> told us a bit about the History of the Mozilla project and the different types of team members and how they collaborate together.  She also presented a new project, which is called "<a href="http://www.womoz.org/blog/" title="Women in Mozilla">Women in Mozilla</a>".  As we all know the IT world consists mostly of men, and in Open Source communities the percentage of female participants is really low.  The goal of the Women & Mozilla project is to promote the implication of woman in the FLOSS world in general, and particularly in the Mozilla Project.  I have to say, that I'm all for these kind of projects, so if you are interested in it, please have a look on their website and help Delphine spread the word.</p>
<h3>Podcamp Barcelona 2009 was a success</h3>
<p>For me, Podcamp Barcelona was a success.  I have been getting great feedback on my presentation, learned a lot of new and interesting people, and even learned some new things as well.  I would like to thank everyone who helped organising this event, especially <a href="http://twitter.com/cataspanglish" title="Chris">Chris</a> and <a href="http://twitter.com/anafmora" title="Anna">Anna</a>, the translators, technicians, presenters and public.  Thanks to all of you Podcamp Barcelona 2009 was really worth it !</p>



]]></content:encoded>
      <dc:date>2009-09-21T07:59:35+00:00</dc:date>
    </item>

    <item>
      <title>CocoaHeads Belgium Founding Meeting</title>
      <link>http://www.devia.be/news/article/cocoaheads-belgium-founding-meeting/</link>
      <guid>http://www.devia.be/news/article/cocoaheads-belgium-founding-meeting/#When:14:56:05Z</guid>
      <description>CocoaHeads Belgium is the first Chapter of CocoaHeads in Belgium. CocoaHeads Belgium will be holding their Founding Meeting on Monday 28 September 2009 starting at 19:00 in the offices of IBBT (Zuiderpoort Office Park, Gaston Crommenlaan 8, 9050 Gent&#45;Ledeberg, Belgium).</description>
      <dc:subject>Software DevelopmentMacCocoaObjective&#45;C</dc:subject>
      <content:encoded><![CDATA[CocoaHeads Belgium is the first Chapter of CocoaHeads in Belgium. CocoaHeads Belgium will be holding their Founding Meeting on Monday 28 September 2009 starting at 19:00 in the offices of IBBT (Zuiderpoort Office Park, Gaston Crommenlaan 8, 9050 Gent-Ledeberg, Belgium).<h3>What is CocoaHeads ?</h3>
<div class="small-photo-left"><img src="http://cocoaheads.be/wordpress/wp-content/uploads/2009/09/CocoaheadsBE.png"  alt="image" width="250" height="228" /></div>
<p><a href="http://www.cocoaheads.org/" title="CocoaHeads">CocoaHeads</a> is a group devoted to discussion of Apple Computer’s <a href="http://developer.apple.com/cocoa/" title="Cocoa Framework">Cocoa Framework</a> for programming on MacOS X (including theiPhone). During monthly meetings, members present on their projects and offer tutorials on various programming topics.</p>
<h3>What about CocoaHeads Belgium ?</h3>
<p><a href="http://www.cocoaheads.be" title="CocoaHeads Belgium">CocoaHeads Belgium</a> is the first Chapter of CocoaHeads in Belgium and our Founding Meeting will take place on monday 28 september 2009 starting at 19:00 in the offices of <a href="http://www.ibbt.be/" title="IBBT">IBBT</a> (Zuiderpoort Office Park, Gaston Crommenlaan 8, 9050 Gent-Ledeberg, Belgium).</p>

<p>This first meeting wil be an informal meeting in which attendees will have the opportunity to meet with other Cocoa and CocoaTouch enthousiasts from Belgium.</p>

<p>The goal of this meeting is to have a brainstorm session with the attendees.  This session will give everyone the opportunity to help us shape the future of CocoaHeads Belgium and make sure CocoaHeads Belgium will become THE event for Cocoa developers and by Cocoa developers.</p>

<h3>Registration</h3>
<p>The meeting is free for everyone interested in Mac & iPhone development.  We kindly ask you to register for the event at <a href="http://cocoaheadsbe.eventbrite.com/" title="Eventbrite">Eventbrite</a>.  Spaces are limited, so if you want to attend, register as soon as possible.</p>

<p>Additional information can be found on the <a href="http://www.cocoaheads.be" title="CocoaHeads Belgium">CocoaHeads Belgium</a> website.</p>
]]></content:encoded>
      <dc:date>2009-09-07T14:56:05+00:00</dc:date>
    </item>

    
    </channel>
</rss>