Today was .NETwork usergroup second gathering. The usergroup is the first and only large/effective "offline" usergroup in Egypt (although there're many others in INETA). They had a great success in their first gathering when they brought Steven Forte to talk about SQL Server 2008 new features for developers and ASP.NET MVC design pattern. I had a detailed post about it in my GWB blog at that time. Check it out for details.
Background: First To Second Gathering (Warning: Boring Part!!)
The .NETwork gatherings so far are more like small independent events. We -SilverKey Tech- were the first to start such events with our full day event, DemoDay (See GWB posts on DemoDay I, DemoDay II ), and later ITWorx had their CuttingEdge Club (See GWB post); which were both great corporation contribution to the developer community (and I believe we need more guys to start doing similar events), but, didn't have much of "offline user group" nature between each round of either events (although almost each of us is friend to the other or at least friend of a friend!!). While .NETwork preferred the same "event" model, they had online and offline communication between the users of the usergroup (although mainly between students and organizers so far, but it's a step anyway). It's very interesting what Mahmoud Ghozz (one of the organizers) told me that the 2nd gathering session topics/speakers setup was done mainly through just phone calls!
So, in the 1st gathering, they were very successful getting all support from Microsoft Egypt, who held the meeting in their building and provided deserts as cool treat, LOL! They also used corporate contacts of the organizers to get Steven Forte (a frequent MDC speaker) to deliver the sessions. That was more than great but it was hard to keep. I think there were two main issues there: the fact that the gatherings need a determined location that can be available for "frequent" gatherings, and the other fact that to comply with the event model and also for the sake of hosting more events, the speakers need to be "local", from Egypt. The two goals were so clear as Remon (the main organizer) announced them in the 1st gathering, and were nicely achieved in the 2nd one.
The idea was simply simply getting the location from a private university. Sure any university would welcome that! They chose the Canadian University in Egypt, which was (like all private universities) quite far from Cairo that it still required buses to get the attendees (Not sure whether the university or Microsoft Egypt - who also brought free food I heard :D - provided the buses), and got an Egyptian MVP and Egyptian Microsoft Redmond Employee to deliver the sessions. That was a great step in stability that I heard some intentions that the gathering is going to be in the same location every 3rd Saturday of every month. Great news to here :).
So, as you see, it's insightful great advance, and I really like that to the extend of getting you too bored before starting walking through the sessions, so, let's start!
Session 1: WCF – Messaging & Channel Model (By Khaled Hnidk)
Khaled is a BizTalk MVP, and when he talks, you can see clearly that he just knows pretty much what he's talking about, which used to be a little bit missing from certain speakers in events I attended during the last few years (but is increasing nowadays thanks God). It's interesting how he went slowly during the session, but still delivered one of the deepest sessions I have attended in the topic (and I have attended many!). What helped this is that he was wrongly thinking or informed that the session time was 2 hours not 1.5, so, he a lot to say, and those who know the sessions I deliver or attend know how much I LOVE that ;).
As most of the attendees were students (I may talk about it more thoroughly after covering the sessions), he started the talk with regard to Webservices, why they exist at all, and the webservice (ASMX) model. When a client want to send a message to the service, it needs to serializes the message, send it through a transport layer (client proxy), get to the service transport layer, which de-serializes the message in order to process it. He discussed the idea of dispatching (directing requests to service method calls) in that model through WebMethod attributes. After processing, the service response is sent back to the client through the same steps, but in opposite direction.
Then he went into webservice model limitations. You know, in terms of method of communication and static host, requiring HTTP method (and hence HTTP server) to work, and also having to define security through attributes making the security code that's part of the message header something you care about when writing the service itself, and have to maintain along with it (although it's not part of the service logic). Added to that the limitation of the message itself, for example, as the message size would be dependant on server general web settings, and you have no built-in way to define metadata of the service (i.e., how about a sequence required for message calls?). He mentioned how WS-* standards have come to sort of try to work around such limitations, which required Microsoft to release Webservice Extensions (WSE) to support those in its ASMX implementation.
Well, as you may think, that was a where the talk of WCF started and took place. Khaled reminded the audience that now we have multiple ways of communication. On .NET, there's COM+, Remoting, Webservices (ASMX) - hey, with and/or without WSE -, which are too much. Of course other platform vendors have their own stack of tools/standards as well (like the stuff coming from IBM). Yes, of course. That's what WCF came to unify and improve its model from the .NET developer side. Before going further, Khaled approached Microsoft's decision on hiring Don Box, the father of SOAP, and having him to work on creating WCF.
Getting into WCF ABC (Address, Binding, Contract), Khaled stated how a message in WCF can be hosted in any application, event a simple console, and the host needs to have an endpoint "Address" to be called through. Getting the client to know "how" to call the service (i.e., whether it requires SSL, what max. amount of data can be sent at a time, etc) is the "Binding". Now what to expect from the service or what the service "can do for you" is the contract. Being recently married, he compared the model to what you do when you get a worker to do some painting or such for your house. To arrange the deal, the worker would example give you his mobile phone number (hey, "Address"). He would tell you "You can call me from ... to ..." (That's "Binding"), he will agree with you to deliver a certain service -let's say painting- (Which is a "Contract"). Khaled noted that almost the same concepts apply to the client.
Still talking about ABC (invested by Clemens, on a side note from Khaled), he showed a figure of the message lifecycle, and focused on the messaging communication:
- Request / Response (Each client request has a service response on the same wire)
- One way (A message will be sent and that's it)
- Duplex (After a request, there'll be a response, not in the same time frame, not even using the same address/binding).
He used a funny example of that, slapping! If you slap someone in the room and he slaps you back, that's "Request/Response". If he just does nothing, that's "One Way" communication. If he leave you right away, just to wait you (or get someone) to slap you in the street, that's a "Duplex" communication!!
Going through addressing scenarios and special talk about the transport layer, Khaled had more to say about Duplex Communication. You know, you need to host the service, define ABC of the endpoint. The client is a bit similar, after all, the client has a service that has an endpoint, but this one complies to what what the service that the client requests does define.
Using the same demonstration of ABC and message lifecycle, Khaled went into talking about "Binding". He described the lifecycle as the channel model stack. Below in the stack you have the transport layer (Last), then upwards comes the message encoder (that's the serializer), and then you have more layers of your choice in the middle, typically the security layer, and then the dispatcher at the top of the stack (First).
Talking about security, he noted that you may want to use symmetric session key (one key for communication during a session), that for example would require the security layer to send additional message (other than the message you are sending itself) to set that key first for the client and then later will use that key to encrypt your message when sending it. That brought up a new topic, "In Band" and "Out Of Band" messages. This concept is important for those who do work on extending WCF features. Simply "In Band" messages are the messages that your service code deals with and has to worry about- in short, knows about! "Out of Band" messages on the other hand are ones your service will not ever know about, like that key message mentioned before, and like the messages of WS-MessageDelivery Large Message Exchange (WS protocol that defines splitting of large message into smaller ones and combining them as one message back). Knowing the difference between both -Khaled reminds- is a necessity for those doing security extensions for WCF.
Still with binding, we went into "Behaviors", as the name implies, this means changing (overriding) the way WCF works. To explain that, we started digging into demos. The first demo was walking through a pre-created solution (Khaled recommended to have a separate VS Project for each service host, and a separate VS Solution for the service - that's another VS Solution for the service client). He walked through the defined contract (that's an interface that the service class implements), and related attributes. Serializing the non-primitive .NET types (say classes) involved in the service and using DataMember on the members needed for the service to operate properly. He noted that out of band messaging like security will be configured in the binding not the service code. He then moved to the service host, showing the snippet to tell the host which service is should host at all :). The host app.config file (which he calls -for fun- app."ounfid", that's "Hedgehog" in Arabic!) has the binding. He showed how that's defined using the service class name, and showed different endpoints demonstrating that each endpoint has its own ABC, showing the binding models that come with WCF out-of-the-box (answering a side question, he stated the binding can be defined in code as well).
The next topic in the same context was meta data exchange, defining different channel model than standard. Yes, that's where the behaviors come to play. The behavior is defined either for a service, endpoint, or operation (Method). He showed how you can for example inherit one of the built-in service behaviors and override its main processing models. An interesting point he showed was using HTTPWS binding on the host (meaning the host will provide the service over HTTP with WS standards), and while just defining HTTPWS binding on the host was enough, Creating a reference from the client application to the service showed that the client had each detail (instruction) it needs of that binding stated in its app.config, that's like whether there's quota for message size. That's "right" because, that client might have been for example a JAVA application that knows nothing about binding and needs these instructions. The last part of the session was tracing the states of the client calling a service, proxy creation, opening and closing the connection to the service.
The next demo started by iterating over dispatchers collection. that's a dispatcher on each endpoint for direction to class methods, plus an additional undocumented zombie dispatcher that you read about only in blogs, Khaled mentioned. He noted that he "saw very few developers that needed to override dispatchers versos other WCF stuff"
Now we started talking about service instances (creating service object that has the methods to call from the service class) by mentioning state management as the enemy (for the expensive memory it requires), Khaled reminded everybody of having a service instance per message. It was a good time to mention the 4 tenets of SOA (Service Oriented Architecture):
(Note: I merged the original terminology with Khaled's explanation)
- Boundaries are explicit: Or service isolation (Each service is a separate contract)
- Services Are Autonomous (You cannot deploy a service partially, or to clarify: each service should be able to perform regardless of any other service availability or so)
- Services Share Schema And Contract, NOT The Class (You shouldn't need an assembly to use the service, just the schema, like WSDL for example)
- Service Computability Is Based On Policy
Back to overriding service behaviors, Khaled demoed different service instance creation modes (when a new instance of the service is created). that's Per-Call (every service request), Per-Session (every new client session), and Single (just one instance for all client calls, which is not good for memory performance). He showed us the number of service instances created in each mode for a client connection with 2 service operation (method) calls, and one more connection with single operation making every service instance response a GUID field he added to the service class.
The next topic was "channel factory", he briefly mentioned you create a factory for overriding channel by code, that's meaningful when the biding is variable in runtime. Speaking of binding and endpoints, I wanted to know his recommendation on hosting services in console-like applications like windows services, etc versos in IIS, He seemed to agree with me that IIS is the practical option, and added a note on the in-the-box power of IIS 6 application pools. He also added that Windows 2008 has another practical option, which is WAS (Windows Activation Services).
The next topic was WCF tracing. Khaled demoed setting up tracing configuration like tracing sources for tracing each message/activity, adding tracing listener to a text file, and opening the trace file using Windows SDK 6 SVCTraceViewer tool, going through the log entries for mapping to service model (like initializing the service host, etc), and showing tracing entries mapping to the transport layer. He gave everybody an few advices. To go home and play with the SVC Viewer tool if they want to learn, and to remember that tracing the host (mainly IIS) would be through Windows Event Viewer, while tracing the service behavior itself would be through that SVC viewer tool.
After a side question about encrypting part of the message not the whole message (which would be for certain business processes) that he recommended instead of having single service, splitting the services and having a central workflow as main service that splits the message and directs it to the right services; he went on a detailed demo for overriding Endpoint behavior. You get a method for applying client behavior (if the behavior is on the client endpoint, if not, just throw a meaningful exception there!), and another to apply the behavior on the service, which he used for a dispatch behavior for the WCF Message Inspection WCF Patterns (inspecting parts of the message and request parameter filtering). You access the message after receiving the request (that's before executing the service code) and before sending response (yes, that's after executing service code). Note that a message is immutable (that means you cannot change it). You normally take the message (passed to you by ref), put it in a buffer, do whatever you need to with the message buffer, and use it to create a new message that you replace the original message with. The last step needed after writing the behavior is adding it to the config.
Here was the end of the demos. The rest of the slides and demos were cut due to discovering that half hour difference I mentioned above. The next part Khaled added after asking someone in Microsoft if she believes Microsoft would love to deliver certain messages to his audience. He stated that at the very beginning, but I thought it would be more appropriate for me to bypass it until we reach the part he started telling these messages, and here it came!
The first talk was about BizTalk 2006 R2 WCF LOB (Line Of Business) Adapter SDK . A framework for with legacy code. You create the meta data in band stuff), inherit some classes and implement certain interfaces, which after you're done can be used as yet other WCF channels than you can be bound to. It has tools that help generate you all you need to start (Overview). He also mentioned the SDK adapter pack which is contains adapters for SAP, Siebel and Oracle, etc. The last words were about "Project Oslo", which is a set of process/workflow modeling tools that aim to be the actual runtime of the code, not just a code generator like WF designer model. He said it's said to be released with first quarter of 2009, and it's work in progress with regard to Emacs-like editor.
As a whole it was a great session. although many things had to be simplified for the majority attendance of students, and, that misunderstanding of time thing made us go very slow in the beginning, and then have to skip parts at the end. Still, the guy is pretty knowledgeable and I now that next time he presents, I'll likely be there.
Session 2: SQL Server Manageability (By Mohamed Meshref)
I used to know Meshref in ArabTeam2000 forum (a short while after he was accepted to join Microsoft SQL Server Team in the U.S.) and later MiddleeastDevelopers yahoo group. He is know for having a special way in talking about stuff, especially when it comes to talking about Microsoft (and it always does of course). Unfortunately, the guys was kind of sick yesterday (Oh, it's already yesterday!), and it was hard for him to do the talking, however he managed to deliver a light interactive session with good demos still :).
At the beginning, Meshref went talking about Resource Governor, it was mentioned by Steven in the first gathering (which I wrote about), but, I think it's an essential feature (Many guys were "not" of the 1st gathering attendees still, and it didn't take much for the talking).
The next features he talked about were all built with regard SMO (SQL Server Management Object), that's a library that has representation of all SQL Server Objects that enable doing something like another SQL Server Management Studio theoretically possible (Just kidding - let's say a way to reach many parts of SQL Server Management Studio features by code). That's very logical building in my opinion and I like the fact that Meshref and the other SQL Server did stick to it.
The biggest feature Meshref talked about was Declarative Management Framework. This is basically a policy management framework. It allows you to define a certain policy on any object available within SMO (You do it normally through the familiar management studio), like setting a certain naming convention for all tables in the DB for example, and the policy can be applied to all DBs in the server, and/or exported to other server(s). Meshref went on demoing the creation of a new policy, showing that a policy can consist of more than one condition (and each condition can be reusable in other policies - think of it as Many-to-Many relationship). He showed how the policy does prevent violating it when enabled, and then went back to show us how we can set a description for the policy to appear to the user trying to violate it.
Afterwards, he showed how we can "evaluate" our policy. That means seeing which objects do not comply with the policy (for example, objects created before the policy was created and and set active). At this point, Meshref mentioned the difference between the two types of conditions:
- Deterministic: Those are the fixed rules, similar to setting a certain property of an object to always have a certain static value. The cool thing about such conditions, Meshref demoed, is that when you are using it, and checking what objects do not comply to your policy, you just click a single button to make SQL Server apply the policy for you on all the non-complaint objects or only one of them.
- Non-deterministic: Those are the dynamic conditions well, the conditions in all are a bit limited to say "dynamic"!), En example to that is defining that all your table names should be "like 'tbl_*'". Such condition cannot be applied automatically. You click the same button, but to apply it yourself this time.
By the way, I asked Meshref whether there're performance worries when using large number of policies (yeah, I was thinking of managed stored procedures), and he said that they tested them over huge number of policies (I think those were 15,000!!!), and I shouldn't worry.
Before going to the next demo, Meshref highlighted that the DMF is a SQL Server Engine feature, not a feature of SQL client or so. It makes sense and was important for feature after the demo. The demo was setting different policy modes for when the policy will be evaluated:
- On Demand: Policy evaluated only when you go evaluate it yourself.
- Schedule :Using SQL Serer agent to evaluate the service according to certain schedule and log that.
- On Change Prevent: The policy is enforced. No one will be able to bypass the policy as long as it's enabled
- On Change Log: When someone tries to bypass the policy, this is let go, and just logged
The next feature was Multi Server T-SQL. This is a small SQL Server Management Studio (SSMS) feature that is still great. Simply, this enables you to right click the top of the Servers tree in SSMS, choose new query, and the new query you write gets executed on all the servers you have registered in SSMS. Because this thing is on the client side, the registered servers can be any version (well, I think I mean SQL Server 2000+ still).
The next demo was on PowerShell Integration. Being able to write something like "CD [ServerName]", "Dir" (gets DB list), "CD [DB Name]", "CD Tables", "Dir" (gets stables list in the DB) is really fun thing to do :D. This is intended to replace SQLCMD old SQL command tool as said by Meshref. I asked him whether I need to do anything on the server to access it via PowerShell on another machine, and he said it's the same stuff required to use SSMS against it from another machine - interesting!
Then he demoed SQL Server Intellisense. I don't need to talk much about this I guess :). Meshref stated that they do caching of the objects you use to enable some sort of "Client Complication" as he called it, which is validating your query (including column and parameter names, etc) when working against a remote Server without having to actually send the query to it.
The next big thing was "Data Collection Framework". That's a SQL Agent based feature that is very useful for dataware housing through it's performance monitoring collection sets and their collection items. He demoed us sample reports of what is collected and it was SQL Objects usage reports, and performance measures (CPU, Memory, etc). The two questions he was about this feature was that whether this requires SQL Reporting Services, whose answer was No, and whether it's available to consume through SMO APIs, and the answer was yes.
The last thing he showed before the session ends was a small [x] that appears next to objects in SSMS when they are not compliant with current policies. Good to see. Actually the rest of the session was mainly weird questions from some attendees. Maybe I talk about that in a next post
Conclusion (You knew there has to be one!)
OK, it's morning already, and today is suddenly yesterday. I just wanted to say that I really enjoyed the day and the cool guys. The day was great, and I wanted to tell .NETwork what I believe is missing here.
Actually the .NETwork guys as I mentioned have made great success in setting up sessions. You made a great frequency. You maintained communication between half or so of the group members, but this leads to ask about the next step. I believe (as I said to Mahmoud) that there should be friendly group gatherings with even higher frequency than the events. Those can always be with little number of guys and with normal talks without sessions or having single session in the meeting. That's mainly how I hear about usergroup most frequent activities, and I'd love to see it. I believe that this will eventually attract more professional developers, whose presence will help raise the levels of the starting level developers, because with having starters as the majority always, you find yourself sort of stuck in certain level of knowledge exchange instead of increasing that level. I think having regular gatherings in certain times as that "3rd week of a month" intention as well as more smaller gatherings will bring more developers whose presence can take the hands of those starters. It'll take months to be sensed though. I'm not talking about 3 or 4 months here, but 7 or 10, but that's affordable I believe as some guys tried for few years.
To everyone around, I'd like you to check the usergroup and attend the next gathering. I'll post about it enough time before it happens and will link to the session slides and videos as soon as I know they're available, but, don't count on me, and check the usergroup yourselves ;)