January 2007 - Posts

Partner Readiness | Software Factories

What is the most exciting feature in some implementation of Software Factory (SF) idea? For me it is related to "reusing" expert experiences, architecture, pattern and framework. Imagine if you have expert brains in your Visual Studio and reuse it!. Imagine that if you can ask Norman to translate all of his knowledge into a factory and then you can reuse it without consult to him anymore.

SF is our vision to industrialize software development process. You will agree with me that this is very big vision. High skilled developer is rarely found. Even if you can hire them, it will be very hard to keep them. With SF, you can reduce your dependencies to people like them. What you need to do is ask them to make factory model before execute a construction process. I personally love the idea :).

I will talk to MS partners about SF in the next two days. We will cover Web Service and Web Client factories including enterprise library 2.0. I hope they enjoy as I enjoy talk to them :).

Thx - R.A.M

Share this post: | | | |

WPF and WCF talks at BinaISV LIPI

Many people say, if you really understand something, then you can make other people have "the same understanding" with you. Again, I found that this is a fundamental in teaching process but "really really" hard to do. Programming is about implementing our abstraction in how we want any system to work. With high level abstraction framework like WPF and WCF, fundamental knowledge is necessary. I spent two hours to explain audiences "how XAML works" starting with partial class and serialization mechanisms (all with compiler and notepad++). After that I moved to a lap around WPF architecture and base classes provided by .NET 3.0. Useful tools like XAMLPad, VS 2005 and  Blend were the last topics in the first day training. To explain all about WPF I think will need around 5 days but Bina-ISV WPF slot is only one day. I hope you can explore more once you back to your office.

Today is the most challenging part in which I have to explain the foundation of WCF. Where should I start? Since Bina-ISV batch I, I didnt trust PowerPoint Slides to make people understand what I understand. Because when I prepared the slides, I didnt have visibility of what type of audiences I will have. I assumed the type of audience are like MVPs. And suprisingly, my assumption always wrong. So,... give me Whiteboard.... and I will let my talk flow naturally to make you understand what I mean about something :).


I hope you enjoy as I enjoy talk to you....


Thx -R.A.M 

Share this post: | | | |

Narrowing C# knowledge gap

Guys, I have found many cases in which people us Otak C# book to learn .NET. As one of the author of that book, I felt really bad. I know that our book can not represent C# even for the lowest level of my standard. But people still download it, read it, make it as reference. And ironically, possibly they will assume that C# is just like what we have written for them. I think this is the time to release a new version of our C# book that will cover at least 80% of ECMA 334 and ECMA 335 contents. If you are one of the book authors, please confirm to my email that you are interesting to join the project. My vision to this new book are:

- After people read the book, they only need ECMA PDF standards as futher references. I always believe that good developer can work with spec documents.
- Must be in Bahasa Indonesia and FREE to download. I believe most developers in Indonesia starting programming by reading local book.
- We must proud to the book, write it with the best we can do. My own experience showed that I was not proud enough to what I have written. 
- This book (should be a classic book) will be on the desk to all C# developers in Indonesia ! All authors should have higher writing standard.

Lets have an after office hour meeting or chat about that.


Thx - R.A.M

Share this post: | | | |

.NET Multicore for a PhD Research?

I just read Zeddy's posting about non-complex multicore (shared-memory parallelism) CLR based programming environment which is very interesting for me. First because his proposed model is fully integrated CLR host process instead of platform invocation (by hooking calls that enter and leave CLR host). Other Zeddy's idea is to have "custom attribute based" instead of unmanaged OpenMP style "pragma based". Well, those are very good ideas for the future of .NET framework but at the same time is also challenging work. Pragma vs attribute is an old war (far before OpenMP) but with the increasing popularity of OpenMP, people tends to believe that pragma is the most realistic way to inject parallel code during compilation. You can imagine that pragma is a mechanism to inject IL code during compilation and attribute is about instantiating classes. Two different approach right? Attribute gives better flexibilities but shared-memory parallelism usually not at class level, not even at the operation level (method). Multicore programming is only about separating thread execution into multiple processors. In this case, whatever we use (attribute or pragma), we should be able to tell the Jitter how to produce level machine instructions which can run on different threads (and different processors).

So, the keyword here is "thread". Multicore programming is about how to execute many separated threads into more than one processors. We have three layers of threads, user-level, kernel-level and hardware level. The most common APIs are OpenMP and explicit low-level threading libraries such as Pthreads and Windows threads. The choice of API depends to requirements and the system platform. In general, low-level threading requires significantly more codes than OpenMP or higher APIs; however, like usual, lower abstraction provide more fine-grained control over program's use of threads. Usually unmanaged developers have at least around three options (OpenMP, Pthread and Windows thread) of infrastructures which provide scheduling capability. Managed environment like CLR does not provide any scheduling capability, relying instead on the OS for scheduling in normal condition (preemptively scheduler). Threading is passed to the Windows OS scheduler which utilize Win32 Create Thread each time it needs to create thread, it calls the Win32 SetPriority API to adjust a thread's priority; and so on; Windows handles the remaining downstream thread activity preemptively. Is there any way to customize the inner working of CLR task manager?

