Archive

Archive for August, 2007

A Walk down the Silverlight Lane

August 22, 2007 Leave a comment

http://silverlight.net/blogs/jesseliberty/

Jesse’s starting entry
"

The Great Asynchronous Learning Experiment – Day 0

I am about to embark on the adventure of learning Silverlight  from scratch, putting myself into the shoes of a .NET developer who is coming to Silverlight for the first time, using the resources on Silverlight.net

 I’d like to invite you to come with me, joining at any time, participating as much as you’d like, and taking breaks whenever you see fit.

 As I go, I will be using the resources that are here and keeping a public "diary" that notes my progress and also takes note of

  • What are the helpful resources that really worked to clear things up 

  • What resources are not here that I wish were

  • When was I confused about what to do next?

  • What resources are here but are misleading or wrong or need updating

  • What we should be doing to supplement the site with additional material

I would love for you to come along. No commitment necessary. You don’t even  have to start or stop when I do. Just add comments to each "diary" post, saying what you found,  what helped, what confused you, what you wish was here, and anything else that is on your mind about the content of the site as you learn Silverlight.

This is also a great time to ask questions; if I don’t know the answer, and often I won’t, I’ll ask the right folks and get an answer for you.

 Thanks.

 -Jesse Liberty
Silverlight Geek"

Interesting…

Categories: Great Links

Recent comments in live spaces

August 22, 2007 Leave a comment

I was wondering where the ‘recent comments’ section went in Live Spaces. I get some comments on my old blog posts some times. It looks like they have moved it under the ‘What’s New’, Look for a Comments on your Blog section. I just used Live Spaces help to find it today. I hate when I have to use the help manual to find something & I wish you get intuitive User Interfaces (Read as I am a lazy guy).

Anyway glad I found it, There were a couple of comments and I need to respond to Kunal on something. I need to pull the image from my home laptop. Let us see when I do that (I have real bad memory).

Categories: Uncategorized

Tafiti

August 22, 2007 Leave a comment

A silverlight based Search Engine UI from Microsoft.

Categories: Great Links

4 Wives

August 22, 2007 Leave a comment

My colleague, Srini shared this nice story.
http://www.indianchild.com/4_wives.htm

Categories: Inspirational Stuff

What am I upto these days

August 21, 2007 1 comment

After struggling with WCF enabling our application (may be partially because I didn’t approach it in a formal way, I didn’t read any good WCF literature before starting the work on WCF) for a couple of sprints, I am working in our application’s Query Object Model along with Sreedhar.
Some of the tests

	    [Test()]
            public void FindFirstNameEqualsNancy()
            {
                // SELECT * FROM Employees WHERE FirstName = 'Nancy'

                IQueryItem query = new QueryBuilder().
                    
                    Where.Employee.FirstName.Equals("Nancy")

                    .ToQueryItem();

                StringAssert.Contains("SELECT  Employees.*   FROM Employees  WHERE  ( (Employees.FirstName = 'Nancy'))", query.GetSQLQuery());

            }

	    [Test()]
            public void FindFirstNameEqualsNancyAndLastNameEqualsDavolio()
            {
                // SELECT * FROM Employees WHERE FirstName = 'Nancy' AND LastName='Davolio'

                IQueryItem query = new QueryBuilder().

                    Where.Employee.FirstName.Equals("Nancy")
                        .And.
                    Employee.LastName.Equals("Davolio")    

                    .ToQueryItem();

                StringAssert.Contains("SELECT  Employees.*   FROM Employees  WHERE  ( (Employees.FirstName = 'Nancy')AND (Employees.LastName = 'Davolio'))", query.GetSQLQuery());

            }

            [Test()]
            public void FindEmployeesHiredInLastMonth()
            {
                //-- Employees Hired in the last month
                //SELECT * FROM Employees WHERE (DATEDIFF(MM, Employees.HireDate, GETDATE()) = 1 )

                IQueryItem query = new QueryBuilder().

                    Where.Employee.HireDate.WasInTheLastMonth()
                    
                    .ToQueryItem();

                StringAssert.Contains("SELECT  Employees.*   FROM Employees  WHERE  ( (DATEDIFF ( MM, Employees.HireDate, GETDATE()) = 1 ))", query.GetSQLQuery());
            }

            [Test()]
            public void FindEmployeesInUSUKWhoAreSalesRepresentatives()
            {
                //-- Employees from the US/UK Facility who are sales representatives
                //SELECT * FROM Employees WHERE (Country = 'Uk' OR Country = 'USA') AND Title = 'Sales Representative'

                IQueryItem query =
                    (
                        (
                            new QueryBuilder().

                            Where.Employee.Country.Equals("US")
                                .Or.
                            Employee.Country.Equals("UK")
                        )

                            &

                        new QueryBuilder().

                        Where.Employee.Title.Equals("Sales Representative")
                    )
                    .ToQueryItem();

                StringAssert.Contains("SELECT  Employees.*   FROM Employees  WHERE  (  (  ( (Employees.Country = 'US')) OR (Employees.Country = 'UK')) AND (Employees.Title = 'Sales Representative'))", query.GetSQLQuery());

            }

            [Test()]
            public void FindEmployeesWhoDonotWork()
            {
                // SELECT * FROM Employees WHERE Title LIKE '%Manager%'

                IQueryItem query = new QueryBuilder().
                    Where.Employee.FindWhoDonotWork
                    .ToQueryItem();

                StringAssert.Contains("SELECT  Employees.*   FROM Employees  WHERE  ( (Employees.Title LIKE '%Manager%'))", query.GetSQLQuery());
            }

            [Test()]
            public void FindOrdersForACustomerByCompanyName()
            {
                // SELECT * FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID WHERE Customers.CompanyName = 'Alfreds Futterkiste'

                IQueryItem query = new QueryBuilder().
                    Where.Order.Customer.CompanyName.Equals("Alfreds Futterkiste")
                    .ToQueryItem();

                StringAssert.Contains("SELECT  Orders.*   FROM Orders  INNER JOIN  [Customers] AS Customers ON ( [Customers].[CustomerID] = [Orders].[CustomerID]) WHERE  ( (Customers.CompanyName = 'Alfreds Futterkiste'))", query.GetSQLQuery());
            }

            [Test()]
            public void FindCustomersWhoPlacedOrdersOnAGivenDate()
            {
                // Better Done with IN, DISTINCT Issue in the generated JOIN??
                // SELECT * FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Orders.OrderDate = '7/4/1996'

                IQueryItem query = new QueryBuilder().
                    Where.Customer.Orders.OrderDate.On(new DateTime(1996, 7, 4))
                    .ToQueryItem();

                StringAssert.Contains("SELECT  Customers.*   FROM Customers  INNER JOIN  [Orders] AS Orders ON ( [Orders].[CustomerID] = [Customers].[CustomerID]) WHERE  ( ( DATEDIFF ( DD, Orders.OrderDate, '7/4/1996 12:00:00 AM') = 0 )) ", query.GetSQLQuery());
            }

