Comments on: Static Methods Will Shock You https://simpleprogrammer.com/static-methods-will-shock-you/ Mon, 19 Sep 2016 23:02:46 +0000 hourly 1 https://wordpress.org/?v=7.0 By: Robert https://simpleprogrammer.com/static-methods-will-shock-you/#comment-48 Wed, 02 Oct 2013 23:21:00 +0000 https://simpleprogrammer.com/?p=250#comment-48 In reply to Bill.

Yeah, I’m seeing this also. Guess 4 years later someone still doesn’t know how to write CSS. So should I trust their opinion on using static methods?!?!?

]]>
By: Errol https://simpleprogrammer.com/static-methods-will-shock-you/#comment-47 Thu, 12 Jul 2012 14:47:30 +0000 https://simpleprogrammer.com/?p=250#comment-47 Thanks for the post, was searching to see when static methods are useful and your post was a good summary. Keep up the blogging, helping peeps even two years after the original post!

]]>
By: jsonmez https://simpleprogrammer.com/static-methods-will-shock-you/#comment-46 Wed, 21 Apr 2010 17:03:31 +0000 https://simpleprogrammer.com/?p=250#comment-46 In reply to Jerod Houghtelling.

Good question. I have been meaning to follow up with a post on extension methods. Perhaps I will do one this week.

]]>
By: Jerod Houghtelling https://simpleprogrammer.com/static-methods-will-shock-you/#comment-45 Wed, 21 Apr 2010 16:54:38 +0000 https://simpleprogrammer.com/?p=250#comment-45 Do you plan on passing judgment on Extension Methods anytime soon? Our developers got in a argument about helper classes today and one developer is certain that extension methods are better. However, I think most of us agree that they are another form of helper classes.

]]>
By: jsonmez https://simpleprogrammer.com/static-methods-will-shock-you/#comment-44 Tue, 13 Apr 2010 15:57:10 +0000 https://simpleprogrammer.com/?p=250#comment-44 In reply to configurator.

Good questions.

System.Math: PI and E meet my requirements of being true global constants. Those values are never going to change, the context for them in almost any application we would build would be universal.

As far as the other methods in Math (and even PI and E to some degree), they are not discoverable by being in System.Math. They are OK as static methods, because they are truly functions, which do not touch other components of the system. They just do their thing and don’t have dependencies. They are also part of the base framework, which makes them less of a problem to be static.

But, I would still rather see a syntax like “32.Math.Cos(3)” which would be extension methods+ a grouping to make it so that I can discover the Math functions available that operate on an integer. This creates a cohesion to the data the static methods operate on, which makes them less “global”.

For System.IO.Path, File and Directory: I would prefer to see those as concrete classes. There really is not a need for them to be static. For example, lets say these classes were to be concrete and implement and interface. Then in your code, you could mock out the interface calls and not have to try to unit test classes that would have to write to the file system.

]]>
By: configurator https://simpleprogrammer.com/static-methods-will-shock-you/#comment-43 Tue, 13 Apr 2010 15:43:14 +0000 https://simpleprogrammer.com/?p=250#comment-43 How do you feel about System.Math? And about System.IO.Path, File and Directory?

]]>
By: Bill https://simpleprogrammer.com/static-methods-will-shock-you/#comment-42 Tue, 02 Feb 2010 10:01:32 +0000 https://simpleprogrammer.com/?p=250#comment-42 In reply to jsonmez.

Not sure what was going on, but on another machine – Windows7-64 IE8 – the text ran all the way from the left edge of the browser window to the right. ie, over the borders. So the black text on the indigo panels was virtually unreadable. Interestingly, on another PC – Windows7-32 IE8 – it works as you intended, with a white central panel. I’ll reboot the other machine tomorrow and see if it is still misaligned.

]]>
By: jsonmez https://simpleprogrammer.com/static-methods-will-shock-you/#comment-41 Mon, 01 Feb 2010 22:51:20 +0000 https://simpleprogrammer.com/?p=250#comment-41 In reply to theman.

Thanks! It is actually a Henna tattoo from on vacation in Hawaii. 🙂

]]>
By: jsonmez https://simpleprogrammer.com/static-methods-will-shock-you/#comment-40 Mon, 01 Feb 2010 22:50:07 +0000 https://simpleprogrammer.com/?p=250#comment-40 In reply to Bill.

Hmm, I am not sure what you mean there. I am not seeing anything that is hard to read. What browser are you using? I am looking at the page through Chrome and IE.

]]>
By: Bill https://simpleprogrammer.com/static-methods-will-shock-you/#comment-39 Mon, 01 Feb 2010 22:43:36 +0000 https://simpleprogrammer.com/?p=250#comment-39 The dark blue border colors make these posts virtually unreadable!

]]>