Look forward to reading it.
I sure hope it does!
Hmm.. interesting .. look forward to reading
Pingback from Dew Drop - July 28, 2008 | Alvin Ashcraft's Morning Dew
One of the larger places I used partial classes is for extending proxy's generated via wsdl.exe for Web Service's. Much of the time you need to extend the set of properties/methods on these proxy's.
A simple example, is that the old way which wsdl.exe worked is that it would only emit fields, not properties. And you can only databind to properties. So in this case we used to have to extend the partial class with the list of fields needed for binding...
I use partial classes when I use xsdgen to generate classes from xml files, I add methods to a partial class for it.
Recently I was working with an open source framework. There was a class that didn't have a method I wanted, so I added it using partial classes. This might be what MSDN had in mind, working with code that you don't own.
@Scott - good point, I had not thought of that. Would if have not been better to derive from that class though you wanted to extend? assuming it was not sealed of course.
I'm still pretty unconvinced that people do use partial classes inline with that 1st point on MSDN. Seems to be pretty much designer exclusive.
I have found partial classes very useful of late. While refactoring some classes I find it a lot easier to put deprecated code in a separate physical file, which allows me to navigate and focus on the good stuff a lot more easily.
@Guy - that actually sounds like a pretty clean solution to that sort of thing, I may have to *borrow* that idea sometime in the future.
According to our Coding standards document ... a class/file should not be more than 1500 lines.... so we use partial classes in order to manage our codes;
Pingback from Dew Drop - July 30, 2008 | Alvin Ashcraft's Morning Dew
I actually found a nice use for partial classes.
On some of my larger objects, I use partial classes to separate static methods from instance methods.
I like doing that a lot better than using Regions, which I really can't stand.
I haven't tried it, but I imagine that for very large classes, separate files could be created for properties, constructor, methods, statics, etc.
Bottom line is that I love having the option. Partial classes were a nice idea.
I've seen partial classes used to separate out static methods sometimes for organization purposes (as it is a better option than regions). One example of this is the Rhino.Commons.Util.With class:
rhino-tools.svn.sourceforge.net/.../With
Pingback from Dew Drop - August 4, 2008 | Alvin Ashcraft's Morning Dew
I'd like to add another thing... for asp.net developers it would be nice to have a more robust FTP built in. The one in the current version leaves alot to be desired. For instance, half the time when I try to just select a whole folder and upload it, it will create the folder on the remote site and then not upload any of the files inside of it. As it stands now, I end up using a second program to handle FTP.
@Jeff - totally agree. In fact I think I used the FTP in VS2005 a few times and came across the same problem so I swiftly moved to a 3rd party FTP app.
To be fair to the web guys the new stuff in VS2008 is leeps and bounds better than the VS2005 equivalents. I know this is largely down to Expression Web being thrown in there, buthte JavaScript intellisense is a plus as well. I *think* in VS2008 SP1 there are some further enhancements to the JS intellisense but off the top of my head I can't remember.
I think I'm almost famous. I'm mentioned 10:47 - 12:25. The mentioning was in response to my
It's because M$ Visual Source Safe doesn't have good support for merging patches. It's designed for checkout to block all other attempts to checkout.
collaborative editing a la subethaedit and eclipse
I saw a video actually on Google videos on YouTube the other day on the Eclipse collab stuff. Not made up my mind on the real-time collab stuff while you code, but I think it would be very useful for code reviews, etc.
In the first part we looked at the strategy pattern, in part 2 of this design patterns series we take
I think it’s quite a long while since Granville Barnett and Luca Del Tongo started their work on writing
If you need a fibonacci heap implementation, let me know (via email). I'm working on my own algorithm lib (bsd licensed, out this fall), but I think we are in the same boat that we want others to use algorithms which are discovered by very smart people sometimes decades ago, so the more spread these algorithms are, the better. :)
@Frans - Duly noted. Will follow this up via email.
Pingback from Reflective Perspective - Chris Alcock » The Morning Brew #167
Great news:
here is my "spreading of the word" :)
codeclimber.net.nz/.../data-structure-and-algorithms-ebook.aspx
Thanks Simone ;-)
Pingback from Dew Drop - August 28, 2008 | Alvin Ashcraft's Morning Dew
@Granville: you're welcome
It would be great if you reviewed so-called Cartesian Tree (Randomized Binary Search Tree, Treap). It allows to implement easily self-balanced tree without rotations but only through split/merge operations which are performed recursively in a simple manner.
Another good structure to include is Fenwick Tree (Bit indexed tree).
Thanks for the book!
Noted. Thanks for the suggestions Vadim.
please send datastructure book
Thanks a lot for covering these design pattern. As only thoese who have experienced the subject can really explain the howto stuff. Thanks. Any plan for covering other patterns such as decorator and singleton.
@Sam - I'll note them down as patterns to maybe write about. Thanks.
The content of the book looks really good. Are you planning to add graph? Also, I think it's better to add a sample code (just one language C#) in the book as well. I know it's going to be bulky.
We are only using pseudocode I'm afraid. The decision was made a while back and I think it is best.
Your use of the fibonacci series in the recursive versus iterative section can do with some extension and connection to your "Big Oh" discussion - the naive recursive version is O(n*n) in execution time, but you can not only rewrite it as iterative (for O(n) time), you can rewrite it as recursive with O(n) time if the return value carries F(n) and F(n-1), and you can further write it as iterative using matrix multiplication for O(lgN) time, or using floating point in O(1) time (assuming that pow(x,n) is O(1)).
Cheers,
Alun.
~~~~
@Alun - there are many ways we can write the fib series. We made the decision to use the version already implemented as its clearer than the versions that are a little faster. Also we don't see it as a *critical* algorithm. Its purely there for coverage, nothing more.
Pingback from Dew Drop - September 12, 2008 | Alvin Ashcraft's Morning Dew
Let us know how it goes. I've tried the dark colors before (Rob's) but I didn't like it for the first 5min I tried it so I dismissed them and haven't tried it again. I probably needed to let my eyes get used to the new dark colors first.
What I did instead is changed the background color a very light green while keeping all the other colors the same. The following combination is what i used.
Hue: 76
Sat: 240
Lum: 231
Red: 238
Green: 255
Blue: 236
@Chris - Understandable. I must say though a light green background?! Sounds a bit exotic!
It's a long time I use a dark theme in VS and other IDE. It's real convenient and often I ask myself why nobody else use this combination... Do you remember when any monitor was green on dark?
@Leonardo - Unfortunately I do remember. Back then it was at school on RM machines.
The major problem I have is that using a dark theme isn't consistent with other content you view, e.g. you have VS open using a dark theme and look at MSDN - flicking between the dark and light isn't that good for the eyes I imagine.
Indeed it's a matter of habit... When I look at anything but the code I feel right having the usual "something-on-white" with the smaller visible font dimension, but when I'm focused on the code I feel really easy using a dark background; moreover my font is Fixedsys, no way to use anything else and I found my workmates they are easy too when they work on my machine, but me, I have a lot of trouble when I use their settings... Keep the dark theme and in a couple of days you will not be able to go back. By the way... Never used glasses in 20 years of coding, maybe for that reason, or maybe I'm a lucky man ;)
If you wanted to experiment with different color settings for your themes, I have written a theme generator for Visual Studio. You import 3 colors and a contrast value and it outputs a vssettings file (it runs completely on the web and lets you preview before downloading)
frickinsweet.com/.../Theme.mvc.aspx
@Leonardo - Maybe its me but the switching between the light and dark just hits me as being too different. I think I prefer the dark on light. As for glasses I don't wear them either for the computer, but I do need them for long distance(short sighted).
@Ryan - Thanks for the link. I actually saw that a few weeks back I believe.
Excellent article! very well written, I thought, however, you could improve your thread safe version by adding an additional check before locking the resource. If the s_instance variable is already set there would be no reason to lock the object. In effect a double check.
if (s_instance == null)
{
lock (s_syncLock)
s_instance = new PrimeMinister();
}
return s_instance;
cheers!
Thanks Mark. Personally I prefer the version provided at the end - the lock-free one.
Glad you enjoyed it ;-)
As I mentioned several days ago I’ve been seeing if a dark theme in VS would help my eyes a little. The
I also found this:
"Green: A good all-purpose lens color, green provides a fair amount of contrast in low light conditions and reduces eye strain in bright conditions."
Source: www.athleticoptics.com/tips.asp
Sorry. One last more I found on Green. Note: My color green is a very light green. Like an off white but with a green tint.
"Have you ever seen the default wallpaper of a Windows 95 installation? That horrendous, disgusting, depressing shade of gray-green that, for years, went mocked and scorned by many?... I have used for the longest period at a time....Interestingly enough, I have also noticed a great reduction in eye strain."
Source: www.oreillynet.com/.../that_depressing_shade_of_green.html
@Chris - I'm just going to stick with white for the time being. Thanks for the links though. The O'Reilly post was interesting. I haven't seen that shade of green for years. Depressing would probably have been the label I would have associated with that shade of green as well. Thanks ;-)
Hi ,
I was using the dark theme and found that it will increase eye strain. Now i am using www.codinghorror.com/.../exported-font-and-colors-for-jeff-atwood-sept-19.zip and it reduces my eye strain.
@Shiju - I saw those themes a while ago, didn't do much for me. I should have said that I use the colouring that R# provides rather than the defaults in VS. Same for VA with C++.
What I'd really like is to be able to specify themes per-solution.
Mainly so that I can instantly see which branch of my product I'm working on - bug fixing on the production branch or new features on the development branch.
Is this possible?
@Joe - I've never heard of it being possible, at least not with VS out of the box.
I like a darker background; I've switched to a dark gray (not black) a while back. Since then I had to work with the default VS colors a few times and it felt like looking in the sun.
If your eyes strain easily taking some lutein supplements can help.
@Peter - Thanks, I'll keep that in mind.
Pingback from Dew Drop – September 30, 2008 (Evening Edition) | Alvin Ashcraft's Morning Dew
I want to address you a personally "Thank you" for this series of articles. I am very interested about design patterns and how they can help building a great infrastructure and your articles couldn't be more helpful.
Thank you, and keep it up!
Best regards,
Costin
@Costin - no problems, I'm just glad someone finds them useful! ;-)
I agree. I'd definitely like to see it included in pre/post/invariant keywords like in Spec#, but for the time being, this is better than nothing.
QUT HIGH FIVE
Pingback from Dew Drop - November 11, 2008 | Alvin Ashcraft's Morning Dew
Thanks 4 provide Data structures and Algorithms ebook
Pingback from Reflective Perspective - Chris Alcock » The Morning Brew #248
Pingback from Arjan`s World » LINKBLOG for December 19, 2008
Pingback from Dew Drop - December 19, 2008 | Alvin Ashcraft's Morning Dew
Pingback from Dew Drop - December 22, 2008 | Alvin Ashcraft's Morning Dew
Chapter 5: Sets; Intersection
While traversing the smallerset, there is no need to check if the smallerset contains the item. That is already known, or it would not have been found during the traversal. Syntax adjusted to use what this form allows.
1) algorithm Intersection(set1, set2)
2) Pre: set1, and set2 not 1 emptySet
3) intersection, smallerSet and largerSet are sets
3) Post: An intersection of set1, and set2 has been created
4) if set1.Count < set2.Count
5) smallerSet is set1
6) largerSet is set2
7) else
8) smallerSet is set2
9) largerSet is set1
10) end if
11) foreach item in smallerSet
12) if largerSet.Contains(item)
13) intersection.Add(item)
14) end if
15) end foreach
16) return intersection
17) end Intersection
Alternative,
3) intersection is a set
5) foreach item in set1
6) if set2.Contains(item)
7) intersection.Add(item)
8) end if
9) end foreach
10) else
11) foreach item in set2
12) if set1.Contains(item)
16) end if
17) return intersection
18) end Intersection
I had a peek through Jon Skeet’s blog this morning at a free eBook called Data Structures and Algorithms by Granville Barnett and Luca Del Tongo. The book is clear and presents the usual linked lists, trees, sets structures in a concise yet precise
Hi Phil,
I'll recheck the algorithm when I have some time (which is hard to find these days).
Thanks.
Pingback from Dew Drop - January 7, 2009 | Alvin Ashcraft's Morning Dew
Hi,
Where can you download the source code for the book?
Thanks
Hi newbie (although I has a feeling thats not your name ;-)),
All the source code for the book is the book itself. The examples given can be translated relatively friction free to your respective imperative language of choice. However, if you want an implementation then we have one on offer in the DSA CodePlex project - http://codeplex.com/dsa which is all done in C#.
HTH
nice, really nice!
Sadly, I can report that I corresponded directly with one of the authors of the Rotor book and he confirmed that it has gone the way of the dodo. He referred to it as a an example of the Law of 2 Feet in action...nobody cared enough about Rotor to keep it alive, so it died. Sigh. On the bright side, they just announced the .NET 4.0 Micro Framework will be released under GNU...so it's not all doom and gloom...