A few salient features of the Query Object Model 

It is strongly typed, Where. lists the Tables available, Employee. lists the columns available on Employee table(, or related tables to Employee), FirstName. lists the operators supported for the string datatype, Operator methods take a specific strongly typed datatype parameter.
It is intellisense friendly, Mostly intellisense lists the tokens which are valid as the next token in the expression. Ex: HireDate. lists WasInLastMonth, WasInLastWeek (since hiredate is a datetime), WasinLastWeek(). lists And, Or & ToQueryItem and so on. If only the operator overloads can take & return Interfaces as parameters it would have been more pure. Sigh!
It is intuitive for the client to use
Thanks to Martin Fowler’s atricle on Expression Builder and his Link to the JMock eDSL white paper, the FluentInterface is coming good.
Steve and Nat’s paper was really helpful especially "How to write a language in Java (and C#) " section was really helpful.
"… like a dog’s walking on his hinder legs. It is not done well; but you are surprised to find it done at all." – Dr. Johnson A funny quote from the paper.

I do understand that Querying Is a Business Concern (Thanks to ayende and also to all the typed datasets bashing by the community).
It will be used from middle tier mostly. When it has to be used from the client, we will use abstractions like FindEmployeesWhoDonotWork().
The Method FindEmployeesWhoDonotWork() was a simple extension added on the Query Object Model and offers a nice littler abstraction.
Today’s business rule states Manager, who knows tomorrow business rules might include AA’s (not agile architect but arrogant architects like me, a nice little title suggested by Manu) like me. The clients who use the Query still remain unchanged and the actual change only occurs in one place FindEmployeesWhoDonotWork. Also this ensures the client is not coupled to database things like column names etc…

A special thanks to Prakash for giving me the freedom to express this in a Fixed Bid effort like the one which I am currently in.

Categories: Uncategorized

On time spent @ work

August 21, 2007 1 comment

I was speaking to Khalil (he drives the company cab) who drove us back home today. Khalil starts his day @ 6:30 AM, spends time with his family, does personal work and reaches office by 10:30 AM. By the time he reaches back home it will be 1:30 AM (into the next day morning). A hell lot of time @ work, And I was thinking the Software Engineers spend most of their time @ work. Whatever be it you can spend that time @ work if you

  • have a understanding family back home
  • enjoy what you are doing and 
  • are committed to what you are doing

And I definitely have all the three. So Why not?

Categories: Uncategorized

Data models

August 9, 2007 Leave a comment

Prakash shared this nice link. Blogmarking it… http://www.databaseanswers.org/data_models/

Categories: Great Links