<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7243392047581674096</id><updated>2024-08-30T08:58:24.221+01:00</updated><title type='text'>Angry Welsh Coder</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-6466191883314067769</id><published>2014-12-15T19:32:00.001+00:00</published><updated>2014-12-15T19:32:21.202+00:00</updated><title type='text'>Setup Debian Wheezy with 2 monitors ATI Radeon</title><content type='html'>Oh I had some trouble here...&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;With black screen problems after installing the drivers from Radeon.&lt;/li&gt;
&lt;li&gt;Dragging windows to different display problems when installing drivers from Radeon. I don&#39;t know enough on how to fix this, if someone does please let me know as I would love to use the latest drivers from Radeon.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
So my fix for all of this was to use the &lt;a href=&quot;http://smxi.org/&quot; target=&quot;_blank&quot;&gt;smxi&lt;/a&gt; tool. What a superb set of scripts!! Really saved me days of messing about. Just take a look at the documentation on the site, it&#39;s quite straight forward and it guides you through everything nicely.&lt;br /&gt;
&lt;br /&gt;
You can also use this tool for a few other things apart from setting up your graphics card. I used it for that mainly.&lt;br /&gt;
&lt;br /&gt;
When it came down to the options you could select the latest or previous versions from AMD, or select the Debian fglrx.&lt;br /&gt;
&lt;br /&gt;
I tried the latest from AMD and got so far with that. It definitely stopped my black screen on startup but then I had a dragging window problem between monitors :-( which I don&#39;t know how to fix yet.&lt;br /&gt;
&lt;br /&gt;
I just stuck with the debian fglrx install and that worked superbly. I just had to run amdcccle afterwards to just configure the monitor sizes correctly and also set the overscan on my second monitor so it removed the black border.&lt;br /&gt;
&lt;br /&gt;
And that was it!&lt;br /&gt;
&lt;br /&gt;
Hope this helps someone else.</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/6466191883314067769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2014/12/setup-debian-wheezy-with-2-monitors-ati.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/6466191883314067769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/6466191883314067769'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2014/12/setup-debian-wheezy-with-2-monitors-ati.html' title='Setup Debian Wheezy with 2 monitors ATI Radeon'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-2241709551911777909</id><published>2013-11-10T11:17:00.001+00:00</published><updated>2013-11-10T11:18:14.512+00:00</updated><title type='text'>Debian Wheezy - How to remove annoying shutdown beep</title><content type='html'>I found many solution out there to turn this annoying system speaker beep off, but none seemed to work for me. Eventually I found a little something in amongst the &lt;a href=&quot;http://forums.debian.net/viewtopic.php?f=5&amp;amp;t=80577&quot; target=&quot;_blank&quot;&gt;thread.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
What fixed it for me was a combination of 2 things, one was to remove the &quot;pcskr&quot; module (although I found this the softer of the system beeps) and the other was to go into alsamixer and select the sound card that contained the &quot;Beep&quot; and mute it. Yes &quot;mute it&quot; setting it to &quot;00&quot; does not work. To mute this select it and press &#39;m&#39;.&lt;br /&gt;
&lt;br /&gt;
So a quick summary of exactly what I did...&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Add &quot;blacklist pcspkr&quot; to a blacklist.conf in the /etc/modprobe.d/ directory. This will prevent the pcspkr being loaded on start up.&lt;/li&gt;
&lt;li&gt;Start &quot;alsamixer&quot; in a terminal, select the sound card (Press F6) that contains the &quot;Beep&quot; (you may have more than one listed and maybe more than one with a &quot;Beep&quot; in this case I am not sure what to do, but try muting one at a time to see what works or maybe both). To mute select the &quot;Beep&quot; and press &#39;m&#39; you should see the &quot;Beep&quot; muted. Press Esc to exit and it should be saved.&lt;/li&gt;
&lt;li&gt;You can now remove the pcspkr before you restart by typing as root &quot;modprobe -r pcspkr&quot;, this will remove the module now before you reboot.&lt;/li&gt;
&lt;/ul&gt;
And that should be it :-) &lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/2241709551911777909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/11/debian-wheezy-annoying-shutdown-beep.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2241709551911777909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2241709551911777909'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/11/debian-wheezy-annoying-shutdown-beep.html' title='Debian Wheezy - How to remove annoying shutdown beep'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-3532077495534373766</id><published>2013-06-01T21:38:00.000+01:00</published><updated>2013-06-01T21:38:01.826+01:00</updated><title type='text'>TL-WN821N with RTL8192CU for Fedora 18</title><content type='html'>Well I had a little bit of trouble with this wireless dongle on Fedora 18 but with the help of a few links all seems to have gone well. What I seemed to find out is the current default driver does not work so well and you need to get the driver source, blacklist the default drivers, compile the new drivers and install the module. Let me explain with a few easy steps...&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Possibly you will need the kernel-source, kernel-headers and gc++ installed prior to the following instructions.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Get the latest drivers from the following &lt;a href=&quot;http://218.210.127.131/downloads/downloadsView.aspx?Langid=1&amp;amp;PNid=48&amp;amp;PFid=48&amp;amp;Level=5&amp;amp;Conn=4&amp;amp;DownTypeID=3&amp;amp;GetDown=false&amp;amp;Downloads=true#RTL8192CU&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;, download the driver Linux Kernel 2.6.18~2.6.38 and kernel 3.0.8&lt;span style=&quot;color: #666666; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px; line-height: 16px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Blacklist some of the current rtl drivers, by adding the following to the /etc/modprobe.d/blacklist.conf&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;blacklist rtl8192cu,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;blacklist rtl8192c_common,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;blacklist rtlwifi&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Just doing an install.sh of the driver didn&#39;t quite cut it, I needed to apply a patch for it to compile, I used the 2 attachments found on this &lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=2092934&amp;amp;p=12620866#post12620866&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; from the user tim_philips.&lt;/li&gt;
&lt;li&gt;I downloaded both attachments, potentially you need an account to download them but I am unsure.&lt;/li&gt;
&lt;li&gt;put the download of the driver, the txt and sh file in the same folder.&lt;/li&gt;
&lt;li&gt;Run run in terminal as root user:&amp;nbsp;bash ./patch_rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105.sh&lt;/li&gt;
&lt;li&gt;If you want to know what the script does, you can take a look, it just unzips a couple of things applies the patch and makes and installs the driver.&lt;/li&gt;
&lt;li&gt;One other thing if yo update your kernel, chances are you need to redo all of this, doesn&#39;t take 2 minutes :-)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
That should be everything. Hope this helps. Potentially you need a reboot just to remove the currently installed drivers or you can take a look for them using lsmod and doing an rmmod &amp;lt;with the module names that you added to the blacklist&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here are some helpful links...&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=2092934&amp;amp;p=12620866#post12620866&quot; target=&quot;_blank&quot;&gt;Link on ubuntu&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://ask.fedoraproject.org/question/9638/realtek-8192cu-fedora-18/&quot; target=&quot;_blank&quot;&gt;Realtek 8192cu Fedora 18&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://askubuntu.com/questions/246236/compile-and-install-rtl8192cu-driver&quot; target=&quot;_blank&quot;&gt;Compile and install rtl8192cu driver&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://218.210.127.131/downloads/downloadsView.aspx?Langid=1&amp;amp;PNid=48&amp;amp;PFid=48&amp;amp;Level=5&amp;amp;Conn=4&amp;amp;DownTypeID=3&amp;amp;GetDown=false&amp;amp;Downloads=true#RTL8192CU&quot; target=&quot;_blank&quot;&gt;Realtek driver&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/3532077495534373766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/06/tl-wn821n-with-rtl8192cu-for-fedora-18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3532077495534373766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3532077495534373766'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/06/tl-wn821n-with-rtl8192cu-for-fedora-18.html' title='TL-WN821N with RTL8192CU for Fedora 18'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-3632951474699850884</id><published>2013-05-18T12:07:00.000+01:00</published><updated>2013-05-18T12:07:03.885+01:00</updated><title type='text'>Updating QNAP firmware and using openssh</title><content type='html'>Just a quickie...&lt;br /&gt;
&lt;br /&gt;
If you are one of the people who wants a more configurable ssh connection to your QNAP NAS box and have configured the use of openssh like from one of my previous &lt;a href=&quot;http://angrywelshcoder.blogspot.ch/2013/01/setting-up-qnap-to-accept-ssh.html&quot; target=&quot;_blank&quot;&gt;blog posts&lt;/a&gt;&amp;nbsp;and you notice that after a firmware upgrade of the qnap NAS the ssh doesn&#39;t seem to allow connections any more. This is usually with a &quot;Connection Reset by Peer&quot; error.&lt;br /&gt;
&lt;br /&gt;
In this case it means that the openssh sshd has been overwritten by the firmware upgrade.&lt;br /&gt;
&lt;br /&gt;
Dont Panic! Its an easy fix, you just need to re-copy the openssh sshd back over the default one on the NAS and restart your sshd either in the terminal connection to the NAS box or through the web administration tool.&lt;br /&gt;
&lt;br /&gt;
So looking at &lt;a href=&quot;http://blog.jameslick.com/?p=1090&quot; target=&quot;_blank&quot;&gt;James Lick&#39;s post&lt;/a&gt; again, its just the following 2 lines after connecting to your NAS box via telnet (well that is what I use at least):&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;mv /usr/sbin/sshd /usr/sbin/sshd-orig&lt;/li&gt;
&lt;li&gt;cp /opt/sbin/sshd /usr/sbin&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Now a quick restart of your sshd, this can be found in the web admin tool,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Network Services,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Telnet/SSH,&lt;/li&gt;
&lt;li&gt;Click Allow SSH connection to disable it then apply&lt;/li&gt;
&lt;li&gt;When its disabled, re select it to enable it and then press apply.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
That should get your ssh back up and running.</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/3632951474699850884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/05/updating-qnap-firmware-and-using-openssh.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3632951474699850884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3632951474699850884'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/05/updating-qnap-firmware-and-using-openssh.html' title='Updating QNAP firmware and using openssh'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-4319631894555346373</id><published>2013-03-02T14:15:00.001+00:00</published><updated>2013-03-02T14:18:00.151+00:00</updated><title type='text'>Setting up printing and scanning of hp photosmart C310 printer over network with fedora 18</title><content type='html'>Here is what I did.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I installed the hplip packages: (sorry I don&#39;t know if I added any extra repository, but if you don&#39;t see it the only repositories I have added are the &quot;rpmfusion free&quot; and &quot;rpmfusion free -updates&quot;)&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;HP Linux Imaging and Printing Project&lt;/li&gt;
&lt;li&gt;Files needed by the HPLIP printer and scanner drivers&lt;/li&gt;
&lt;li&gt;HPLIP Graphical tools&lt;/li&gt;
&lt;li&gt;HPLIP Libraries&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Once I installed them I opened up Hp Device Manager (I pressed the search app button i.e. windows button).&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once open...&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Selected Network/Ethernet/Wireless netowrk&lt;/li&gt;
&lt;li&gt;Click Show Advanced Options&lt;/li&gt;
&lt;li&gt;Select Manual Discovery&lt;/li&gt;
&lt;li&gt;Type in IP address of printer (you can find this on printer press the wireless button on the display, the ip address should be listed, usually something like 192.168.0.&amp;lt;Something&amp;gt;)&lt;/li&gt;
&lt;li&gt;Click Next&lt;/li&gt;
&lt;li&gt;Your device should appear in the list and selected.&lt;/li&gt;
&lt;li&gt;Click Next&lt;/li&gt;
&lt;li&gt;Click Add Printer&lt;/li&gt;
&lt;li&gt;You will probably need to enter your root/admin user name and password&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Now the printer should be installed and also the scanner.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can check that the scanner is installed by using terminal and entering &quot;scanimage -L&quot; this will show you all scanning devices possibly webcams also.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You should be able to start up the scanning software and start scanning.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This &lt;a href=&quot;https://help.ubuntu.com/community/ScanningHowTo#netw&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; helped me :-)&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/4319631894555346373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/03/setting-up-printing-and-scanning-of-hp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/4319631894555346373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/4319631894555346373'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/03/setting-up-printing-and-scanning-of-hp.html' title='Setting up printing and scanning of hp photosmart C310 printer over network with fedora 18'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-7623813905878780707</id><published>2013-02-02T21:11:00.000+00:00</published><updated>2013-02-02T21:11:08.251+00:00</updated><title type='text'>Using Oracle Java with libreoffice Fedora 18</title><content type='html'>&lt;div&gt;
Problem I was having was that I didn&#39;t want openjdk installed as I need Oracle&#39;s Java environment to be able to develop some android apps. I am not fully sure if I needed to remove the installation of the openjdk I guess I didn&#39;t and all I needed to do was to update the links and environment variables to point to the installation of Oracles Java. Anyhow I removed the openjdk instead and this is how I did it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
What I did here was to remove the installation of the openjdk without it trying to remove the libreoffice using following command. Use the appropriate version of the openjdk to remove it.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
rpm -ev --nodeps java-1.7.0-openjdk&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The --nodeps will remove the package without the libreoffice.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now I installed Oracle&#39;s Java rpm downloaded from &lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/downloads/index.html&quot; target=&quot;_blank&quot;&gt;JavaSE Download&lt;/a&gt;, just by double clicking it, it then installs it. After completion of the installation, libreoffice seems fine and so does my development environment.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can check which version of java is wired up if your not sure, by using the command:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
java -version&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When I was trying to do this I managed to get myself into a pickle with versions of java being installed, as I couldn&#39;t remove Oracle&#39;s Java using the software tool in Fedora 18. The software tool seemed to crash all the time, so I removed Oracle&#39;s Java from the command line instead, I used the following commands:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
rpm -qa | grep jdk &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(This to find out the name of the package I wanted to remove)&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
rpm -ev jdk-1.7.0_13-fcs.x86_64 &amp;nbsp; &amp;nbsp;(This to remove the above package)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
for some reason the software tool wasn&#39;t updated with the removal of the package but I ignored it for now.&lt;/div&gt;
&lt;div&gt;
So I found I had to do the order of removing the openjdk package, which I believe removes all the environment for java, so then installing Oracle&#39;s Java would reset them and then libreoffice continued to work.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I also imagine if there are any updates in the future that require openjdk to be installed it will be installed and thus wiping your Oracles Java environment variables. I haven&#39;t found this yet, but I am sure all I would need to do to reset them is too re-follow the above.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Remove openJDK, Remove Oracle Java, Re-Install Oracle Java.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Hope this helps someone else too. :-)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/7623813905878780707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/02/using-oracle-java-with-libreoffice.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7623813905878780707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7623813905878780707'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/02/using-oracle-java-with-libreoffice.html' title='Using Oracle Java with libreoffice Fedora 18'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-8519186662827547326</id><published>2013-01-27T14:27:00.000+00:00</published><updated>2013-03-03T15:52:07.835+00:00</updated><title type='text'>Fedora 17 and 18 headphone socket fix</title><content type='html'>&lt;h3&gt;
&lt;b&gt;The Problem...&lt;/b&gt;&lt;/h3&gt;
My headphones produce no sound from jack socket when using Fedora 17 and also Fedora 18. The sounds card I have is:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)&lt;/li&gt;
&lt;li&gt;02:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI Redwood HDMI Audio [Radeon HD 5000 Series]&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
I found the above be executing the &lt;b&gt;&quot;lspci&quot;&lt;/b&gt; command, you can use &lt;b&gt;&quot;lspci | grep Audio&quot;&lt;/b&gt; and that should find similar to the above.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
The Solution...&lt;/h3&gt;
I got my solution from &lt;a href=&quot;https://bugzilla.redhat.com/show_bug.cgi?id=588722&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
All I did was to create the file /etc/modprobe.d/dist-alsa.conf and add the following lines:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;options snd-hda-intel model=dell-m6-amic&lt;/li&gt;
&lt;li&gt;options snd-hda-intel enable_msi=1&lt;/li&gt;
&lt;/ul&gt;
Ok I found an issue when I tried the above setting of setting the model to &lt;i&gt;&lt;b&gt;dell-m6-amic&lt;/b&gt;&lt;/i&gt;, my microphone stopped working, I then found a little information on this &lt;a href=&quot;http://ubuntuforums.org/archive/index.php/t-1574035.html&quot; target=&quot;_blank&quot;&gt;thread&lt;/a&gt;&amp;nbsp;that stated that was for the analog mic, so I changed the setting to&amp;nbsp;&lt;b&gt;&lt;i&gt;dell-m6-dmic&lt;/i&gt;&lt;/b&gt;&amp;nbsp;which is for a digital mic.&lt;br /&gt;
&lt;br /&gt;
How to know which model to choose this &lt;a href=&quot;https://help.ubuntu.com/community/HdaIntelSoundHowto&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; is very useful! &lt;a href=&quot;http://wiki.sabayon.org/index.php?title=HOWTO:_Resolve_Problems_with_HDA-Intel_Sound_Cards&quot; target=&quot;_blank&quot;&gt;This&lt;/a&gt; has some info too but pretty much the same.&lt;br /&gt;
&lt;br /&gt;
Then reboot, potentially you don&#39;t need to reboot and there is a command to restart the sound system, I am not sure on this, so reboot it was for me :-)&lt;br /&gt;
&lt;br /&gt;
Hope this helps someone else out too :-)</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/8519186662827547326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/fedora-17-and-18-headphone-socket-fix.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/8519186662827547326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/8519186662827547326'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/fedora-17-and-18-headphone-socket-fix.html' title='Fedora 17 and 18 headphone socket fix'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-547033486311718161</id><published>2013-01-24T18:38:00.002+00:00</published><updated>2013-01-24T19:09:00.518+00:00</updated><title type='text'>Installing ATI drivers on Fedora 18</title><content type='html'>I followed mostly what was in this &lt;a href=&quot;http://forums.fedoraforum.org/showthread.php?t=155503&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;, but when installing the driver I just did yum install akmod-catalyst as it pulls in required dependencies.&lt;br /&gt;
&lt;br /&gt;
I managed to get a black screen by just installing the akmod-catalyst without some of those instructions, so it was either the first instruction or last that fixed my black screen problem after booting. reinstalling mesa-libGL or the dracut of a new image after making sure the Radeon drivers were uninstalled.&lt;br /&gt;
&lt;br /&gt;
Only problem I have is a nice watermark at the bottom right of my screen. Its not so bad for now, but would be nice to get rid of :-)&lt;br /&gt;
&lt;br /&gt;
There are some fixes out there on how to remove it, but I am sure the new builds releases will come soon. :-)&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/547033486311718161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/installing-ati-drivers-on-fedora-18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/547033486311718161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/547033486311718161'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/installing-ati-drivers-on-fedora-18.html' title='Installing ATI drivers on Fedora 18'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-5637587430673265575</id><published>2013-01-23T23:04:00.002+00:00</published><updated>2013-01-23T23:04:31.035+00:00</updated><title type='text'>Nice shortcut editor for Fedora 18</title><content type='html'>I used alacarte and seems to be able to set up all the shortcuts and modify the icons etc. Very nice! straight forward.&lt;br /&gt;
&lt;br /&gt;
yum install alacarte</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/5637587430673265575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/nice-shortcut-editor-for-fedora-18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/5637587430673265575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/5637587430673265575'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/nice-shortcut-editor-for-fedora-18.html' title='Nice shortcut editor for Fedora 18'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-9069828190719279708</id><published>2013-01-23T23:02:00.003+00:00</published><updated>2013-01-23T23:02:43.754+00:00</updated><title type='text'>Setting up Fedora 18 for an SSD</title><content type='html'>Just some short points on setting up Fedora 18 or for that matter probably most Linux flavours for an SSD.&lt;br /&gt;
&lt;br /&gt;
I&#39;ve highlighted the bits I changed:&lt;br /&gt;
&lt;br /&gt;
/etc/fstab changes:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;/dev/sda &amp;nbsp; / &amp;nbsp; ext4 &amp;nbsp; &lt;b&gt;noatime,nodiratime,discard,errors=remount-ro&lt;/b&gt; 0 1&lt;/li&gt;
&lt;li&gt;&lt;b&gt;tmpfs &amp;nbsp; /tmp &amp;nbsp; &amp;nbsp; &amp;nbsp; tmpfs &amp;nbsp; defaults,noatime,mode=1777 &amp;nbsp; 0 &amp;nbsp;0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;tmpfs &amp;nbsp; /var/spool tmpfs &amp;nbsp; defaults,noatime,mode=1777 &amp;nbsp; 0 &amp;nbsp;0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;tmpfs &amp;nbsp; /var/tmp &amp;nbsp; tmpfs &amp;nbsp; defaults,noatime,mode=1777 &amp;nbsp; 0 &amp;nbsp;0&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;tmpfs &amp;nbsp; /var/log &amp;nbsp; tmpfs &amp;nbsp; defaults,noatime,mode=0755 &amp;nbsp; 0 &amp;nbsp;0&lt;/b&gt; (only do this if you don&#39;t care about loosing logs on reboot!)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
/etc/default/grub changes:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash&amp;nbsp;&lt;b&gt;elevator=deadline&lt;/b&gt;&quot; add the elevator bit to the end.&lt;/li&gt;
&lt;li&gt;grub2-mkconfig -o /boot/grub2/grub.cfg&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Chrome to use its cache directory as the tmp director, which is in memory already add the following to the shortcut.&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;--disk-cache-dir=&quot;/tmp&quot; --disk-cache-size=104857600&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The &lt;a href=&quot;http://apcmag.com/how-to-maximise-ssd-performance-with-linux.htm&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; I got most this information from :-)&lt;/div&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/9069828190719279708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/setting-up-fedora-18-for-ssd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/9069828190719279708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/9069828190719279708'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/setting-up-fedora-18-for-ssd.html' title='Setting up Fedora 18 for an SSD'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-1015209211413879238</id><published>2013-01-23T22:44:00.000+00:00</published><updated>2013-05-20T10:22:03.967+01:00</updated><title type='text'>Setting up Broadcom 4312 with Fedora 18</title><content type='html'>This was a bit of a pain and felt like I had to jump through hoops to get this damn thing to work. In the end its not actually too much to do, you can either to try and follow the instructions in this &lt;a href=&quot;http://wireless.kernel.org/en/users/Drivers/b43&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; (I have had to do this recently) or mine.&lt;br /&gt;
&lt;br /&gt;
First off, by using the command line rpm and yum commands I seemed to be more successful installing all the required packages.&lt;br /&gt;
&lt;br /&gt;
So here goes...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
Change user as root:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;su -&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Step 2:&lt;/b&gt;&lt;br /&gt;
You need to add a couple of repos, the rpmfusion free and nonfree repos.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Step 3:&lt;/b&gt;&lt;br /&gt;
You will probably then need to download and import the keys for these repos from&amp;nbsp;&lt;a href=&quot;http://rpmfusion.org/keys?action=AttachFile&amp;amp;do=view&amp;amp;target=RPM-GPG-KEY-rpmfusion-free-fedora-18&quot; target=&quot;_blank&quot;&gt;rpmfusion-keys&lt;/a&gt;:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;get [attachment:RPM-GPG-KEY-rpmfusion-free-fedora-18]&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;get [attachment:RPM-GPG-KEY-rpmfusion-nonfree-fedora-18]&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Step 4:&lt;/b&gt;&lt;br /&gt;
Import the keys:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;rpm --import &amp;lt;Directory where you downloaded the&amp;nbsp;[attachment:RPM-GPG-KEY-rpmfusion-free-fedora-18]&amp;nbsp;Key&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;rpm --import &amp;lt;Directory where you downloaded the&amp;nbsp;[attachment:RPM-GPG-KEY-rpmfusion-nonfree-fedora-18]&amp;nbsp;Key&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Step 5:&lt;/b&gt;&lt;br /&gt;
Now with these keys imported, you should now be able to update:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;yum update&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Step 6:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Ok this got a bit weird when I tried to install kmod-wl but try it out it could work straight out for you, but I had issues with it failing to install due to &quot;uname -r&quot; not matching with build of kmod-wl not correct.&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;yum install kmod-wl&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
If the above fails then try:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;yum install akmod-wl&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
I think all the akmod-wl will do is bring all the dependencies it requires, which will be the kmod-wl and the broadcom-wl packages and a few others. I think all the akmod does is to be able to build a new version of the kmod-wl module against your version of the kernel if there doesn&#39;t exist one on the repos. Also if/when you update your kernel this akmod should make sure that the kmod-wl is built correctly.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So at this point akmod-wl, kmod-wl and broadcom-wl should be installed, and a few others required dependencies by the akmod-wl package.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 7:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Ok now I found at this point that there was a module loaded called ssb which conflicts with the wl module. I am not sure what this module is and why it conflicts I didn&#39;t look into it too much, so I had to remove this module permanently by adding it to a blacklist. First of all I tried:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;echo &quot;blacklist ssb&quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
which didn&#39;t seem to work, so I added it directly to the grub.conf, but what I did was add it too the /etc/default/grub file so as the time comes when you may need to call grub-mkconfig then it will keep the default added in that file, so I did:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;added &quot;rd.driver.blacklist=ssb&quot; to the end of the GRUB_CMDLINE_LINUX in the /etc/default/grub&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;then ran, &quot;grub2-mkconfig -o /boot/grub2/grub.cfg&quot; this regenerated the /etc/grub2.cfg file.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
I am not sure why I had to blacklist like this and if anyone can explain or help out that would be much appreciated :-) So all should be prepared at this point, just one more step.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Step 8:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
I removed the ssb module and added the wl module.&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;rmmod ssb&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;modprobe wl&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
Now that should be it, as far as I remember, on the network icon then should show up wireless. Try rebooting also to make sure it comes up after a reboot also. If you get any problems or some parts don&#39;t work please let me know and I will try to correct it and help.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Some useful links I found and used.&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.howopensource.com/2011/08/install-broadcom-wireless-802-11-driver-in-fedora-15-14/&quot; target=&quot;_blank&quot;&gt;Installing kmod-wl&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://forums.fedoraforum.org/showthread.php?t=287544&quot; target=&quot;_blank&quot;&gt;Problems blacklisting ssb&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.broadcom.com/docs/linux_sta/README.txt&quot; target=&quot;_blank&quot;&gt;Broadcom link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://forums.fedoraforum.org/showthread.php?t=239922&quot; target=&quot;_blank&quot;&gt;How to use Broadcom wireless in fedora 14/15/16&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://fedoraproject.org/wiki/GRUB_2?rd=Grub2&quot; target=&quot;_blank&quot;&gt;Grub2&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
Hope this helps out :-)&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/1015209211413879238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/setting-up-broadcom-4312-with-fedora-18.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/1015209211413879238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/1015209211413879238'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/setting-up-broadcom-4312-with-fedora-18.html' title='Setting up Broadcom 4312 with Fedora 18'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-6390199945988280582</id><published>2013-01-19T19:03:00.001+00:00</published><updated>2013-01-19T19:03:31.221+00:00</updated><title type='text'>Setting up QNAP to accept ssh connection from different users</title><content type='html'>This is a pain to do, and I always seem to forget one switch to turn on 1 file to set up 1 permission to configure. Always the same every time I need to do it. Well I have put together a few links that I have found useful and a few procedures I have found helpful to understand why a connection fails. :-)&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So the steps and links I used are:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;For setting up new ssh software on the QNAP NAS I used this link:&amp;nbsp;&lt;a href=&quot;http://blog.jameslick.com/?p=1090&quot;&gt;http://blog.jameslick.com/?p=1090&lt;/a&gt;&amp;nbsp;brilliant, excellent! worked for me and my model. I imagine it would be a slight tweak for other models if they have different names for equivalent mounts.&lt;/li&gt;
&lt;li&gt;Then I set up the users paths in /etc/passwd on the NAS box of the users.&lt;/li&gt;
&lt;li&gt;Setting up the ssh keys, omg! I used this link:&amp;nbsp;&lt;a href=&quot;http://superuser.com/questions/8077/how-do-i-set-up-ssh-so-i-dont-have-to-type-my-password&quot;&gt;http://superuser.com/questions/8077/how-do-i-set-up-ssh-so-i-dont-have-to-type-my-password&lt;/a&gt;. So I worked out the public key goes on the NAS box in the authorized_keys file in the user .ssh directory of the user, e.g. /home/JoeBloggs/.ssh/authorized_keys &amp;nbsp;&amp;lt;-- This user home path should be the same as what you specified in the /etc/passwd file. BE CAREFUL - When copying the public key that it doesn&#39;t gain spaces on the copy paste route, it needs to be as it is in the generated file (from point 1) You can add more than one key to this file for this user, if the same user connects from different machines, you can generate another key from the other machine and add the public key of that one to the same authorized_keys file. You press ENTER after the first one and then paste in the new one.&lt;/li&gt;
&lt;li&gt;Configure the sshd_config file this is in the location(s) specified in the link 1, don&#39;t forget to update both configs otherwise on reboot you will get your old one back. You can set up the config file with the users that are required to access via ssh.&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;So there is a section to describe where to find the authorized keys file, and you can configure it to go to the home path of the user that tries to connect, using (I believe %h means the home directory of the user connecting, but I am not 100% sure):&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;AuthorizedKeysFile&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;%h/.ssh/authorized_keys&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;There is also a section to allow certain users:&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;AllowUsers JoeBloggs Fred&lt;/li&gt;
&lt;/ul&gt;
&lt;/ol&gt;
&lt;li&gt;There are also special permissions allowed only to the authorized_keys files which I found in this link:&amp;nbsp;&lt;a href=&quot;http://recursive-design.com/blog/2010/09/14/ssh-authentication-refused/&quot;&gt;http://recursive-design.com/blog/2010/09/14/ssh-authentication-refused/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Any problems that occur, when you test to connect to ssh JoeBloggs@&amp;lt;yourIP&amp;gt; you can run the ssh with a -v that can output much information that can give clues in why it fails.&lt;/li&gt;
&lt;li&gt;Also you can run the QNAP sshd manually with sshd -d and then connect from the client and watch the debug output that can give clues also :-). To do this I would stop the ssh service in the QNAP web client. Then locate the sshd on the QNAP, it is usually at /usr/sbin/sshd, so you will have to execute with full path specified e.g. /usr/sbin/sshd -d and this should then start up the daemon ready for connections.&lt;/li&gt;
&lt;li&gt;One more thing! If you want to map a network drive on a linux box to your QNAP, you will need to turn on the sftp option when turning on your ssh option in the web client of your QNAP box. You can also do this drive mapping nicely with sshfs JoeBloggs@&amp;lt;YourIP&amp;gt;:&amp;lt;Directory you want to go too on the QNAP&amp;gt; &amp;lt;Directory you want to map too on local computer&amp;gt; The &quot;Directory you want to go too on the QNAP&quot; default is your home directory of that user, so if you need somewhere out of that (and make sure you have permisions for the user set up on the QNAP), you have to specify a relative path from your home directory, e.g.&amp;nbsp;sshfs JoeBloggs@&amp;lt;YourIP&amp;gt;:../../SomeSpecialData /home/JoeBloggs/SomeSpecialData&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Ok I think that&#39;s it for now.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Hope it will help someone, again it will help me when I need to do this again :-)&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/6390199945988280582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/setting-up-qnap-to-accept-ssh.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/6390199945988280582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/6390199945988280582'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/setting-up-qnap-to-accept-ssh.html' title='Setting up QNAP to accept ssh connection from different users'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-7540032773360310881</id><published>2013-01-19T18:21:00.001+00:00</published><updated>2013-01-19T18:21:34.623+00:00</updated><title type='text'>Migrating QNAP NAS from Raid 1 to Raid 5</title><content type='html'>&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;What a mess!!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;BACKUP FIRST!! Somehow I didn&#39;t even need it in the end :-)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;Well, I think I have eventually managed to work out how to get my raid migrated from Raid 1 to Raid 5 after adding a new drive (surprisingly without loosing any data), and let me tell you something I would feel sorry for the average guy who doesn&#39;t know too much about Linux or computers to be able to do this on the command line. I feel that the UI isn&#39;t up to coping with a situation that something doesn&#39;t go correctly too well. This was not a straight forward thing to do and probably the first thing I would do is to never use the UI provided to do this, its next to useless! No really! the best thing to do is to learn how to do it manually from the command line, I had a lot more confidence working with Linux directly over this UI.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;It has taken me a couple of weeks and I have my NAS back up and running at Raid level 5 with the new drive and over 50 emails back and fore to support which was very helpful and responsive and gave many clues but in the end I worked out the bulk of it myself, which gave me a great sense of achievement and knowledge.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;I think I rebuilt Raid 1, 3 - 4 times, Raid 5 twice, while removing and trying to re-add my new drive, also scanning drives for bad blocks and as they are all 2 TB drives this doesn&#39;t give results back that quickly. So now I am going to try and document what i did to get this to work with the help of a few links one of which I was guided to by the QNAP Support.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;So the useful links I had were the following:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;Thread 1: viewtopic.php?t=12109&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;This was the most useful one for clues on the process of what I needed to do, I got so far with this one and failed to unmount the drive as there were services still being used so I needed to run &quot;/etc/init.d/services.sh stop&quot; this stopped all the services I could then unmount the drive. Further down this thread from &quot;abmagfab&quot; he gives more information if you need to grow the raid also.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;Thread 2:http://www.davelachapelle.ca/2008/07/25 ... to-raid-5/&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;This one gave more more information on how to convert the Raid 1 to Raid 5 on 2 disks and then add the new drive. Also very useful. I think I would just use this thread next time.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;The trouble with doing all this from the command line is that the UI will start to look incorrect as the files that the UI relies on does not get updated when running these commands on command line. The files were /etc/storage.conf and /etc/config/raidtab. I wasn&#39;t sure what I needed to update on these files so I kind of guessed, when I had 3 drives at Raid level 5 I set them accordingly. I tried to find more information about these files and what the different parameters meant but I couldn&#39;t, so please if anyone knows where I can find information on this please post here, I would love to understand how they are used and what the possible values to the possible parameters are. thanks &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;So I would just follow thread 2 but I would also unmount the /dev/md0 also so would need to run the &quot;services.sh stop&quot; command.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;It wasn&#39;t as straight forward as the thread as I had already started playing with mdadm and I got things in a bit of a state but I managed to get it all back to a nice state and learned a lot on the way (surprisingly without loosing data too!)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;I had a situation once where all was complete, but my /dev/md0 would not automount I had forgotten to turn the journaling back on with the /dev/md0 (quite easily done when you have rebuild times over night and day, I kind of forget what I did! ha ha) once I did that and rebooted, voila! auto mounted!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;dmesg is your friend, it can give quite a few clues, I will explain how I found the journaling off problem...When I ran dmesg straight after boot and after I manually mounted /dev/md0 (mount /dev/md0 /share/MD0_DATA -t ext4) it gave me the following on the last line of dmesg:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;EXT4-fs (md0): mounted filesystem without journal&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;I saw the &quot;without journal&quot; and that triggered my memory about whether i turned it off or not and a quick search online of what happens when mounting without journal, gave me some more clues so I just turned it back on using command in Link1 and all seemed to be fine again&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;Don&#39;t ask me how I didn&#39;t loose any data, but I didn&#39;t (well not that I have noticed yet!). mdadm is very robust and usable just make sure to read the man pages for all the options that you are about to use from any links that you follow and you can learn a lot just like me&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;I am sure it will help me in the future when I forget all this in a few months (well few minutes really)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 18.1875px;&quot;&gt;I hope this helps someone else.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/7540032773360310881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/migrating-qnap-nas-from-raid-1-to-raid-5.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7540032773360310881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7540032773360310881'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2013/01/migrating-qnap-nas-from-raid-1-to-raid-5.html' title='Migrating QNAP NAS from Raid 1 to Raid 5'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-7448442998480756589</id><published>2012-12-12T18:55:00.000+00:00</published><updated>2013-02-24T10:56:05.797+00:00</updated><title type='text'>Bananas and Monkeys</title><content type='html'>&lt;br /&gt;
Ok first off, I did not write this, but damn it has some truth. For acknowledgement here is the &lt;a href=&quot;http://paws.kettering.edu/~jhuggins/humor/banana.html&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; I found it on. It goes something like this...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start with a cage containing five monkeys.&lt;br /&gt;
Inside the cage, hang a banana on a string and place a set of stairs under it. Before long, a monkey will go to the stairs and start to climb towards the banana. As soon as he touches the stairs, spray all of the other monkeys with cold water.&lt;br /&gt;
After a while, another monkey makes an attempt with the same result - all the other monkeys are sprayed with cold water. Pretty soon, when another monkey tries to climb the stairs, the other monkeys will try to prevent it.&lt;br /&gt;
Now, put away the cold water. Remove one monkey from the cage and replace it with a new one. The new monkey sees the banana and wants to climb the stairs. To his surprise and horror, all of the other monkeys attack him.&lt;br /&gt;
After another attempt and attack, he knows that if he tries to climb the stairs, he will be assaulted.&lt;br /&gt;
Next, remove another of the original five monkeys and replace it with a new one. The newcomer goes to the stairs and is attacked. The previous newcomer takes part in the punishment with enthusiasm! Likewise, replace a third original monkey with a new one, then a fourth, then the fifth. Every time the newest monkey takes to the stairs, he is attacked.&lt;br /&gt;
Most of the monkeys that are beating him have no idea why they were not permitted to climb the stairs or why they are participating in the beating of the newest monkey.&lt;br /&gt;
After replacing all the original monkeys, none of the remaining monkeys have ever been sprayed with cold water. Nevertheless, no monkey ever again approaches the stairs to try for the banana. Why not? Because as far as they know that&#39;s the way it&#39;s always been done round here.&lt;br /&gt;
And that, my friends, is how company policies are made.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interesting huh?</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/7448442998480756589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2012/12/bananas-and-monkeys.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7448442998480756589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7448442998480756589'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2012/12/bananas-and-monkeys.html' title='Bananas and Monkeys'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-3637173558024114038</id><published>2012-12-04T22:42:00.000+00:00</published><updated>2012-12-04T22:43:32.004+00:00</updated><title type='text'>NHibernate, Ninject 3, MVC 4</title><content type='html'>Recently I have started to use Ninject more and more, its my favourite of all the IOC frameworks I have used so far. Also I wanted to give MVC 4 a dabble just to keep myself in the loop with what is going on in the MVC world after only using MVC 2 in the past. So I thought I would try to wire up something nice between MVC4, Ninject 3 and NHibernate and came up with the following located on github&amp;nbsp;&lt;a href=&quot;https://github.com/RichardWilliams/MVC-NHibernate-Ninject&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
So in a previous post with &lt;a href=&quot;http://angrywelshcoder.blogspot.ch/2011/03/nhibernate-unit-of-work-repository-and.html&quot; target=&quot;_blank&quot;&gt;NHibernate, Unit of Work, Repository and Structuremap&lt;/a&gt;, I carped on about a Unit of Work and a Repository.&lt;br /&gt;
&lt;h3&gt;
&lt;br /&gt;&lt;/h3&gt;
&lt;h3&gt;
With regards to the repository...&lt;/h3&gt;
I think I have gone off the idea of using the Repository pattern with NHibernate after reading lots of posts on &lt;a href=&quot;http://ayende.com/blog&quot; target=&quot;_blank&quot;&gt;Ayende&#39;s&lt;/a&gt; site, various other sites and from previous experience I feel it is limiting NHibernate to make optimal calls to the database. I believe NHibernate&#39;s Session is the repository. Here are a couple of links:&lt;br /&gt;
&lt;a href=&quot;http://ayende.com/blog/4784/architecting-in-the-pit-of-doom-the-evils-of-the-repository-abstraction-layer&quot; target=&quot;_blank&quot;&gt;Architecting in the pit of doom: The evils of the repository abstraction layer&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://ayende.com/blog/3955/repository-is-the-new-singleton&quot; target=&quot;_blank&quot;&gt;Repository is the new singleton pattern&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;br /&gt;&lt;/h3&gt;
&lt;h3&gt;
With regards to the Unit of Work...&lt;/h3&gt;
&lt;div&gt;
Here I just set up a filter to wrap up the work done across a transaction. So now any of the work in the domain model/business logic that is done via a particular controller action should all be wrapped up in a transaction. I wired up the filter using the Ninject.MVC3 extension and the Kernel.BindFilter.&lt;/div&gt;
&lt;h3&gt;
&lt;br /&gt;&lt;/h3&gt;
&lt;h3&gt;
&lt;a href=&quot;https://github.com/RichardWilliams/MVC-NHibernate-Ninject&quot; target=&quot;_blank&quot;&gt;Github&lt;/a&gt; project...&lt;/h3&gt;
&lt;div&gt;
Its been a while since I looked at this project and what I was doing, so I will need to refresh myself with it as well. I just created the default MVC 4 app and added a new controller, the ProductController. I just wanted to be able to show a list of Products that are stored in the database and also be able to add new products and render the change.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Libraries I used:&lt;/div&gt;
&lt;div&gt;
MVC 4&lt;/div&gt;
&lt;div&gt;
Ninject 3&lt;/div&gt;
&lt;div&gt;
Ninject.MVC 3 extension&lt;/div&gt;
&lt;div&gt;
NHibernate&lt;/div&gt;
&lt;div&gt;
Automapper&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The project isn&#39;t finished yet, I would like to try to wire up NServiceBus and RavenDB in here too (but these are just distance thoughts for the moment), and really push all the business logic down into the domain model.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Some points on what I did.&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Created the standard ASP.NET MVC 4 application.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Added NHibernate and created a simple database relationship for stores, products and employees, I may have taken these relationships from somewhere else but I can&#39;t remember.&lt;/li&gt;
&lt;li&gt;Added Ninject and its Ninject.MVC 3 extension, this works for MVC 4.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
That&#39;s it for now... I will come back and update this some more when I get a chance...&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/3637173558024114038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2012/12/nhibernate-ninject-3-mvc-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3637173558024114038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3637173558024114038'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2012/12/nhibernate-ninject-3-mvc-4.html' title='NHibernate, Ninject 3, MVC 4'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-3603856580695396959</id><published>2012-11-26T22:09:00.000+00:00</published><updated>2012-12-02T11:35:37.826+00:00</updated><title type='text'>Programming is not just programming</title><content type='html'>Well its been a very long time since I posted something here, but today I had an idea of what I could write about...&lt;br /&gt;
&lt;br /&gt;
I had a very good friend ask me about .net development, and that he was concerned about getting his .net skills up to scratch. My immediate thought was this guy is a super bright guy and I am sure he knows enough of .net to be able to do pretty much anything that was required of him and quickly as well. Which then led me onto thinking of this post and what I could write about.&lt;br /&gt;
&lt;br /&gt;
I would say that a lot of .net developers out there know how to write code in .net and probably/possibly many other languages too, but possibly miss the idea of writing code that can be maintained and also feel confident about being maintained quickly&amp;nbsp;(this does not mean that the super bright guy above does not know this :-)).&lt;br /&gt;
&lt;br /&gt;
I would say of those that don&#39;t care and don&#39;t even realise what they are writing, their code is becoming legacy code as quickly as they type it. I for one was one of these guys (the didn&#39;t realise one), absolutely 100% omg! Am I admitting that! We all have to start somewhere (that&#39;s my excuse ;-) ) and from there its a lot of practice and realisation of what we are writing.&lt;br /&gt;
&lt;br /&gt;
Now I am making a concentrated effort on everything I write to be much clearer, simpler, easier to understand and change, by keeping in mind as many of the things I have read about in the following books, links, blog posts frameworks etc.&lt;br /&gt;
&lt;br /&gt;
I will try to keep this up to date every time I discover something new or useful. Lots of links and lots to digest I know, but it has taken me some time. Just take your time, practice a few things, try them out on some scratch projects see what you can come up with. You&#39;ll surprise yourself on how your code becomes much more awesome!&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)&quot; target=&quot;_blank&quot;&gt;S.O.L.I.D&lt;/a&gt; - A must for every OO developer, probably any other link on that page too.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://pragprog.com/articles/tell-dont-ask&quot; target=&quot;_blank&quot;&gt;Tell Dont Ask&lt;/a&gt; - Another nice one that can lead you onto the other nice things like &lt;a href=&quot;http://martinfowler.com/bliki/CQRS.html&quot; target=&quot;_blank&quot;&gt;CQRS&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Law_of_Demeter&quot; target=&quot;_blank&quot;&gt;Law of Demeter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Dependency Injection &lt;a href=&quot;http://stackoverflow.com/questions/130794/what-is-dependency-injection&quot; target=&quot;_blank&quot;&gt;Stack Overflow&lt;/a&gt;&amp;nbsp;link and &lt;a href=&quot;http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html&quot; target=&quot;_blank&quot;&gt;James Shore Link&lt;/a&gt; from the same SO link - Lots of Inversion of Control (IOC) containers out there to help with this too. &lt;a href=&quot;http://www.ninject.org/&quot; target=&quot;_blank&quot;&gt;Ninject&lt;/a&gt; (my favourite), &lt;a href=&quot;http://docs.structuremap.net/index.html&quot; target=&quot;_blank&quot;&gt;StructureMap&lt;/a&gt;, &lt;a href=&quot;http://unity.codeplex.com/&quot; target=&quot;_blank&quot;&gt;Unity&lt;/a&gt;, there are also more. I find this is really important and should be used on every project regardless of size of the project, what you will start to realise when you use this that your unit testing becomes easier to write.&lt;/li&gt;
&lt;li&gt;Unit Testing - There are many unit test frameworks out there to pick from, &lt;a href=&quot;http://www.nunit.org/&quot; target=&quot;_blank&quot;&gt;NUnit&lt;/a&gt;&amp;nbsp;(I have used a lot), &lt;a href=&quot;http://xunit.codeplex.com/&quot; target=&quot;_blank&quot;&gt;XUnit&lt;/a&gt; (but heard a lot of good things about this and I think I will start to use this for some home projects ), MSTest (Microsoft&#39;s, included with Visual Studio). Just a quick side note I would like to write an article about is Unit Testing. I believe and found it so difficult to start writing unit tests, this is also a lot of practice and when you realise how it fits and what it does, BOOM! It will be a Eureka moment!&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jetbrains.com/resharper/&quot; target=&quot;_blank&quot;&gt;Resharper&lt;/a&gt;, get it! It&#39;s worth it! It has some very nice tools with it, the solution wide analysis(dont need to waste time building solution to find errors), the stack trace viewer are a couple. I recommend learning a shortcut a day, and within no time you wont need your mouse to code. Pffff, the amount of times I have sat there with someone using the mouse to click on menus, scrolling around, switching windows, looking for code in a solution, blah blah, all that time wasted.... aaarrrrgggghhhhh! Drives me nuts! Mind you I can get some 5 second power naps, when they are searching for the next thing to click! lol ;-)&lt;/li&gt;
&lt;li&gt;Read blogs articles, follow some recognised people, like some of the people from the books I have mentioned. Also take a look at some code you have found on github, contribute maybe too, you will learn so much like this.&lt;/li&gt;
&lt;li&gt;Go to some talks, organised day events, local newsgroups in your area, etc. &lt;a href=&quot;http://skillsmatter.com/&quot; target=&quot;_blank&quot;&gt;skillsmatter&lt;/a&gt;, &lt;a href=&quot;http://www.developerdeveloperdeveloper.com/home/&quot; target=&quot;_blank&quot;&gt;DDD&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Ok some other stuff, buzz words, people, software etc... I will try to write these more in depth at some point but it will be worth you guys having a sniff at what they are about also.&lt;/div&gt;
&lt;h4&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4&gt;
&lt;b&gt;Continuous Integration&lt;/b&gt;&lt;/h4&gt;
&lt;div&gt;
Setting up a build and release process just off a single check in! If you can get this right, this is one of the most powerful things in releasing software fast and reducing all that wasted time, matching up bugs with changesets, with releases, deploying the correct version for your testers, unit testing, integration testing etc. A couple more pieces of software provided from JetBrains, &lt;a href=&quot;http://www.jetbrains.com/teamcity/&quot; target=&quot;_blank&quot;&gt;TeamCity&lt;/a&gt;&amp;nbsp;and&amp;nbsp; &lt;a href=&quot;http://www.jetbrains.com/youtrack/index.jsp&quot; target=&quot;_blank&quot;&gt;YouTrack&lt;/a&gt; is worth taking a look at also, extremely useful for tracking all task, bugs etc. There are many other solutions out there too, but these are the first that came to mind for the moment.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;b&gt;Source Control&lt;/b&gt;&lt;/h4&gt;
&lt;div&gt;
There are several source control systems out there, here are a few...&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;GIT - Extremely powerful and gives much more ease and freedom for your code. I have only started to use this recently, it takes a little time to get your head around if you are used to using a more centralised system, here are some links... &lt;a href=&quot;http://www.syncfusion.com/resources/techportal/ebooks/git&quot; target=&quot;_blank&quot;&gt;GIT Succinctly&lt;/a&gt;, &lt;a href=&quot;https://github.com/&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt;&amp;nbsp;get an account, try it out, practice, stick at it. Well worth it!&lt;/li&gt;
&lt;li&gt;TFS - Microsoft&#39;s version of source control, along with managing tasks and probably other things too. I use it most of my working time. But the more I use GIT the less I want to use this.&lt;/li&gt;
&lt;li&gt;SVN - Not used in a long time and used sporadically.&lt;/li&gt;
&lt;li&gt;SourceSafe - This has to get a mention! DO NOT USE IT!! REALLY! DON&#39;T! Go take a read of any articles about it, see what people have to say about it, maybe you have had your own experiences with it...&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h4&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4&gt;
&lt;b&gt;Database Stuff&lt;/b&gt;&lt;/h4&gt;
&lt;div&gt;
Apart from the usual same old boring databases are databases blurb, blah blah, same old, same old, SQL Server,&amp;nbsp;&lt;a href=&quot;http://www.mysql.com/&quot; target=&quot;_blank&quot;&gt;MySQL&lt;/a&gt;, &lt;a href=&quot;http://www.postgresql.org/&quot; target=&quot;_blank&quot;&gt;PostgreSQL&lt;/a&gt;, blah blah etc ooops forgot about Oracle.&lt;/div&gt;
&lt;div&gt;
But there are these new document databases turning up, which seem very very interesting, take a look, try them out, &lt;a href=&quot;http://ravendb.net/&quot; target=&quot;_blank&quot;&gt;RavenDB&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://www.mongodb.org/&quot; target=&quot;_blank&quot;&gt;MongoDB&lt;/a&gt;.&amp;nbsp;I haven&#39;t used them yet, but will be giving them a go soon I hope. They seem extremely powerful and fast. I went to a see &lt;a href=&quot;http://ayende.com/blog&quot; target=&quot;_blank&quot;&gt;Oren Eini&lt;/a&gt;&amp;nbsp;and he gave an excellent talk on RavenDB. Interesting thoughts of why now we should be looking at storing and retrieving data differently.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;b&gt;Books&lt;/b&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Working Effectively With Legacy Code - Michael Feathers, Don&#39;t be depressed with crap code, take a read of this and see how you can fix it! Very good read and interesting.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/0131177052/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=0131177052&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/B005OYHF0A/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B005OYHF0A&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Kindle&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Clean Code, and The Clean Coder - Robert C. Martin (Uncle Bob), Both these books very nice.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/0132350882/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=0132350882&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.amazon.co.uk/gp/product/B001GSTOAM/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B001GSTOAM&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Kindle&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/0137081073/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=0137081073&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.amazon.co.uk/gp/product/B0050JLC9Y/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B0050JLC9Y&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Kindle&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Refactoring: Improving the Design of Existing Code. Excellent! Nice techniques, mixing this with Michael Feathers book above and the Clean Coding books of Uncle Bob you will have some quite powerful ways of being able to modify the most complex of code.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/0201485672/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=0201485672&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.amazon.co.uk/gp/product/B007WTFWJ6/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B007WTFWJ6&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Kindle&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;The Pragmatic Programmer: From Journeyman to Master - Andrew Hunt and David Thomas, &amp;nbsp;Superb, must read for all developers! Interesting too, see if you can recognise any of your situations you have been in match whats in this book, I wouldn&#39;t be surprised most of them match :-)&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/020161622X/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=020161622X&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.amazon.co.uk/gp/product/B000SEGEKI/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B000SEGEKI&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Kindle&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;The Art of Unit Testing - Roy Osherove, Very nice, a definite good start with Unit Testing, but I still think you need to practice and see what it really is worth.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/1933988274/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=1933988274&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.manning.com/osherove/&quot; target=&quot;_blank&quot;&gt;Manning Publications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&amp;nbsp;C# In Depth - Jon Skeet, Superb! I have to take my time in this one, and probably have to read it a few times, but excellent!&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/1935182471/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=1935182471&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.manning.com/skeet2/&quot; target=&quot;_blank&quot;&gt;Manning Publications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Domain Drive Design: Tackling Complexity in the Heart of Software - Eric Evans, I have started reading it but not got very far yet, but heard it is very good.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.co.uk/gp/product/0321125215/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=0321125215&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Book&lt;/a&gt;, &lt;a href=&quot;http://www.amazon.co.uk/gp/product/B00794TAUG/ref=as_li_tf_tl?ie=UTF8&amp;amp;camp=1634&amp;amp;creative=6738&amp;amp;creativeASIN=B00794TAUG&amp;amp;linkCode=as2&amp;amp;tag=angry00-21&quot;&gt;Kindle&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;b&gt;Other Things&lt;/b&gt;&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/data/gg577609.aspx&quot; target=&quot;_blank&quot;&gt;Rx&lt;/a&gt; - A must! Take a look! Try it out! See what you can do and learn from this. Very powerful!&lt;/li&gt;
&lt;li&gt;Agile - I would say a very powerful, fast and useful process of writing software. I would never go back to Waterfall again&amp;nbsp;if I could help it,&amp;nbsp;unless I needed money for sleeping. I haven&#39;t read up much on the agile processes but been in the flow of using this style of development with several projects.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://nservicebus.com/&quot; target=&quot;_blank&quot;&gt;NServiceBus&lt;/a&gt;&amp;nbsp;- I haven&#39;t used yet but all I hear is good things about this piece of software check it out. I will be trying this out in the near future also.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/AutoMapper/AutoMapper&quot; target=&quot;_blank&quot;&gt;Automapper&lt;/a&gt; - For transfering data from one object to another which has the same properties, Very neat, very useful, easy to use, set up.&lt;/li&gt;
&lt;li&gt;Some people, Martin Fowler, Kent Beck, Robert C. Martin (Uncle Bob), Oren Eini, Udi Dahan, Jon Skeet, all of these have a massive community around them and well worth reading up some of their articles.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/3603856580695396959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2012/11/well-its-been-very-long-time-since-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3603856580695396959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/3603856580695396959'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2012/11/well-its-been-very-long-time-since-i.html' title='Programming is not just programming'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-8482165068304040115</id><published>2011-07-09T13:28:00.001+01:00</published><updated>2011-07-09T13:32:31.662+01:00</updated><title type='text'>Is Switch by definition a Code Smell?</title><content type='html'>I am fed up of coming across this kind of shite code all the time, whenever I need to fix a bug I need to change 400 things not 1 thing.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-attachment: initial; background-clip: initial; background-color: #22282a; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #f1f2f3; font-family: &#39;Courier New&#39;; font-size: 8pt;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp; &amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;CrapiolaManager&lt;/span&gt;&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;ICrapiolaManager&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt;&amp;nbsp;DoSomething(&lt;span style=&quot;color: #678cb1;&quot;&gt;SomeEnumOfTypesWtf&lt;/span&gt;&amp;nbsp;someType)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(someType&amp;nbsp;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;SomeEnumOfTypesWtf&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomeType1)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #66747b;&quot;&gt;//1. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(someType&amp;nbsp;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;SomeEnumOfTypesWtf&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomeType2)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #66747b;&quot;&gt;//2. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(someType&amp;nbsp;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;SomeEnumOfTypesWtf&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomeType3)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #66747b;&quot;&gt;//3. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(someType&amp;nbsp;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;SomeEnumOfTypesWtf&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomeType4)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #66747b;&quot;&gt;//4. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt;&amp;nbsp;(someType&amp;nbsp;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;SomeEnumOfTypesWtf&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomeType5)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #66747b;&quot;&gt;//5. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;throw&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #678cb1;&quot;&gt;InvalidOperationException&lt;/span&gt;(&lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Invalid type passed&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;It’s absolutely nonsense!! We are using an object orientated language ffs! Can we not see the impact of the problems this kind of code leads too?&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Lots of bugs/issues!!!&lt;/li&gt;
&lt;li&gt;New stories take longer to do!!!&lt;/li&gt;
&lt;li&gt;Its duplication of code!&lt;/li&gt;
&lt;li&gt;It’s not easy to Test!!&lt;/li&gt;
&lt;li&gt;Not easy to read when you have to follow code through so many layers, you want a piece of logic in ONE place… Domain Model Entity?&lt;/li&gt;
&lt;li&gt;It’s a problem when a new type appears! Somehow the person working on the new type needs to magically pull out of his ass some knowledge to understand where all the switch’s and if’s are in the code to alter them to add a new case! Hmmm… I wonder how many of these if’s and switch’s &amp;nbsp;get missed when adding a new type? Oooo let me guess… ALL OF THEM! It’s completely unmaintainable rubbish!&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red; font-family: inherit;&quot;&gt;Having an interface on that manager is also completely pointless!&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
What’s it there for, are you going to create another manager from the same interface(highly unlikely)? Is it there for the Dependency Injection instead? Then I am sure you can inject it without an interface. Even if you’re going down this road asking yourself these questions, you may realise &#39;ooo&#39; the code is in the wrong place and we shouldn’t have Managers and Helpers littered everywhere! And this is another post all in itself (Say NO to managers/Helpers)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red; font-family: inherit;&quot;&gt;Throwing an exception if the type doesn’t exists is also crap!&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
I mean seriously if you were testing this and for some reason you never hit this if/switch statement after adding your new type, that exception will never be thrown!! Oh yes and I guarantee it will be thrown when a user uses it!&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;BIG Problem!&lt;/li&gt;
&lt;li&gt;Support costs!&lt;/li&gt;
&lt;li&gt;Customer trust levels!&lt;/li&gt;
&lt;li&gt;The list carries on…&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;This code is a time bomb waiting to happen!&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;A suggestion to resolve this problem! (Not too much detail here)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;(This is the basics of the start of the fix but should pretty much be an answer for this issue). Hmmm… how about use an interface or a base class (depending on what you require) and derive these types from that interface/base class to force implementation of the method that does the work in them dumb ass if’s and switch’s! It takes 2 minutes to write, and &lt;b&gt;NOT&lt;/b&gt; 2 days to fix bugs when adding new types!&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 8pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp; &amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;interface&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IDoSomething&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; DoSomething();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;DoSomehting1&lt;/span&gt; : &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IDoSomething&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; DoSomething()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//1. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;DoSomehting2&lt;/span&gt; : &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IDoSomething&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; DoSomething()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//2. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;DoSomehting3&lt;/span&gt; : &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IDoSomething&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; DoSomething()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//3. Do some work and calculations etc and more crap code...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;...&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;DoTheWork&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;51&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Work(&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IDoSomething&lt;/span&gt; doSomething)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;52&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;53&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//The object does the work not some external object that would be a nightmare to maintain.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;54&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doSomething&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;DoSomething();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;55&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;56&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//The above is called instead of doing...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;57&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//ICrapiolaManager someManager;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;58&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//someManager.DoSomething();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;59&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;60&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;It’s not all about finishing as fast as possible and just letting your fingers typing your brain farts for 100% of the day, surprisingly it’s a very high amount of THINKING! The chances are when you come to the solution in your head after thinking around all the issues, scenarios and solutions to the problem you will find you will hardly type any code!&lt;/div&gt;&lt;br /&gt;
Here is a &lt;a href=&quot;http://c2.com/cgi/wiki?SwitchStatementsSmell&quot;&gt;link &lt;/a&gt;I found very quickly (I am not sure who it is by) on the issue there is a lot of info here and was hoping to find something by the main man himself &lt;a href=&quot;http://martinfowler.com/&quot;&gt;Martin Fowler&lt;/a&gt; who we should all know and love! It pretty much goes over a lot of issues with using a switch (or ifs in our case from this code, it’s the same thing) in an OO language. IMO we should be able to turn the ‘switch’ and ‘if’ statements OFF in the compiler and to be only allowed to turn them on where we need them, more than likely in the Domain Model Entities only!&lt;br /&gt;
&lt;br /&gt;
I can’t stress how important something as simple as this is, It’s a simple piece of code and if thought about for at least 30 seconds, the problem could be solved much more elegantly and safely. If you’re unsure on something don’t hesitate to ask the question to a colleague. I don’t have all the answers but I can see some of them. Just by asking the question sometimes you actually answer it yourself without hearing an answer (I do that a LOT).&lt;br /&gt;
&lt;br /&gt;
If this doesn’t seem to be an important issue to you and want to continue to switch and if on types I am sure there are plenty of job opportunities out there as a farmer! Let us developers write robust code and not fix someone else&#39;s problems all the time.</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/8482165068304040115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/07/is-switch-by-definition-code-smell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/8482165068304040115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/8482165068304040115'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/07/is-switch-by-definition-code-smell.html' title='Is Switch by definition a Code Smell?'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-7488791990303197083</id><published>2011-03-07T22:14:00.015+00:00</published><updated>2011-03-22T20:02:00.455+00:00</updated><title type='text'>Nhibernate, Unit Of Work, Repository and StructureMap</title><content type='html'>This could be a long blog...&lt;br /&gt;
&lt;br /&gt;
Well I have spent some time recently trying to understand how to tie all this lot together and I think I have finally cracked it in its simplest form, I am hoping at least. This is my first stab at it and I am already thinking of changing it slightly, but I want to show what I did first.&lt;br /&gt;
If there is anything you don&#39;t like on here or want to question please come and comment as I would love to get some feedback on what people thought of this. Problematic, see problems with it or even helped to understand it better.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;NHibernate&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
So first of all I modelled a simple domain, just an account user and mapped this to NHibernate to do its thing with the db. Understood then that the&amp;nbsp;NHibernate&#39;s&amp;nbsp;SessionFactory should be once per application as its very expensive to create and that ISession is what to use every time you want to make a single or group of changes to the db, or to just retrieve anything.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Code that I Wanted/Needed&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
So the following are the general things I used and set up simply as possible for now.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;b&gt;Repository&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;/i&gt;&lt;/u&gt;First off I read up loads of articles on creating a repository to wrap up simple&amp;nbsp;NHibernate commands. This could be extended in the future to provide a more advanced implementation. Some would argue not to have the repository at all and use the&amp;nbsp;NHibernate&amp;nbsp;calls directly. I like the idea of keeping the repository implementation as I am hoping it decouples NHibernate from the application (don&#39;t know why I will ever need to not use&amp;nbsp;NHibernate&amp;nbsp;yet but its there). I would like to be able to create as many of these as I would like although at the moment I am unsure why I would need more than 1 per thread. This will contain a UnitOfWork.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;5&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Repository&lt;/span&gt; : &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IRepository&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;readonly&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt; _unitOfWork;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; Repository(&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt; unitOfWork)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _unitOfWork &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; unitOfWork;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #a082bd;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #region&lt;/span&gt; IRepository&amp;lt;AccountUser&amp;gt; Members&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; T GetById&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;T&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;(&lt;span style=&quot;color: #678cb1;&quot;&gt;Guid&lt;/span&gt; id)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;return&lt;/span&gt; _unitOfWork&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CurrentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Get&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;T&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;(id);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Add&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;T&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;(T entity)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _unitOfWork&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CurrentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SaveOrUpdate(entity);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Remove&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;T&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;(T entity)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _unitOfWork&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CurrentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Delete(entity);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #a082bd;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;b&gt;UnitOfWork&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
This implements IDisposable and&amp;nbsp;is what I used to manage the transaction of the&amp;nbsp;NHibernate&amp;nbsp;session.&amp;nbsp;I would like it to dispose of the session once its been commited or rolledback, it just has a simple commit and rollback and manages to close the session. The session and transaction is created in the constructor here, so the UnitOfWork is ready to be commited or rolledback. The more I am typing here the more I am feeling this class is clunky around the edges of cleaning up. I am not sure if I need to rollback the transaction by default in the dispose if its active already, or whether the Session manages maintains that on a dispose of itself? If anyone knows let me know :-)&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;6&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;UnitOfWork&lt;/span&gt; : &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;readonly&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;ISessionFactory&lt;/span&gt; _sessionFactory;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;ISession&lt;/span&gt; _currentSession;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;readonly&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;ITransaction&lt;/span&gt; _currentTransaction;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; UnitOfWork(&lt;span style=&quot;color: #8c8cb4;&quot;&gt;ISessionFactory&lt;/span&gt; sessionFactory)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _sessionFactory &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; sessionFactory;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _currentTransaction &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; CurrentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;BeginTransaction();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #a082bd;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #region&lt;/span&gt; IUnitOfWork Members&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;ISession&lt;/span&gt; CurrentSession&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;get&lt;/span&gt; { &lt;span style=&quot;color: #93c763;&quot;&gt;return&lt;/span&gt; _currentSession &lt;span style=&quot;color: #e8e2b7;&quot;&gt;??&lt;/span&gt; (_currentSession &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; _sessionFactory&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;OpenSession()); }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;ITransaction&lt;/span&gt; BeginTransaction()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;return&lt;/span&gt; _currentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;BeginTransaction();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Commit()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (_currentTransaction&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;IsActive)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _currentTransaction&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Commit();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Rollback()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (_currentTransaction&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;IsActive)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _currentTransaction&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Rollback();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #a082bd;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #a082bd;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #region&lt;/span&gt; IDisposable Members&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Dispose()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (_currentSession &lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;null&lt;/span&gt;) &lt;span style=&quot;color: #93c763;&quot;&gt;return&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _currentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Dispose();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _currentSession &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;51&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;52&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;53&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #a082bd;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;54&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
As you can probably see there is no creation of the interfaces SessionFactory or UnitOfWork in repository and this is where I have used StructureMap to help out.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;StructureMap&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
I went the Ninject route initially as it had a cool looking site and seemed quite nice to use also. I managed to achieve what I wanted with it and it wasn&#39;t difficult at all but I wont show that here. I researched further into which DI/IOC to use and I kind of had a good feel for what people were saying about StructureMap so I changed to use StructureMap instead.&lt;br /&gt;
OK so I figured I needed&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;1 SessionFactory per application running.&lt;/li&gt;
&lt;li&gt;1 UnitOfWork per thread running.&lt;/li&gt;
&lt;li&gt;No limit to the number of Repositories. (not sure why this can&#39;t be 1 instance per thread also but I don&#39;t think there is harm in having more than 1 as it will use the same UnitOfWork if its in the same thread.)&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 8pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;ContainerBootstrapper&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; BootstrapStructureMap()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #678cb1;&quot;&gt;ObjectFactory&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Initialize(x &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;ForSingletonOf&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;ISessionFactory&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;()&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;UseSpecial(y &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;ConstructedBy(context &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; nhConfig &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Fluently&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Configure()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Database(&lt;span style=&quot;color: #678cb1;&quot;&gt;MsSqlConfiguration&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;MsSql2008&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;ConnectionString(connstr &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; connstr&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;FromConnectionStringWithKey(&lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;db&quot;&lt;/span&gt;)))&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Mappings(mappings &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&amp;gt;&lt;/span&gt; mappings&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;FluentMappings&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;AddFromAssemblyOf&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #678cb1;&quot;&gt;AccountUser&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;())&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;BuildConfiguration();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;return&lt;/span&gt; nhConfig&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;BuildSessionFactory();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }));&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;For&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;()&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;HybridHttpOrThreadLocalScoped()&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Use&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #678cb1;&quot;&gt;UnitOfWork&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;For&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IRepository&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;()&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Use&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #678cb1;&quot;&gt;Repository&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;So in here, I am setting up the&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;1 single SessionFactory ever for the application. The x.ForSingletonOf&amp;lt;ISessionFactory&amp;gt; will sort this out. It uses the Fluent style configuration of the sessionFactory using the database connection and mappings from the domain model set up.&lt;/li&gt;
&lt;li&gt;Per thread UnitOfWork, we want this as we may have more than 1 save, update and delete on the same transaction, so when its injected into the repository its the same UnitOfWork that is used before the repository has begun to be used, I will show a test later on with this.&lt;/li&gt;
&lt;li&gt;Repository.&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;A Couple of Tests&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
I will try and show a couple of tests that I set up for this, and show how it could be used from the outside. I hope my tests aren&#39;t too bad, I know I find it difficult to write a good test, come slate them let me know what you would do, naming them something different? anything? I need to learn more about tests.&lt;br /&gt;
&lt;br /&gt;
Test to write data to the database was successful.&lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 8pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; 67&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [&lt;span style=&quot;color: #678cb1;&quot;&gt;TestMethod&lt;/span&gt;]&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;68&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Can_SaveSomeUserDataViaStructureMap()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;69&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;70&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #678cb1;&quot;&gt;ContainerBootstrapper&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;BootstrapStructureMap();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;71&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;72&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;using&lt;/span&gt; (&lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; uoW &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;ObjectFactory&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;GetInstance&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;())&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;73&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;74&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; repo &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;ObjectFactory&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;GetInstance&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IRepository&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;75&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; newUser &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;AccountUser&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;76&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;77&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Name &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Test&quot;&lt;/span&gt;, &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;78&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Email &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Email Test&quot;&lt;/span&gt;, &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;79&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Password &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Password Test&quot;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;80&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;81&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; newUser2 &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;AccountUser&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;82&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;83&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Name &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Test2&quot;&lt;/span&gt;, &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;84&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Email &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Email Test&quot;&lt;/span&gt;, &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;85&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Password &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Password Test&quot;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;86&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; };&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;87&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; repo&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Add(newUser);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;88&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; repo&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Add(newUser2);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;89&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;90&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uoW&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Commit();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;91&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;92&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Clear the session so its forced to go to the database and not pull from the cache&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;93&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uoW&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CurrentSession&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Clear();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;94&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;95&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; returnedAccountUser &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; repo&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;GetById&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #678cb1;&quot;&gt;AccountUser&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;(newUser&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Id);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;96&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #678cb1;&quot;&gt;Assert&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;AreEqual(&lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Test&quot;&lt;/span&gt;, returnedAccountUser&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Name, &lt;span style=&quot;color: #ec7600;&quot;&gt;&quot;Failed to get user from database.&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;97&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;98&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
so this test was to tell me that I could write more than 1 thing to the database at the same time on the same UnitOfWork. I did use the &lt;a href=&quot;http://nhprof.com/&quot;&gt;nhibernate profiler&lt;/a&gt;&amp;nbsp;to spy on a little of what was going on here, which may I add is superb, easy to use, understand and set up. Going back to the test though, the UnitOfWork and StructureMap did their job nicely and only created one of them. One UnitOfWork was created as part of the &#39;using&#39; and the one that was injected into the Repository creation (on line 74 of the test) was the same one. Superb! The data was added, the UnitOfWork commited and job done. I cleared the session at this point to force nhibernate to fetch the data from the database again rather than retrieve it from its cache.&lt;br /&gt;
&lt;br /&gt;
Test to prove that there was a different UnitOfWork created when created in another thread.&lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 8pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;110&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; [&lt;span style=&quot;color: #678cb1;&quot;&gt;TestMethod&lt;/span&gt;]&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;111&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; Must_HaveNewSessionPerUoWPerThread()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;112&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;113&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #678cb1;&quot;&gt;ContainerBootstrapper&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;BootstrapStructureMap();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;114&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Create this instance on this thread.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;115&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; uoW &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;ObjectFactory&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;GetInstance&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;116&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt; uoW2;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;117&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;118&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; thread &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Thread&lt;/span&gt;(x &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;119&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;120&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; uoW2 &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;ObjectFactory&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;GetInstance&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #8c8cb4;&quot;&gt;IUnitOfWork&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt;();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;121&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #678cb1;&quot;&gt;Assert&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;AreNotSame(uoW, uoW2);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;122&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #678cb1;&quot;&gt;Assert&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;AreNotSame(uoW&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CurrentSession, uoW2&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CurrentSession);&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;123&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;124&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; thread&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Start();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;125&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;/div&gt;with this test I am thinking along the lines I could use the UnitOfWork per HttpRequest using MVC some where along the lines, creating the UnitofWork in ActionExecting maybe and the commit/rollback on what ever the opposite one is. When I get to working that out I will post that next I think.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Changes I would like to make for an MVC web application.&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
I will get round to bloging what I did for this, but for short I am considering&amp;nbsp;removing the UnitOfWork and Repository all together and let StructureMap create the Session and inject it into the controller constructors when they are created, but my only hesitation in this is that it will couple NHibernate to the controllers as they will need an ISession injected into them and also need to manage the Transaction.</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/7488791990303197083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/03/nhibernate-unit-of-work-repository-and.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7488791990303197083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/7488791990303197083'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/03/nhibernate-unit-of-work-repository-and.html' title='Nhibernate, Unit Of Work, Repository and StructureMap'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-48500847400778729</id><published>2011-02-28T22:35:00.000+00:00</published><updated>2011-02-28T22:35:17.326+00:00</updated><title type='text'>Just a quick fix, just a quick fix, boom! Game Over Man!... Game Over...</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;What are these quick fixes? Are they the start of the end? Or is it already too late, as when you&#39;ve found there are a few quick fixes, does that mean there are thousands of them in already, more than likely yes!&lt;br /&gt;
&lt;br /&gt;
What causes them?&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Friday afternoon?&amp;nbsp;&lt;/li&gt;
&lt;li&gt;No time as other things are important to get done? But what is more important than the current fix you are doing, if you have to rush it to get onto something else, then don&#39;t do it!&lt;/li&gt;
&lt;li&gt;Because it doesn&#39;t break any unit tests?&amp;nbsp;Are then the tests written correctly, if they are stopping quality being writing?&lt;/li&gt;
&lt;li&gt;Is it the lack of pride and care in what one is doing, or any thought for one&#39;s colleagues as one is not going to be around long enough when these fixes come back to bite you in the ar!*e!&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
All these questions and no answers, not sure I can give any answers yet, but if I find some I will surely post back here.&lt;br /&gt;
&lt;br /&gt;
Is this what agile is? Do a fix in the first place you can see the easiest place? Or is it to refactor code into the correct places to fix the issue, maybe its neither?&lt;br /&gt;
&lt;br /&gt;
What do the sum of these quick fixes add up too? I tell you what! A bloody mess of looking at random, undocumented code here, there and everywhere, slow down of progress, and skewed estimations. Code spread, where these fixes are not structured in the correct layer! More than likely more fixes will be required to fix the fixes! Superb! That&#39;s some special mess!&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Are developers being continuously squeezed to write code to be “finished” rather than “completed with quality”? Or do developers wear blinkers and only see progress as a happy product owner? Is there a way to prove this?&lt;br /&gt;
&lt;br /&gt;
Time is always squeezed and quality drops! This will inevitably get worse over time ‘Mr Anderson’…&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Well commented code, we hopefully don’t need too most of the time (well you shouldn&#39;t so much) as the code is readable (isn&#39;t it, you good coders you), but the more quick fixes (I suspect highly uncommented)… ...who knows what randomness is being produced.&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;I guess there is a time line where the quick fix is fine, for a small, completed, un-evolving project. Are there such projects, really?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;I recently came across an interesting&amp;nbsp;&lt;a href=&quot;http://elegantcode.com/2011/02/25/book-review-driving-technical-change-why-people-on-your-team-dont-act-on-good-ideas-and-how-to-convince-them-they-should/&quot;&gt;article&lt;/a&gt;&amp;nbsp;and I haven&#39;t looked into it yet, but could be very interesting. Convincing team members that something is a good idea.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/48500847400778729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/just-quick-fix-just-quick-fix-boom-game.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/48500847400778729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/48500847400778729'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/just-quick-fix-just-quick-fix-boom-game.html' title='Just a quick fix, just a quick fix, boom! Game Over Man!... Game Over...'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-8958130887242013310</id><published>2011-02-26T11:22:00.002+00:00</published><updated>2011-03-28T19:42:23.013+01:00</updated><title type='text'>Calling all Devs, Calling all Managers (if that&#39;s what you can call them)</title><content type='html'>Seriously! The guys in my links need to be followed by all Devs and Managers especially. I&#39;ve only just started doing this reading myself, but quickly realising that these guys are well worth reading.&lt;br /&gt;
&lt;br /&gt;
Just read them, they are not big articles. They make a lot of sense and are very experienced people, so why wouldn&#39;t we want to listen to them absolutely confuses me.&lt;br /&gt;
&lt;br /&gt;
Its probably wise to be spending some time, reading at least one article a day, and/or learning one new feature of a piece of software that we use every day/week. Visual Studio or Resharper or maybe some software framework you are using, automapper, nhibernate, etc. I am trying to do this but not&amp;nbsp;religiously&amp;nbsp;yet. I will get there.&lt;br /&gt;
&lt;br /&gt;
I have also just been recently told that &amp;nbsp;looking at somebody elses source code once a week, also helps. I have not done this yet but I think I am going to start. I&#39;m going to start with Jimmy Bogard&#39;s Automapper. Take a look around see how he does things, learn any ideas from it hopefully and also how he writes his code and his unit tests, especially his unit tests as I&#39;m finding this difficult to understand how these are meant to be written at the moment.&lt;br /&gt;
&lt;br /&gt;
If I learn something I will report back on my blog some where hopefully.&lt;br /&gt;
I think I hear you ask where the hell do you get the time to do any of this, well don&#39;t worry I am also asking myself this question, and now I am writing a blog too! I still want to do all the above and more...&lt;br /&gt;
&lt;br /&gt;
I&#39;ll be adding more links to articles I find in here and to &#39;My Links&#39; also.&lt;br /&gt;
&lt;br /&gt;
Hope you find something useful from this, or if you have any more useful links,&amp;nbsp;let me know and I&#39;ll have a read and add them :-)&lt;br /&gt;
&lt;br /&gt;
Some links...&lt;br /&gt;
&lt;br /&gt;
Stand Up Meetings&lt;br /&gt;
&lt;a href=&quot;http://codebetter.com/jameskovacs/2011/03/28/stand-up-meetings-are-about-more-than-standing/&quot;&gt;http://codebetter.com/jameskovacs/2011/03/28/stand-up-meetings-are-about-more-than-standing/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Martin Fowler&lt;br /&gt;
&lt;a href=&quot;http://martinfowler.com/bliki/TradableQualityHypothesis.html&quot;&gt;http://martinfowler.com/bliki/TradableQualityHypothesis.html&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://martinfowler.com/bliki/TechnicalDebt.html&quot;&gt;http://martinfowler.com/bliki/TechnicalDebt.html&lt;/a&gt;&lt;br /&gt;
&lt;iframe align=&quot;left&quot; frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm.amazon.com/e/cm?t=angry0e-20&amp;amp;o=1&amp;amp;p=8&amp;amp;l=bpl&amp;amp;asins=0201485672&amp;amp;fc1=000000&amp;amp;IS2=1&amp;amp;lt1=_blank&amp;amp;m=amazon&amp;amp;lc1=0000FF&amp;amp;bc1=000000&amp;amp;bg1=FFFFFF&amp;amp;f=ifr&quot; style=&quot;align: left; height: 245px; padding-right: 10px; padding-top: 5px; width: 131px;&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/8958130887242013310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/calling-all-devs-calling-all-managers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/8958130887242013310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/8958130887242013310'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/calling-all-devs-calling-all-managers.html' title='Calling all Devs, Calling all Managers (if that&#39;s what you can call them)'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-2182195429699245493</id><published>2011-02-25T20:45:00.000+00:00</published><updated>2011-02-25T20:45:17.247+00:00</updated><title type='text'>42, 1, 0, temp1, fred, squid, WTF!</title><content type='html'>STOP IT! STOP IT! STOP IT!&lt;br /&gt;
&lt;br /&gt;
Seriously what do these numbers mean to anyone else looking at your code, or in fact to yourself when you come back in a week or two (in my case a day)?&lt;br /&gt;
&lt;br /&gt;
Damn magic numbers and random variable names, awesome tactics if you want to spend time looking at the same code day in and day out trying to figure out what they mean, especially when the same number means two different things in the database or even three. Genius!&lt;br /&gt;
&lt;br /&gt;
Use an enum damn it! Give those numbers meaning! Tell me what they are! Tell yourself what they are! Rather than me/you hunting through the damn code to try and work out what they mean!&lt;br /&gt;
&lt;br /&gt;
Name your variables something useful, and your methods too!&lt;br /&gt;
&lt;br /&gt;
not so nice way...&lt;br /&gt;
&lt;!--StartFragment--&gt; &lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt; &lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; 15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; CheckEngineManagement()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Call something to get the data of the engine.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; engineData &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; GetEngineData();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (engineData&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;State &lt;span style=&quot;color: #e8e2b7;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #ffcd22;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (engineData&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;State &lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #ffcd22;&quot;&gt;1&lt;/span&gt;)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Do some engine checks for oil, &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//seatbelt checks etc, blah blah, &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//or something else&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;!--EndFragment--&gt;&lt;br /&gt;
I seem to be stuck in the car world at the moment, I will have to think of some better examples.&lt;br /&gt;
So there are the different types of EngineData coming back from the database, all in the same table with a column to state the different type. Maybe bad maybe not, but I am trying to find an example.&lt;br /&gt;
&lt;br /&gt;
I get my engine data back for a particular car, ferrari engineData, superb, then I do a check on the State if it&#39;s less than zero don&#39;t do anything, if it&#39;s 1 then do something. IF IT&#39;S 1, IF IT&#39;S 0 WTF does that mean? The door is open, ignition is on, car started, what!? Especially for different engine data 1 could mean something else and it probably does when written magically!&lt;br /&gt;
&lt;br /&gt;
nicer way hopefully...&lt;br /&gt;
&lt;!--StartFragment--&gt; &lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt; &lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;enum&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarState&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CarLocked,&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; PassengerOpen,&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DriverDoorOpen,&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; KeyInIgnition,&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;!--EndFragment--&gt;&lt;br /&gt;
&lt;!--StartFragment--&gt; &lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt; &lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; 23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; CheckEngineManagement()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Call something to get the data of the engine.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;var&lt;/span&gt; engineData &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; GetEngineData();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (engineData&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;State &lt;span style=&quot;color: #e8e2b7;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarState&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;CarLocked)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;if&lt;/span&gt; (engineData&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;State &lt;span style=&quot;color: #e8e2b7;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarState&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;DriverDoorOpen)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Do some engine checks for oil, &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//seatbelt checks etc, blah blah, &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//or something else&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background: #293134; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;!--EndFragment--&gt;&lt;br /&gt;
Ignore the nasty if nesting, I will have to think of a better example, but I can&#39;t at the moment I am fuming!&lt;br /&gt;
I have taken away all the nasty numbers, now you can read that the car is locked or the driver door is open and see what its trying to do and why its doing its checks for oil, seatbelt checks etc. not having to spend a larger amount of time understanding the whole code to work out what the numbers are and why they are there!&lt;br /&gt;
&lt;br /&gt;
Sooner or later those ifs would have ended up all over the place nested like crazy with a mix of the engine data type amongst it all no doubt, can you imagine trying to read all that lot with just numbers?&lt;br /&gt;
&lt;br /&gt;
Give me a slap for nesting if&#39;s like that, probably could have used a switch or probably even something else. Or suggest a better idea for my demonstrations. Or just a slap anyway. I am just trying to get some of the simpler things across at the moment.</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/2182195429699245493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/42-1-0-temp1-fred-squid-wtf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2182195429699245493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2182195429699245493'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/42-1-0-temp1-fred-squid-wtf.html' title='42, 1, 0, temp1, fred, squid, WTF!'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-2153068276252228604</id><published>2011-02-24T20:22:00.000+00:00</published><updated>2011-02-24T20:22:16.875+00:00</updated><title type='text'>Polymorphism, really... what&#39;s that...? omg you need a slap in the face!</title><content type='html'>Well it begins...&lt;br /&gt;
Before I start I have to admit I am also guilty of this but it needs to come out.&lt;br /&gt;
&lt;br /&gt;
Why the hell do I have to see code with 4 million &lt;i&gt;if&lt;/i&gt;&amp;nbsp;and &lt;i&gt;switch&lt;/i&gt;&amp;nbsp;statements, especially when its switching or if&#39;ing on an enum called &amp;lt;some name&amp;gt;Type and of course to get me more mad, yes its in the base class too, what a genius, what the hell are you doing!&lt;br /&gt;
&lt;br /&gt;
Yes that&#39;s right, it even has the postfix of &quot;Type&quot;, surely that has to give some kind of clue, that hmmmm, maybe this enum your switching on, shouldn&#39;t be there, and yes you can do it without having to switch, that&#39;s what polymorphism helps with, let me try to demonstrate...&lt;br /&gt;
&lt;br /&gt;
Its not a superb example, but its the first thing I could think of, hopefully I can change it to something better when I can think of something, but for now I am hoping I can get some of the point of polymorphism across.&lt;br /&gt;
&lt;br /&gt;
not so nice way...&lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;enum&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Ferrari,&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; MorrisMinor,&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; SomethingElse&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt; CarType { &lt;span style=&quot;color: #93c763;&quot;&gt;get&lt;/span&gt;; &lt;span style=&quot;color: #93c763;&quot;&gt;set&lt;/span&gt;; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; StartCar()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;switch&lt;/span&gt; (CarType)&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Ferrari:&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Car Senses key fob.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Car starts.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;MorrisMinor:&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Key fob turned.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Car starts.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomethingElse:&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Some random stuff to get this car to start&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;default&lt;/span&gt;:&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Do some default stuff to start all other cars.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Ferrari&lt;/span&gt; : &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; Ferrari()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CarType &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;Ferrari;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;51&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;52&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;MorrisMinor&lt;/span&gt; : &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;53&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;54&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; MorrisMinor()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;55&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;56&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CarType &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;MorrisMinor;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;57&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;58&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;59&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;60&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;61&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;SomethingElse&lt;/span&gt; : &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;62&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;63&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; SomethingElse()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;64&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;65&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CarType &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;CarType&lt;/span&gt;&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;SomethingElse;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;66&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;67&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;68&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; 70&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;71&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Some code somehwere to start the car you have.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;72&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ferrari &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; Ferrari();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;73&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var morrisMinor &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; MorrisMinor();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;74&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var somethingElse &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt;&amp;nbsp;SomethingElse();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;75&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ferrari&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;StartCar();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;76&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; morrisMinor&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;StartCar();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;77&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; somethingElse&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;StartCar();&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
So this has the 3 types of cars, and they all should start in a different way. When you create an instance of these cars and call StartCar they all call the same method, which then switches on some dodgy enum to distinguish the types, pffff.&lt;br /&gt;
&lt;br /&gt;
OK it works but a car doesn&#39;t need to ask itself if its a ferrari, or a morris minor. What happens if a new car comes out does that mean all the other cars then need to be upgraded to then ask itself if its the new car on the market? Therefore, increasing the switch/if statement every time. Sounds like that could be a nightmare to me.&lt;br /&gt;
&lt;br /&gt;
a nicer way...&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background: #22282a; color: #f1f2f3; font-family: Courier New; font-size: 10pt;&quot;&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; StartCar()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Do some default stuff to start all other cars.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;Ferrari&lt;/span&gt; : &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt; StartCar()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Car Senses key fob.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Car starts.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;MorrisMinor&lt;/span&gt; : &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt;&amp;nbsp; StartCar()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Key fob turned.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Car starts.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #678cb1;&quot;&gt;SomethingElse&lt;/span&gt; : &lt;span style=&quot;color: #678cb1;&quot;&gt;Car&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #93c763;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;void&lt;/span&gt;&amp;nbsp; StartCar()&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Some random stuff to get this car to start&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #66747b;&quot;&gt;//Some code somehwere to start the car you have.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ferrari &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; Ferrari();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var morrisMinor &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; MorrisMinor();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var somethingElse &lt;span style=&quot;color: #e8e2b7;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #93c763;&quot;&gt;new&lt;/span&gt; SomethingElse();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ferrari&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;StartCar();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; morrisMinor&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;StartCar();&lt;/div&gt;&lt;div style=&quot;margin: 0px;&quot;&gt;&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: #293134; background-image: initial; background-origin: initial; color: #3f4e49;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; somethingElse&lt;span style=&quot;color: #e8e2b7;&quot;&gt;.&lt;/span&gt;StartCar(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Ok here I have completely removed the enum, as its completely not needed. We already have the type, its a Ferrari, or MorrisMinor, the base class (Car) doesn&#39;t care.&lt;br /&gt;
&lt;br /&gt;
I have made the StartCar method a virtual method so all the base classes can now implement their own implementation, they have the knowledge on how to start themselves. So if a new car comes along they can then implement their own StartCar method, and no other car needs to know about it. If StartCar isn&#39;t implemented then the default one in the base class will be used.&lt;br /&gt;
&lt;br /&gt;
Look no more &lt;i&gt;switch &lt;/i&gt;or &lt;i&gt;if&lt;/i&gt;, its all gone. You now don&#39;t need to read complex code, well it wasn&#39;t complex as it was but when new types start appearing it will creep in there.&lt;br /&gt;
&lt;br /&gt;
I hope my explanation makes some sense, if you like, don&#39;t like, or would like to suggest something, let me know either way, or of course just slap me! I am learning here too :-) I think I can probably go into some more depth on how it works but at the moment I think I will leave that for now, hopefully there is enough there to understand the basics of getting rid of them nasty &lt;i&gt;if&#39;s &lt;/i&gt;and &lt;i&gt;switches.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I am not sure if there is any kind of excuse to have to do the &quot;not so nice way...&quot;, maybe I am missing something, but I know its easily done, done it myself. Maybe its a lack of time and pressure and your brain only thinks like a &#39;C&#39; coder in straight lines (sorry &#39;C&#39; coders out there I used to be one too, very long time ago, and if I am wrong there, please tell me and give me a slap!). I really don&#39;t know as I am sure the second way is actually less code and thinking.&lt;br /&gt;
&lt;br /&gt;
That&#39;s another thing what gets on my tits too is seeing OO code written like &#39;C&#39; (before I explode screaming, I will have to save that for another blog)&lt;br /&gt;
&lt;br /&gt;
Hmmmm, I wonder if its possible to write code without &lt;i&gt;if&#39;s&lt;/i&gt;, yes ban them, maybe bring a flag out in the compiler you can turn them off! I think that&#39;s another post rant too.&lt;br /&gt;
&lt;br /&gt;
I can&#39;t believe I keep generating new ideas for a blog post without having even thought about it before. This bloging/ranting is superb! I recommend you try it.&lt;br /&gt;
&lt;br /&gt;
Hopefully I will get to some more complex things in the future, but I guess I am learning to write too at the moment.</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/2153068276252228604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/polymorphism-really-whats-that-omg-you.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2153068276252228604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2153068276252228604'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/polymorphism-really-whats-that-omg-you.html' title='Polymorphism, really... what&#39;s that...? omg you need a slap in the face!'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-1341034478704762327</id><published>2011-02-22T21:39:00.000+00:00</published><updated>2011-02-23T23:08:28.489+00:00</updated><title type='text'>More why&#39;s and how&#39;s...</title><content type='html'>Well it has to be said a big thanks to a couple of new colleagues I have worked with recently as to why I am doing this. That is to a &lt;a href=&quot;http://twitter.com/#!/maverickcoder&quot;&gt;Justin Blackwell&lt;/a&gt; (I am sure Justin will have something somewhere to link) and a &lt;a href=&quot;http://blog.simonlovely.com/&quot;&gt;Simon Lovely&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
With the introduction to &lt;a href=&quot;http://skillsmatter.com/&quot;&gt;Skills Matter&lt;/a&gt;&amp;nbsp;and heading off to only a couple of free talks, this started to get my taste for really understanding things and bettering my skills, thought nothing of it really as it was only a little tingling.&lt;br /&gt;
Only been to 2 of them, that was&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;with &lt;a href=&quot;http://www.udidahan.com/&quot;&gt;Udi Dahan&lt;/a&gt; and a talk on CQRS, was bloody brilliant! really got me thinking about a few things, really interesting.&lt;/li&gt;
&lt;li&gt;and the other was with &lt;a href=&quot;http://www.ayende.com/&quot;&gt;Ayende Rahien&lt;/a&gt; with a kind of talk on how to go about making software that people want, the WOW factor!&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;Both of them superb! But also makes you realise the ton of crap that is out there!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Then talking to Simon and Justin more they introduced me to a lot of new blogs (well I say &#39;new&#39; what I really mean is my first blogs and people to start following and read up about).&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Unbelievable I was in this cloud of denial for so long, the stuff I started to learn from a few of these posts... well... that tingle became a bit more than a tingle, now my passion started to grow more for learning and picking up new things, what people were up to out there and what was about and around the corner.&lt;br /&gt;
I still can&#39;t find something these guys don&#39;t know about yet, will do one day ;-) lol&lt;br /&gt;
&lt;br /&gt;
They then mentioned to me DDD9 was coming up, well of course me sitting there in my cloud &quot;What the hell does that mean?&quot;. Of course found out off them what it was and I think I actually managed to register before them, in the end I had to remind them to apply ;-) (Check me out!) Well went along and absolutely thoroughly enjoyed what I saw and the guys delivering the talks. (Probably will try and talk about this day in another post if I remember between my angry rants)&lt;br /&gt;
&lt;br /&gt;
Unbelievably I think I have learnt more in the last several months than in the last 10 or so years career in &amp;nbsp;software development. I noticed with these guys they seemed to know hell of a lot about all sorts of fields of programming and there I am, well I know C++, I know .NET C# (I thought I did at least) I know databases and to layer stuff nicely so code is grouped nicely, all the kind of OO around it all to make it lovely and maintainable. (well it was a bit more than that I hope...).&lt;br /&gt;
&lt;br /&gt;
OMG when I started to have words thrown at me like:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;ORM&#39;s (I actually started doing my own ORM as I thought it would be an awesome idea, but I didn&#39;t know that it was an ORM I was actually creating), what a nugget...!&lt;/li&gt;
&lt;li&gt;DI, IOC,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Document DB&#39;s,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Automapper,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Linq,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;CQRS,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;patterns(which I used without realising they were patterns already),&amp;nbsp;&lt;/li&gt;
&lt;li&gt;I am sure there is more, but can&#39;t think of any at the moment&lt;/li&gt;
&lt;/ul&gt;then all the names of software that can handle all this stuff, my brain pretty much exploded and I was blocked with all this information overload. I was then curious on how the hell these guys knew it, done it, learned about it, etc..&lt;br /&gt;
&lt;br /&gt;
I found out... well I think I have... could be different for everyone, following blogs, posts, trying a couple of things out, and now to actually to write down what I think, will hopefully imprint it into my brain more.&lt;br /&gt;
&lt;br /&gt;
Inspired and a hunger for knowledge is an understatement, I want to write about so much stuff, so I can get my understanding across to who ever may want to look at it. Knowing deep down I am learning hardcore style. Maybe someone else will learn off me, now that would be awesome feedback!&lt;br /&gt;
Maybe I will get the balls and start posting on &lt;a href=&quot;http://stackoverflow.com/&quot;&gt;Stack Overflow&lt;/a&gt; but one thing at a time hey ;-)&lt;br /&gt;
&lt;br /&gt;
Actually I have already learned from my first blog, maybe only a small thing but its the fact now I remember who that guy was who wrote that article about something, &lt;a href=&quot;http://www.codinghorror.com/blog/2011/02/how-to-write-without-writing.html&quot;&gt;Jeff Atwood&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Well thanks for reading again... who ever is out there&lt;br /&gt;
Rants incoming...</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/1341034478704762327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/more-whys-and-hows.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/1341034478704762327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/1341034478704762327'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/more-whys-and-hows.html' title='More why&#39;s and how&#39;s...'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243392047581674096.post-2805752669115121933</id><published>2011-02-21T22:55:00.000+00:00</published><updated>2011-02-21T22:55:36.550+00:00</updated><title type='text'>My First EVER Post!</title><content type='html'>&lt;div&gt;Well here it is...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;Its about time I have started this, I&#39;ve been putting it off far too long, well I say putting it off, I probably mean ignoring, denying, refusing that these things exist, and that I have actually anything important to say. I then realised maybe its not that I may not have anything important to say, I may do, its more about&amp;nbsp;practising&amp;nbsp;to write better, formulate ideas, maybe be able to provide solutions to problems too, and I guess most importantly if possible to get feedback of any sort, what a great way to learn ;-).&amp;nbsp;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Two things kicked me over the edge to crack on and start writing:&lt;div&gt;&lt;ul&gt;&lt;li&gt;this &lt;a href=&quot;http://www.codinghorror.com/blog/2011/02/how-to-write-without-writing.html&quot;&gt;post&lt;/a&gt; by Jeff Atwood, great post! Anyone who is half thinking of or maybe denying the existence of bloging, writing like I was, take a read... let me know how you feel afterwards ;-)&lt;/li&gt;
&lt;li&gt;and starting to write an angry email about the absolute school boy error code that I seem to have to put up with, and realising maybe I should blog.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;...then the idea was formed, AngryWelshCoder, because I was spitting feathers at my computer, I am Welsh and a coder too hopefully.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;I am still learning these kind of gadgets and also how to write too, so hopefully my practice will give me a better knowledge on these things and also how to write, I can&#39;t wait...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;This blog may change about too, as I am still getting used to how all this stuff works. How much shall I write about? Am I allowed to swear? Should I apologise now up front for all my future posts that I will be so angry in? maybe... So much to think and write...&lt;/div&gt;&lt;div&gt;My brain is kind of running away with me at the moment in trying to get all this down...&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Should I stop my post now or shall I continue, I have no idea! I actually have plenty below this already that I am going to cut out and stick it another post... again about more why&#39;s and how&#39;s I got inspired to do this, but I promise after that I will start to get angry!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angrywelshcoder.blogspot.com/feeds/2805752669115121933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/my-first-ever-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2805752669115121933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243392047581674096/posts/default/2805752669115121933'/><link rel='alternate' type='text/html' href='http://angrywelshcoder.blogspot.com/2011/02/my-first-ever-post.html' title='My First EVER Post!'/><author><name>AngryWelshCoder</name><uri>http://www.blogger.com/profile/12614578847440461661</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>