Yes, CLR is shipped with unmanaged CLR-hosting API that we can use to create custom scheduler (cooperatively scheduler) and thread pools. This is used by SQL Server 2005 team to meet their scalability and performance needs for SQL-CLR integration features (remember fiber mode in SQL Server 2005). You can consult CoopFiber sample in your .NET 2.0 SDK for real example of how fiber mode really works. What I want to state here is Zeddy's proposed model for managed multicore environtment is possible and challenging at the same time (I will share its details sometimes). One possible way is to develop a custom task manager (possibly will need synchronization manager too) and publish its interfaces through custom attribute classes. We can do the experiment using underlaying OpenMP for example (Good topic for PDC right?). For a PhD work? It really depends to how we address the problem. This job is done by SQL Server 2005 team and shipped as product right? PhD is about doing something for public knowledge that no other people done before. Fundamental one is preferable because valuable to computer science body of knowledge....

Thx - R.A.M

Share this post: | | | |

Batam Again...

This is my 2nd trip to Batam. During the next 5 days, a lot of things have to do here. C# training for customer, student event at Politeknik Batam, SDLC speaking at Microsoft enterprise event, and practicing design pattern in the night. Zeddy, Umar, and Agung joined this trip.

See you in Jakarta....

Share this post: | | | |

Performance Programmer in Yogja??

I am just arrived at Yogjakarta, sitting in NovHotel resto and waiting my food. There will be two big events here, MIC launch and Microsoft Academic Day 2007. I am hoping to see many OSS fans here again. Talking to them will be interesting. Suddenly remind me to one quote in Kang Su Gatlin PhD thesis:

Law of Portable Performance [Kang Su Gatlin PhD thesis]
"For near peak performance, a portable program must execute different sequences of source-code instructions on different machines."

This can be happen if you have knowledge on the architecture of other machines (RISC machine for example).  Combine it with parallel message passing, distributed-memory, and multi-OS API, will rise you huge advantages. Can we have that kind of programmer here in Yogjakarta? Or just code re-users who call their self Linuxer?


Let see ....

Share this post: | | | |

Books in My Backpack

I will have 4 books to read for until Feb 2007. Very, interesting books !!! Click on each book and read what people think about its contents.

 See you. Thx - R.A.M

Share this post: | | | |

Reliability and performance engineering

There are two disciplines that always attract my attention, reliability (in distributed system) and performance (in micro scale) engineering. In many ways, those disciplines are still in its infancy. Reliability and performance are also the most critical requirements of enterprise application. But in fact, if there is agreement on anything today (not only in Indonesia), it seems to be an agreement to postpone considering seriously about reliability and performance when designing apps. Do you know why? Because it is hard! For me it is a bit like Heisenberg's Uncertainty Principle is applicable for distributed system, DpDr >= (h/4p). If p=performance and r=reliability, then we can say "the more precisely the performance is determined, the less precisely reliability we can gain, and vice versa". For almost 30 years, IT industry faced this problem. And... this trend will continue at least for the next 20 years. I told to one of my friend who setups new IT consultant company to "really focus on reliability and performance engineering".

Most development teams are now compelled to work within widely acceptable standards who promises better productivity (.NET/J2EE). Even though those standards are quite limited in term of reliability and performance, pragmatic consideration are the main driving force. The most ironic fact (but natural) is, sometime we decide to use technology based on resource availability. Many project owners choose to use VB6, because all of their resources are VB6 developers. Natural enough because we cant escape from the "principle of minimun energy". People choose VB6 because it is easy to use. People chosee .NET because it is gaining productivity. People choose J2EE because they know how to use some community middlewares or frameworks, etc. When reliability and performance requirements are on top of productivity, usability, and community supports, we have to open our eyes and mind to other options which require better computer science knowledge. I believe that period will come to Indonesia soon. I found that at least there are around 16 mission critical applications development have been started in Indonesia. Mission critical means critically need realibility (& high availability) and performance also 100% coupled to the core business processes. Can you imagine if the CIO/CTO decided to use pragmatic way for that kind of apps?

Thx - R.A.M

Share this post: | | | |

Correlating High Level Knowledge to Native Windows API

Windows Application Programming Interface (API) or simply Windows API, formerly called Win32. It provides services used by all Windows-based applications (32 bit and 64 bit). C/C++ developers can develop apps that run succesfully on all versions of Windows while taking advantage of the unique features in newer version.If you installed Windows SDK, you can find complete documentation of the newest version of Windows API, consists of a lot of stuffs that has been categorized into administration and managemement, graphics and multimedia, networking, security, system services etc. Yes, I will agree with you that is a lot of reusable APIs. No one can master it in short period.

