A quest for software excellence...

SharpZipLib and Kudos to Scott Galloway

I had to get an object serialized to a byte[] and then compress it using SharpZipLib and gzip and then decompress it and deserialize it to the original object. The serialization was easy but for some reason I was struggling with using the GZipOutputStream and GZipInputStream compression providers in the SharpZipLib library.

Then I found Scott Galloway's compression helper. I highly recommend it. Anyway, here's the code without the helper. Visit Scott's blog for that.

 public class ResultSerializer
  public static byte[] Serialize(ResultData data)
   //convert to byte[]
   IFormatter frm = new BinaryFormatter();
   MemoryStream ms = new MemoryStream(8096);
   frm.Serialize(ms, data);
   byte[] serial = ms.ToArray();
   byte[] retval = ZipUtil.Compress(serial);
   return retval;
  public static ResultData Deserialize(byte[] zipData)
   byte[] data = ZipUtil.DeCompress(zipData);
   //now deserialize
   IFormatter frm = new BinaryFormatter();
   MemoryStream datams = new MemoryStream(data, 0, data.Length);
   ResultData retval = (ResultData)frm.Deserialize(datams);
   return retval;

Note that I renamed Scott's helper "ZipUtil" for my own reasons.

Seven Principles of Highly Effective Web 2.0

I very much enjoyed Dion's Thinking in Web 2.0 post. The ways to think in Web 2.0 seem to be growing with significant and useful comments. I would like to propose a side discussion that attempts to reduce Web 2.0 to seven specific principles.

The Highly Effective Web 2.0 is:

1. Specific - Purpose, content and interface is quickly understood.
2. Standard - Data is offered via open standards and protocols (i.e. HTML, XHTML, SOAP, RSS, SSL).
3. Transparent - Privacy and other policies are enforced and simple (see #1).
4. Accessible - Data should be easily found for those with and without disabilities.
5. Interactive - Participation is be encouraged and facilitated (see #1).
6. Inclusive - One thing leads to more like things rather than fewer.
7. Evolutionary - Everything is both familiar and new.

I tend to be overly verbose while clinging to the principle and value of brevity. If we are to understand the Web 2.0 wave, perhaps we can reduce it to seven (no more) principles that are stated simply and without the need for great expansion despite the fact that books may be written on the subject.

Please comment. Let me know which one(s) you would replace, with what, and why.