0

[DK]Uncle Bob om software projekter (min formulering)

by klh 11. marts 2009 04:33

Uncle Bob om software projekter:
"Tit haster vi igennem for at blive færdige til tiden, og sjusker for at gøre det hurtigere.

Men når vi sjusker os igennem opdager vi tit,  at det sjusk vi lavede for at blive hurtigt færdig,

er det der forsinker os og gør at vi bliver forsinkede."

 

Tags:

generelt | software

0

Craftmanship over heroics

by klh 28. november 2008 03:14

I read a good blog post the other day (http://softwarecraftsmanship.oreilly.com/news/2008/8/8/uncle-bob-on-craftsmanship-at-agile-2008)

It was a comment on a statment by Uncle Bob:  "Craftmanship over crap", but in the above mentioned blog post Dave Hoover modified the statement to "Craftmanship over heroics".

 

I have really taken this statement in, since it speaks to me.

 

So let me explain to you what it means to me:

Imagine having a carpenter work on your roof, while he works for you, you think it takes a lot of time. And furthermore repairing the roof is rather expensive.

 

So you talk to the carpenter and tell him that its taking too much time and its too expensive.

He says: "OK, I'll help your out, I'll cut 2 days off and some materiel costs as well"

Great your are satisfied, you have a good skilled carpenter (a craftman you think) who suggest he will get finished earlier and at a lower price. He is a real hero in your eyes!

 

So he finishes, you pay and everyone is happy.

 

Now a few years later there's a big storm and its raining.

Suddenly water is dripping down in your livingroom and kitchen.

So you call the carpenter and ask him what is wrong.

He replies: "Oh!, don't you remember we cut off two days? Well I didn't put on any roofing underlay, since it would take me two days, and the material costs as well, don't you remember we agreed on that?".

Naturally at this stage your are stunned, you thought you were working with a professional (A craftman), and then he chooses to do something like that !(trying to be a hero, but now he's not!)

 

Well this is a very strong analogy to the business of IT, there are lots of things (actually most of the things we do) that our customers don't understand, and hence they try to push us and make us cut the price.

So the question is are we going to not put in the roofing under lay, nobody will know - well at least not right now.

But when you cut corners here you are going to end up with being in big trouble.

 

So choose craftmanship over heroics.

kick it on DotNetKicks.com

Tags:

generelt | software

0

Skills of a good programmer

by klh 5. august 2008 16:48

I added a link to "Programmer Competency Matrix" a few days ago and have thought a bit about it :

Well all these skills are very fine, and you should strive to get them.


BUT don't forget that people do not want good looking and well crafted software.

People want something to help them solve their problem.
Look at twitter - a very successful service - but not very well crafted...
So to be a good developer you need to understand peoples need, and put that above your urge to create beautiful code...

But still you need to maintain that code in the future.

And you still might be successful and hence be able to scale (which seems to be the problem with twitter)

Tags:

generelt | software

0

VB and the My namespace

by klh 3. august 2008 05:16

I have been looking a little at the My namespace in VB, OK I'm a C# programmer comming from C++, so it was a giant step for me to create a new VB project.

 

But I must say that the My namespace is pretty impressive..

Here is some code I wrote to ping:

Public Class Form1

    Private Sub btnPing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPing.Click
        Dim outp As Boolean
        Label1.Text = "Pinging ..."
        Try
            outp = My.Computer.Network.Ping(tbxIP.Text)
            If outp = True Then
                Label1.Text = "It went well, I was able to contact the other computer"
            Else
                Label1.Text = "Not able to contact the remote computer"
            End If
        Catch ex As System.Net.NetworkInformation.PingException
            Label1.Text = "URL was not valid"
        Catch ex As InvalidOperationException
            Label1.Text = "No network connection is available"
        End Try
    End Sub
End Class

 

Pretty simple Huh?

Tags:

software | VB

1

ListViews and sorting by Date

by klh 19. februar 2008 06:05

In our company we have several GUIs with ListViews in them.

Now in some of the columns we have DateTimes that we wish to sort the ListView by.

To find the answer to sorting a ListView is rather simple. A google search reveals the following link (Please note: From Microsoft):

http://msdn2.microsoft.com/en-us/library/ms996467.aspx#Mtps_DropDownFilterText

Here an example of sorting by DateTime is displayed (Near the bottom), the code is as follows:

 

public int Compare(object x, object y)
    {
        int returnVal;
        // Determine whether the type being compared is a date type.
        try
        {
            // Parse the two objects passed as a parameter as a DateTime.
            System.DateTime firstDate =
                    DateTime.Parse(((ListViewItem)x).SubItems[col].Text);
            System.DateTime secondDate =
                    DateTime.Parse(((ListViewItem)y).SubItems[col].Text);
            // Compare the two dates.
            returnVal = DateTime.Compare(firstDate, secondDate);
        }
        // If neither compared object has a valid date format, compare
        // as a string.
        catch
        {
            // Compare the two items as a string.
            returnVal = String.Compare(((ListViewItem)x).SubItems[col].Text,
                        ((ListViewItem)y).SubItems[col].Text);
        }
        // Determine whether the sort order is descending.
        if (order == SortOrder.Descending)
            // Invert the value returned by String.Compare.
            returnVal *= -1;
        return returnVal;
    } 

 

However THIS IS WROING!!!

That is not the correct way to use Exception handling.

How many time would the column be something else than a DateTime - well is's hard to say, but maybe more than 80% of the time.

Knowing that Exception handling is for exceptionel behaviour and that it is slow, you should never use this way of doing things.

You should do a DateTime.TryParse:

public int Compare(object x, object y)
    {
        int returnVal;

        DateTime firstDate;
        DateTime secondDate;
        bool conversion1Succesful, conversion2Succesful;
        conversion1Succesful = DateTime.TryParse(((ListViewItem)x).SubItems[columnToSort].Text, out firstDate);
        conversion2Succesful = DateTime.TryParse(((ListViewItem)y).SubItems[columnToSort].Text, out secondDate);

        if ((conversion1Succesful && conversion2Succesful))
        {
            returnVal = DateTime.Compare(firstDate, secondDate);
        }
        else
        {
            returnVal = String.Compare(((ListViewItem)x).SubItems[columnToSort].Text, ((ListViewItem)y).SubItems[columnToSort].Text);
        }

        if (orderOfSort == SortOrder.Descending)
            returnVal *= -1;

        return returnVal;
    } 

It will speed up your sorting by decades ;-)

Tags:

C# | software

0

Source code til .net framework frigivet

by klh 18. januar 2008 10:35

Jeg har prøvet og det virker, bare følg vejledningen på Shawn Burke's blog.

Det var nøjagtig lige så let som beskrevet; Det der i første omgang overraskede mig var at det lader til at man skal sige 'Load symbols' hver gang man debugger, det har jeg dog ikke tjekket igennem. Men egentlig giver det nok meget god mening, for det er kun i særlige tilfælde man ønsker at steppe ind i frameworket.

Forøvrigt så sagde jeg endnu engang bare ja til licens betingelserne, uden at læse dem. Da jeg skulle acceptere dem sad jeg og tænkte, om jeg mon ved at accepterer sagde ja til noget 'farligt'. F.eks. kunne man vel godt forestille sig at der var nogle strukturer som Microsoft ikke vil have at jeg går ud at kopierer, specielt hvis jeg laver Open Source eller hva'?

Tags:

software

0

Om brug af WCF services

by klh 18. januar 2008 04:57

Rundt omkring på nettet findes mange WCF tutorials, der viser hvordan man bruger ChannelFactory til at lave en proxy udfra en Servicecontract.

 

Det virker også fint, men den anbefalede måde at lave det på er med følgende syntaks:

using (ServiceProxy proxy = new ServiceProxy(""))
            {
                string s = proxy.HelloWorld();
            }

 

Hér er ServiceProxy den proxy som eks. SVCUtil kan generere - den er en base klasse fra ClientBase....

 

Bemærk brug af Dispose via Using.

Der var på et tidspunk et problem med Channel caching ved brug af ClientBase, men det skulle være løst i .net 3.0 SP1

Tags:

software | WCF

0

Hvorfor det er vigtigt at lave asynkrone services i en SOA

by klh 20. november 2007 11:55

Der er flere grunde til at det er vigtigt at lave services i en SOA asynkrone:

1. For bedre concurrency 

2. For performance, for en nærmere forklaring se referencen i bunden af denne post

3. Det er muligt at overgive en besked til eks. en ESB og lade den stå og re-sende til der er forbindelse, i tilfælde af manglende forbindelse.

Reference:

http://www.rds.com/books/looselyCoupled/index.html

Tags:

software | SOA

1

Visual Studio 2008 og.NET 3.5

by klh 19. november 2007 15:43

Tags:

software | C#

0

svcutil

by klh 5. november 2007 10:02

Vi bruger SVCUTIL til to ting i øjeblikket:

1. Til at generere datacontracts udfra vores kanoniske datamodel

2. At generere proxies udfra vores datacontract dll'er

 

add 1:

Vi opbevarer vores kanoniske datamodel i xsd og kan generere datacontracts udfra en xsd således:

svcutil /dconly cdm.xsd

 

På den måde stemmer datakontrakterne altid overens med den kanoniske datamodel

add 2:

Når man gerne vil have WCF til at generere proxies udfra en service laver den en ny proxy hver gang, men vi vil gerne have den til at genbruge datacontracts, her kan svcutil hjælpe.

Jeg kan dog ikke huske syntaksen, men dasBlonde har et eksempel et sted....

Tags: , ,

software | SOA

Powered by BlogEngine.NET 1.4.5.0
Original Design by Laptop Geek, Adapted by onesoft