Ingo did spake:
Sometimes you might want to implement custom ImageList controls and encounter the fact that the .NET Windows Forms ImageList is marked as sealed. Instead of crying foul here, let's have a look at some of the reasons for this decision.
My latest article "Sealed is Good" shows you ...
... the reason for sealing ImageList.
... the reason why this is a good thing.
... the reason why unsealing it wouldn't help you at all.
And finally, the reason why unsealing it would demand a complete rewrite of all of System.Windows.Forms.
Have fun!
Clemens later added:
No. The keyword sealed conveys a very clear message that the class designer reserves the right to change the class so dramatically in a future release of the product that you would be tremendously unhappy if you had derived from it to implement your own functionality, once that new version comes along. Sealed says: This is going to change in a big way.
I agree that sealing GUI classes for performance reasons is probably a good reason to break traditional OO designs. But I have some reservations on applying them on anything beyond special use case classes. This is mainly due to the fact that I have seen some strange code that was sealed when it should not have been. I don't think that a lot of .NET developers are aware that you can seal single virtual methods and they seal a entire class when they really should only be sealing some specific method that you don't want futzed with. In most cases the methods that need seeling are end points where components are connected. (otherwise, just call a method non virtual or private and be done with it)
However, I do have one big gripe. I did a large legacy database project last year with had some strange timestamps. No problem thought I, extend DateTime to have a few pretty properties that did magic behind the scenes to covert to standard windows datetime. Plus with inheritence, I can databind to both winforms and ASP.net with a really simple set of code like:
ParDateTime T = new ParDateTime();
T.ParDate = // Some magic to get this from the database.
T.Months.Add(Today.Minutes);
Calender1.DateTime = T;
Nice simple and self documenting (Par is the name of the application).
Of course DateTime was a sealed class which resulted in a more convoluted set of code. Sealing classes make it harder (and dirtier) to add functionality. This leads to my general rule on sealing.
Never Seal Business or Logic Classes. Sooner or later you will want to extend them. If your object model really has nasty magic that requires you to seal a class rather then risk anyone deriving it, you might want to re-examine your design.
Something happens to make me really suspect that there are underhanded deals going on. SCO/Microsoft was a blatent attempt to prop up SCO taking on Linux. Microsoft insisted that AOL/Microsoft was not meant to kill compeitition, but to the surprise of no one, AOL just shut down Netscape. See
Here and
Here for more information. The browser has stagnated for the last three years because of lack of competition. Sad to see that it will probably remain so.
Thu Jul 10 03:43:39 2003
Pretty nifty. Obviously we're gonna have to start developing some better clue relevance/match quality functions to stop the dashboard from being such a cluttered mess. And we'll need a configuration system of some kind so people can enable the backends they like and disable the ones they don't like. I plan to start focusing heavily on UI in a couple weeks.
[dashboard daily progress]
I have to play with this tonight on my (oft neglated) Linux box. This may be the most interesting new C# program I have seen in a long long time.
One of the recurring requests for a blog is related to TransparentProxy, RealProxy, Contexts, Interception, etc. As usual, I'm typing this where I don't have access to our corporate network and the sources, so some details might be a little off. (When will my dentist provide free wireless to his customers?) And, as usual, none of this is going to help you in developing applications. In fact, I postponed writing about this topic despite all the requests âbecause it seems so obscure. But if you are struggling through the Rotor source base, it might explain some of the code that you see. I say might because I've never actually looked at the Rotor sources. I'm just relying on the fact that they are a pretty faithful of a cleansed snapshot of our desktop CLR sources. Anyway
Normally, a reference to a managed object is just that: a native memory pointer. This is reported accurately to the GC so that we can track reachability and so we can update that pointer if the object is relocated during a compaction.> [.Net notes]
Wow.... and yikes... This stuff is eating my brain. Please keep it up.
Edited to fix bogus MSWORD HTML. ^.^
For a while now, on each individual post, IÂhave been collecting and
displaying PingBacks, Trackbacks, and referrals.
I am curious if anyone finds the referrals helpful? Initially, I thought they
would help "connect" blogs that did yet support pingbacks and trackbacks. But as
time goes on, they have become a collection of google and online aggregator
links. Any thoughts?
[ScottW's ASP.NET WebLog]
I for one really appreciate it. My response to /.'s anti-dot-net story a few days ago was picked up by some people in the java community, and this let me track down their posts and look at it.
-j.p
It's posts like this that make me want to abandon Slashdot after 5 years of faithfully following, commenting and posting stories. Let's set some things strait: (before anyone accuses me of being Microsoft marketting, I have no links to the company, and am a huge fan in OpenSource. I have both a windows and a Linux box, and I spend more time hacking on Linux for fun, and hacking on .NET to get paid....)
1) Microsoft has completly committed to .NET. Longhorn's new features are all managed code.
2) Microsoft's most profitable Business Aplications are being ported as we speak. BizTalk, Office, and the OS all have managed serviced components now, and the next version of SQL will have extremly rich CLR support.
3)My experience as a Technologist is the reverse. We have gone from no .NET projects (all perl and Java) to four this year, and my guess is that we will see as many as six or seven next year (smallish shop).
4) The knowledge curve works for you. My experience is that in Assembly 10% of stuff is "easy" the rest you need to look up, in C, 40% of the stuff is easy, the rest you need to look up, in C++ it's about 50/50, in Java it's closer to 75/25. In C# on .NET, it's about 90/10. That last ten can be a bitch, but no less then Java's 25%.
5) Having strugled with AXIS and several other varients of Web Services for Java, I have to say, they pretty much suck rocks (GLUE excepted, although at least the last version I was playing with still equired source access to code to generate services). On the other hand, the extremly rich API and Metadata abilities in .NET make web services insanly simple (maybe to simple, new developers may use them too much).
6) Interoperability rocks in .NET. Not just platform (mono is doing a great job) but also interop based on the WS-I stack.
7) Java is at best a niche platform. When was the last time you saw any non server/specialized software written in Java? Of the top ten software software packages (Windows, Office, SAP, PeopleSoft, Oracle, SQL, Quicken, Quickbooks, TaxCut, Microsoft Money) how many of them are actually written in java? 0/10. Microsoft owns 90% of the CPU market. Microsoft has decided to slip .NET until Longhorn, but it is out there in the hands of extremly productive developers.
8) .NET has only been released in a non beta form for about 1 year. Since then Microsoft has already done a major upgrade to the development platform, and a major release of the CLR. Whidby will add more features.
9) Reflection, Inspection, Attributes and Events. Simpler in .NET, more powerful in .NET.
10) ASP.net is a solid step up from ASP. Seperate of presentation and business logic is much more solid, the rendering pipeline is more powerfull, and the security features rock.
11) ADO.net makes simple database projects (CRUD) easy. Will anyone use Datasets for a large enterprise application? Probably not, but it is still there and powerful.
12) Sun fails the Dogfood test. Number of critical applications in Solaris that are or are being ported to Java? None, ask Sun why that is (not scalable, not fast). How much of Windows is being ported? The whole Shabang (see Longhorn). I will be happy to re-examine Java seriously for ongoing work when Sun's rm6 utilities (including the command lines) are written in Java.
13) Not only that, Sun is now lifting features from .NET, clearly there is some new and cool features here to get the ever slow sun to actually change their precious language.
14) Compact Framework. Share code between WinCE devices and your platform. Tie them together via Webservices with a single click of the mouse.
15) Rich clients. Have the interoperability and accessability of the web without stateless programming enviornment and pretty graphics.
16) Integration. Don't want to rewrite all of your companies security? Use Domains and Roles. Don't want to implement your own message Queue? Already There. How about Transactions, JIT ACtivation, automagic threading? Done.
17) J2EE.... say no more. Look guys, Microsoft's business practices suck. On the other hand, Microsoft employees some of the brightest people on the planet, and the CLR/CIL stuff is fantastic. You can either keep on trolling (ala Carlos) or you can actually notice new and cool technolgy being developed and taken advantage of. Frankly, all of you Java contractors, please keep this up. I like having more work offers then I can take for .NET programming.
My stumper then, is this: How do I grab (or cause to be uploaded) a
folder of files for backup, say as large as 2GB, from a WinXP machine,
without having any access myself to read the file contents. I'll be
able to install whatever I need on the WinXP machine, but the idea is
that, when the bits leave that machine for the Linux backup server,
there should be no way for me to read their contents. But, I must be
able to usefully backup and, in conjunction with the owner of the
files, restore in case of disaster.
Oh yeah, and I have no budget for software. So, I'm trying to work
this out using only free tools.
So, my first though is some sort of encryption on the WinXP machine.
Encrypt with GPG or something, leaving my boss with the secret key
on a floppy and the passphrase in his head. Upload these files
to a special folder on our shared drive, and it all gets backed up
like everything else.
Or, since I don't even really want to know the names or number of
files in this sensitive folder, can I somehow ZIP up the whole
shebang and encrypt that before uploading?
Under Linux, none of this would be much of a problem to me. But,
under WinXP, my knowledge of available tools and means of automation
fail me.
Any hints from out there? [0xDECAFBAD]
First of all, for Linux backups, let me
Highly recommend
Amanda for Linux backups. Scaling other technologies gets too difficult, but we have a several hundred server network that Amanda tackles without problem. In addition, Amanda software is now being ported to win32, giving you a way to backup directly to tape (or rather to a Amanda spool). Here is
One Such Effort.
I had a project a few years back moving encrypted bank transactions across a network. Here is how I implemented it:
Two folders are needed:
The Unencrypted directory that has all of the important stuff. (A)
A encrypted directory that is automatically written to. (B)
Only B should be shared, and no unencrypted data should be present. There is a slight mathematical risk to zipping and then encrypting files (since the header of the ZIP is a well known structure), but the purpose of this excercise is to keep noisy employees away, not be 100% mathematically secure. Your proccess then works as follows:
Have your boss schedule a script that takes every file in A is zipped into a single file. (Winzip)
Have your boss schedule a script that encrypts that zip. (Use GPGP, but remind your boss that he must keep the key secure.
Have your boss schedule a script that moves only the encrypted file to B.
Use NCFTP or SAMBA to automatically transfer B over to a backup server. (Use SMBFS or smclient if using samba). If he does not want to share it, transfer it using NCFTP.
WinZip works great for automatically compressing things. I would not use it's encryption or password features tho. Use GPGP with a secure key to encrypt, or roll your own using .NET's awesome encryption support. (I recommend staying with GPGP).
Greg Fee is the newest Microsoftian to join the .NET blogsphere, with a pretty good set of recommendations on .NET and reflection:
Use an obfuscator to remove sensitive names and hinder decompilation
Only grant ReflectionPermission( ReflectionPermissionFlag.MemberAccess ) to highly trusted code
Place sensitive code on the server and access it via a web service.
He has already joined Chris Brumme and Brad Abrams on my subscribed list.