Twin Cities Code Camp Wrapup

So not long ago I presented at the Fall 2007 Twin Cities Code Camp about NBusiness. It was a great experience and really forced me to crystalize a lot of the thoughts I had been coming up with while working on NBusiness. I tried to put in a half and half dose of theory and code. In the end I had more questions than I could really answer in the hour and a half time span we had available. Which is good! I also had a few really interesting questions that really got me thinking about some necessary capabilities for the next version, namely Entity Models and data hiding.

I’ve uploaded the slide deck from the presentation for anyone who’s interested in seeing it. I realize it’s hard to fully grasp of the meaning of a slide without the corresponding talk but, who knows, maybe you’ll find it interesting anyway. I just got my evaluations and I’ll post the results here.

Quality Ideas and information Presenter Abilities Relevant Average Comments
3 3 4 3 3.333333  
4 4 5 3 4.333333 very impressed. this guy is great.
4 4 4 3 4  
4 5 5 4 4.666667  
5 5 5 5 5 Nice job Justin…
5 5 5 5 5 Justin did really well for his first presentation…and he really knows his topic because he was ready with answers to nearly every question that came up.
4.166667 4.333333 4.666667 3.833333 4.25  

So I’ll take this as pretty positive results. If anyone has a need for a presenter on NBusiness you know how to call! I wonder if I should do another presentation at the next code camp? Depends on how much I get done on the next version I suppose. I’m guessing I’ll be right in the middle of some big changes at that time so maybe I’ll defer to the next code camp.

Speaking of which, there is a conference in Redmond at the end of January I am thinking about attending. The conference is called the 2008 Lang.NET Symposium and is all about the creation of .NET languages, compilers and development tools. I really can’t imagine a more perfect conference for me to attend! I’m still trying to figure out the cost of this but if it’s at all feasible then I will definitely go. I would love to learn some things and get a chance to talk to some other people who are interested in the same things.

Entity Inheritance

Inheritance as it pertains to objects is pretty easy to understand and represent. There are lots of complications and benefits that most developers these days understand well. It is also possible to represent inheritance in a relational model, which is effectively a 1:1 relationship between tables. For example you might have the following table schema:













In this schema you would have foreign keys going from Customer and Employee to person. It’s a way to normalize your data that is similar to inheritance. This is something that I have wanted to support in NBusiness but it is a little tricky as you might imagine. What principles of class inheritance apply to Entities as well, I’m not entirely sure? In the case of entities it’s mostly about inheriting data and behaviors and you don’t really have encapsulation or polymorphism.

I’ve been thinking a lot about this after someone at last weekend’s code camp asked me a question about whether or not it was possible to have entities only retrieve subsets of data. The answer to that questions is a tentative ‘yes’ but in fact it would require a fair amount of manual work to get your stored procedures to map back to the correct tables. It’s possible but you’d lose a lot of the benefits of code generation.

So after thinking about this a bit I realized that the two problems (entity inheritance and retrieving subsets of data) had something in common, which I’m calling data hiding for now. In both situations you may only want a subset of data and behaviors from the base entity so I’m thinking of adding a “hide” keyword which will allow you to not inherit fields, properties and rules from the base entity.

In fact I’m thinking about the possibility of creating a new type called use case or something like that. A use case would be just like an entity except that it can only inherit fields, it cannot declare them, sort of like a reverse abstract class. Also a use case must always inherit from an entity. I would imagine that you could create sub families below your root entity definitions and here you would create specific use case definitions. Or maybe model would be a better keyword? Actually I rather like that now that I think about it. The sub families would be more like the use case while the models will describe the various components of a use case.

So suppose you have a Customer entity, if a user logs in and is a Customer you have one use case where they are managing a customer data and have a variety of behaviors associated with that. In this use case they may only have a subset of customer data available to them for editing. Now you may also have a different use case where an administrator of the application logs in and needs to be able to edit a different subset (or complete set) of customer data. As it is now if you declared two different Customer entities for the different use cases you would need to then create the tables and stored procedures to allow them to share the data. With entity inheritance and models you would be able to much more effectively express data hiding while maintaining the ability to share data.

I will work out the details a little bit more but for now check out my wiki page on Entity Inheritance with a little more detail and an example. These features are starting to clarify a bit more in my head; you can look forward to a few other cool features soon such as:

·         Dynamic SQL Fetching (v2.1)

·         CSLA Templates

·         VS 2008 compatibility (v3.0)

·         LINQ support (?)

·         Entity Attributes

·         Partial Entities

·         Custom authorize / access rules

·         Validation rules that apply to only certain CRUD operations

·         Validations warnings and info

Also, one last interesting thing is that I fired off an email To Scott Guthrie at Microsoft the other day asking him about the MVC framework they’re working on. He responded by telling me that they’ll be giving me an advanced preview of the framework in a couple of weeks which is really exciting! It really looks like NBusiness could be a natural fit for the MVC framework and I’m pretty excited to check it out. I’m glad to see that they’re having such an open relationship with open source projects.

Youtube Tutorials

I made a couple tutorial videos related to NBusiness and how to get started with a new project and uploaded them to youtube. The quality is pretty low so it’s hard to see the text but hopefully it’s better than nothing. Here they are:
This video shows the basic steps of creating a new web project, adding an Visual E# entity project then adding a reference. Each subsequent video in this series will be based off of the same code created here.
This video shows how to setup a web config file for a web project referencing a Visual E# project.

Twin Cities Code Camp 2007

On October 27th, 2007 the 3rd anual Twin Cities Code Camp will be taking place. I would definitely recommend attending this event for anyone located in the twin cities area! I’ve been to the last two code camps and thought it was a fun way to meet new people and learn about new things. They also have a pretty good list of give aways and it’s free! Hard to beat that.
Well this year I’ll not only be attending but I’ll be giving a presentation about NBusiness, so if anyone is interested in learning more or talking to me in person this is a perfect opportunity. I haven’t worked out my slides or my demo yet but I’m thinking I might use this very blog as an example of how to use NBusiness in the real world.
If anyone has something specific they like to hear more about let me know and I’ll try to focus on it. There should be some time for questions in general as well. I’d love to see this attract a little more attention and get a few more people interested in trying it out.
So if you’re not sure what you’re doing on Oct. 27th, navigate to the TWCC website and register now!

NBusiness v2.0.1 Released

This release fixes a few issues that were reported to me related to sibling relationships, the schema updater and the schema updater menu items. Let me know if you still have problems with the menu items because I can’t seem to duplicate the issue on my development machine or test VPC. I have done a few things that I think might help but it’s really hard to say 100%.
Anyway, with the sibling relationships I realized that there was no guarantee as to the order of the relationships. Meaning if you had Person and Address entities, in order to create the intermediate tables in the sql scripts template, the template would either name it PeopleAddresses or AddressesPeople… depending on the order of the entities. With no guarantee as to the order there was no guarantee what the table would be named. This would cause custom scripts to blow up or running the schema updater on a database with a table of the other name would result in the database not being rebuilt properly either. So now the template will order all of the entities alphabetically before attempting to create sibling related scripts, which will guarantee that all of the tables will be predictably named. In the example above you should alwasy get AddressesPeople from now on.