Wednesday, November 12, 2008

 

Policy based Management with Jetfire

We have started an exciting new phase of Jetfire development. Our next release is planned to support both a rules engine and transparent access to .net objects.

Using Jetfire source code a rule will look like the following:


It needs to be mentioned that Jetfire code is not what the rule writer or rule user would see. They would, in all likelihood, see some sort of form based interface. Using Jetfire it extremely easy to write such an interface since it supports programmatically accessing the code for the rule. The Jetfire code is presented here for understandability.

How the rule code operates is that when an event occurs, in the above example when a 'property' is changed in any 'MailStats' object, parameters are generated for the rule. In the example above the 'mailStats' and 'user' parameters are extracted from the event parameters. Think of this as automatic method overloading. These parameters provide a context for the rule and naturally if a parameter was requested that didn't exist in the event object it would cause a coding error.

Any legitimate code is allowed within the 'condition', including calling other rules. Calling methods within a 'condition' is not allowed unless the method is deemed to be 'rule safe'. In other words helper methods are allowed such as converting from a string to integer. This allows the compiler to check the integrity of the rule 'condition' and insure that the 'when' events are sufficient.

Jetfire Policy Based Management Advantages

  1. Jetfire rules are easy to code and understand. The built-in integrity features makes the rules very robust.
  2. The ability to access .net objects means that Jetfire Rules can operate with existing data. That is there is no need to convert data. The data required for a Rule is in a database it can be easily accessed using a .net Framework such as ADO.
  3. Since Jetfire is interpreted rules can be changed without recompilation or binding.
  4. Code changes will not impact existing working rules since Jetfire includes automatic code version control.
  5. Since Jetfire is a highly reflective language it is easy to present the user with friendly forms based rule system.

Labels:


Tuesday, November 11, 2008

 

Navigating in Visual Studio

I work with Solutions that contain hundreds of files. Navigating through many levels of directories can be a cumbersome task, especially when you are not the author of the Solution. In university, using Visual Studio for assignments was never a problem, since you get to architect the structure of the Solution.

Working with a larger Solution, I was constantly performing Searches on desired keywords. This worked, but very time consuming. I needed to speed things up to increase my productivity. I wanted a mechanism to remember where sections of code are located within the Solution. Here are a couple of tips that can help:


 

Tip #1: Using Bookmarks

Visual Studio has a Bookmarks feature that allows you to save a specific line in a specific file. They work exactly like bookmarks used in web browsers. Simply press Ctl+k and Ctl+k to save the line as a bookmark. Note that you need to do Ctl+k twice, as I presume Visual Studio is starting to run out of shortcut keys! Once the bookmark has been saved, you can view the bookmark in the Bookmarks window that can be docked at the bottom of your window:


Instead of using the filename as the Bookmark title, try placing a comment as the title instead to remind yourself the importance of the said file, or even a "TODO" comment. I have a handful of bookmarks for files I have edited so I can quickly re-visit the file if need be.


 

Tip #2: Track item in Solution Explorer

Another tip to help navigate Visual Studio is to enable "Track Active Item in Solution Explorer". This allows any active file to be highlighted in the Solution Explorer. This comes in very handy when performing Searches, since double clicking a result highlights the file in Solution Explorer, giving you a general idea of the location of the file within the Solution.

This option can be enabled through Tools -> Options -> Projects and Solutions.


This behaviour is actually enabled by default, but for whatever reason, this feature was disabled one day. I went through days without this feature, so I finally made the effort to scan the long list of options under the Options dialog, and it was worth it!

Labels:


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]