Tuesday, 6 July 2010

Ridiculous Microsoft - Visual Studio Extensions does not support 64-bit platform


SharePoint 2007 is decided to be used as content management server for our application. It gives us lots of troubles when customized web services are needed. For me I think customized web services are necessary for SharePoint 2007 unless you only use web browser as client. SharePoint exposes its interfaces by web services but it only exposes very limited interfaces in this way. No file check in or check out is supported!

Something also ridiculous to me is that a tool from MS, Visual Studio Extensions for WSS 3.0, does not support 64-bit platforms. This tool has to work with SharePoint server and all MSDN documents tell you that SharePoint server is better installed on 64-bit platform and it only supports 64-bit machine from SharePoint 2010.

Stupid MS.

Monday, 5 July 2010

Dispose() vs Finalize()

Enough reading of Dispose, IDisposable, Finalize, SuppressFinalize, Finalized Queue, destructor, Garbage collector, weak reference ....... Hope I could fall in sleep without memory leak........ Managed type, Unmanaged Resources...

Dispose() vs Finalize() (Copied from MSDN after this line)
The primary use of this interface is to release unmanaged resources. The garbage collector automatically releases the memory allocated to a managed object when that object is no longer used. However, it is not possible to predict when garbage collection will occur. Furthermore, the garbage collector has no knowledge of unmanaged resources such as window handles, or open files and streams.
Use the Dispose method of this interface to explicitly release unmanaged resources in conjunction with the garbage collector. The consumer of an object can call this method when the object is no longer needed.

Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize on an object (destructor syntax in C# and C++). The garbage collector calls this method at some point after there are no longer any valid references to the object.
In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose provided by the IDisposable. The consumer of the object should call this method when it is finished using the object. Dispose can be called even if other references to the object are alive.
Note that even when you provide explicit control using Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose.

There is no performance benefit in implementing the Dispose method on types that use only managed resources (such as arrays) because they are automatically reclaimed by the garbage collector. Use the Dispose method primarily on managed objects that use native resources and on COM objects that are exposed to the .NET Framework. Managed objects that use native resources (such as the FileStream class) implement the IDisposable interface.

Team leader's role

I have been working as a team leader's role for months. It is the second time of being team leader in my career although the first time only continued for two months before I left the company. It is totally different with being a software engineer. Personally I think the main difference is that as a software engineer I try my best to finish my task on the schedule while as a team leader I try my best to make my team members finish their tasks and then make the team's schedule. 'Make' means properly assigning work item, properly estimation of work items, progress checking, removing anything that blocks their development, and adjusting schedule.

Luckily I got support from my software manager, project manager and other team leaders. They share the experience with me and sometimes just point out the improper actions. Many thanks to them. Also our team provides books for learners. One book I am reading is TSP, Leading a Development Team.