As the most popular kernel deployed in our planet, you must believe the creator of Windows designed it to be used by other people. It must adopts some patterns, styles, conventions, etc. Thats true, Windows has a very consistent API convention that you can master in short period once you know C/C++ language. Let say, if you really understand the mechanism of simple file management APIs (CreateFile, WriteFile, ReadFile) like below,

HANDLE CreateFile(
           LPCTSTR lpFileName,
           DWORD dwDesiredAccess,
           DWORD dwShareMode,
           LPSECURITY_ATTRIBUTES lpSecurityAttributes,
           DWORD dwCreationDisposition,
           DWORD dwFlagsAndAttributes,
           HANDLE hTemplateFile );

BOOL WriteFile(
           HANDLE hFile,
           LPCVOID lpBuffer,
           DWORD nNumberOfBytesToWrite,
           LPDWORD lpNumberOfBytesWritten,
           LPOVERLAPPED lpOverlapped);

BOOL ReadFile(
           HANDLE hFile,
           LPVOID lpBuffer,
           DWORD nNumberOfBytesToRead,
           LPDWORD lpNumberOfBytesRead,
           LPOVERLAPPED lpOverlapped);

Later, you can simple understand other APIs for memory management. It just about calling another APIs, to manage Windows virtual memory (VirtualAlloc, VirtualFree, VirtualLock, etc) or heap (HeapCreate, HeapDestroy, HeapAlloc, HeapFree, etc). Let the Windows SDK documentation remembers all details of the functions or how to call them. Standard API always has well pre-defined structures for return value and parameters. Its function name has functional convention and easy to remember. Dont worry about that. No one can remember all the contents (even I can, I wont do that) of pre-define header files like windef.h, windows.h, winbase.h, winnt.h, etc. You will become familiar once you use it every day. What we need to remember is its concepts.

As Vista shipped this year, I found that complexities in the n-th layer of abstraction become increased. Starting with simple C function call to Windows API, to wrapper framework like MFC, or VES like WinForm library and WPF. We have a lot of additional namespaces, programming models, paradigms, etc. But again, there must be some patterns that still exists and can not be changed forever because product makers always put compatibility as critical requirement. MessageBox function is still there in Windows API, in such a way we should be able to correlate it with our high level knowledge. Let say I can write a procedure in Assembly language to invoke MessageBox function (dont try at home).
 

.data
     @def_caption BYTE " ",0
.code
     pushad
     .IF ebx == 0
             mov ebx,OFFSET @def_caption
     .ENDIF
     INVOKE MessageBox, 0, edx, ebx, 0

     popad
     ret
MsgBox ENDP


In high level language like C/C++, you can also call it.

#include <windows.h>

// change the int to PASCAL, WINAPI, WINAPIV
int
WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
        MessageBox (NULL, TEXT ("Compile me in Windows 95, 98, 2000, XP and Vista !"), TEXT ("WinMainTest"), 0) ;
        return 0 ;
}


But when you are in VES (virtual environtment system), will it still the same MessageBox function called by the following IL codes (I hope you can imagine its C# codes) ?

.method private hidebysig static void Main() cil managed
{
           .entrypoint
           .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 )
           // Code size 13 (0xd)
           .maxstack 8
           IL_0000: nop
           IL_0001: ldstr "Compile me in with ILASM !"
           IL_0006: call valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
           IL_000b: pop
           IL_000c: ret
} // end of method Program::Main


Can you correlate it back to the native Windows API MessageBox? Or just claim that codes calls another API :). Take a look at the following IL codes that I took from MessageBox::Show implementation:

int32 System.Windows.Forms.SafeNativeMethods::MessageBox(valuetype [mscorlib]System.Runtime.InteropServices.HandleRef,string,string,int32)
 
And when you go to SafeNativeMethods::MessageBox, you will find:

.method public hidebysig static pinvokeimpl("user32.dll" autochar winapi)
int32 MessageBox(valuetype [mscorlib]System.Runtime.InteropServices.HandleRef hWnd,string text,string caption,int32 'type')

Can you guys find the correlation with the following Windows API syntax ??

int MessageBox(      

    HWND hWnd,     LPCTSTR lpText,     LPCTSTR lpCaption,     UINT uType );


I know you know that too. One of the biggest problem we have now (and tomorrow) is about correlating our knowledge. This is just a very simple case to show you such kind of problem. I have many other problem around correlating my own knowledge. I love the way Petzold explained it in his book, CODE, The hidden language of computer hardware and software.

Thx - RAM

Share this post: | | | |