-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
title: "eXtreme Programming - Too extreme?" | ||
date: "2004-05-31" | ||
--- | ||
|
||
I'm gradually moving into being an eXtreme Programmer, takes a while to apply all practises, but I'm getting there.. One thing that kinda bugs me though; the lack of templates for existing applications / servers for helping me do what I do best : design and write code. | ||
|
||
For one I've started using the XDE designer for .net (Rational). Really coooool tool. It comes with a lot of design patterns that are really nice. In addition it had a set of RUP features. Where did the XP features go?? | ||
|
||
Again, SharePoint. Templates for just doing simple User Story cards digitally with tasks and the ability to put these into iterations. What's the problem?? I know that they all say : "stick to the simplest tools there are; pen and paper". Hello.. Wake up! Tracking user stories, tasks and how much time spent on them are crying to be handled digitally. Someone should step up and create all these templates. Project should have a template for this as well.. | ||
|
||
Maybe that someone is me.. Hey.. Never thought about that angle.. :) Well.. Today is the official blowing off steam day. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "What gives?" | ||
date: "2004-05-31" | ||
--- | ||
|
||
I've got an interesting question : | ||
|
||
When it comes to SharePoint you find a lot of cool articles about how cool the Portal Server is and what not. You also find a lot of articles about programming webparts and changing the layout. But what I can't find is a simple template site for a blog. What's up with that? | ||
|
||
I've found several guys that actually serves their blog through SharePoint. | ||
|
||
It's not that DasBlog is not a cool piece of software; quite the opposite. But, I use SharePoint for everything else and would realllllly love it if I could do blogs with this as well.. | ||
|
||
BTW: That was my second blog.. :) By the end of the week, I'll get the hang of this.. Just you wait! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: "The fear..." | ||
date: "2004-06-05" | ||
--- | ||
|
||
I am the typical programmer that didn't go to schools to achieve the knowledge I have of programming. That presents a couple of interesting scenarios.. Engineers I've worked with in the past see this as a threat of some sort. The funny thing is that I've also established some fear for the engineers. To show an example of both fears; me and my boss, who is quite the conservative type, had a talk the other day and he asked: "Seeing that you don't have a degree or any formal education, how do you know this much about programming and how do you manage to keep your knowledge up to date". Since he started off the sentence with the assumption that only engineers had the power to actually learn new things, I responded with following sentence: "Well sir, I think that the fact that I don't have a degree does the trick. That actually enables me to learn things better and faster!” My boss' intention was to give me a compliment, which of course he did as well; it was more the assumption I'm referring to that threw me off. After all, my boss has all the trust in the world when it comes to me; he has given me the position as MAD (Manager of Application Development) with the typical engineers as the team to manage.I've actually established a concept in my head that says: if you only have a degree in computers and consider programming to be your trade and nothing more, you can't possibly be good at programming. I think there is a bit of truth to that concept. Programming is more than just knowing the patterns and syntaxes you've learned at school. It's also about a lot of research, a lot of trying and failing. If you just sit there and implement code based upon known patterns you are not very creative! That type of programmer will get things done, but the code will not necessarily be the best code. My idea of an excellent programmer is one that really loves computers and almost gets abstinent when having to be away from the keyboard for a couple of days. Don't get me wrong, programmers should have a life as well (I know I have). A totally different fear should be present in such a programmer, namely the fear of not learning the new technology coming out every day. | ||
|
||
That's it for today.. :) (I knew I'd get the hang of this blogging thing...!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: "Persistent Objects Part 2" | ||
date: "2004-08-06" | ||
categories: | ||
- "csharp" | ||
--- | ||
|
||
Another aspect of creating persistent objects is the ability to design these through a visual designer such as the DataSet editor in Visual Studio. One way to go about using the same designer and get an output consisting of your objects instead of a strongly typed dataset would be to create your own custom tool. | ||
|
||
Creating your own custom tool that generates code in Visual Studio .net 2003 is somewhat interesting. Microsoft removed or made a class private in the plugin architecture of the editor that was very helpful. The class I'm referring to is the 'BaseCodeGeneratorWithSite' base class for code generator custom tools. But a quick search on Google gives you the class along with a tutorial on how to write the plugin. | ||
[http://www.drewnoakes.com/snippets/WritingACustomCodeGeneratorToolForVisualStudio/](http://blog.dolittle.com/ct.ashx?id=ed5fda5d-1e97-4509-befe-01e3752f9f2c&url=http%3a%2f%2fwww.drewnoakes.com%2fsnippets%2fWritingACustomCodeGeneratorToolForVisualStudio%2f) | ||
|
||
The custom tool has to implement the GenerateCode() method and do the magic. As input to this method you get the file content of the XSD file. This content can easily be transformed into whatever code you'd like. For instance, if you'd like to keep the DataSet functionality but want the dataset to be a bit smarter you can use the TypedDataSetGenerator class found in System.Data to generate a CodeDOM of the dataset and just walk this and modify the parts you want to have smarter. One thing it could do is to let all your rows have the persistent object attributes attached to it as mentioned in my other blog about Persistent Objects ([http://blog.dolittle.com/PermaLink.aspx?guid=71e1b6fd-59bf-41a5-8c33-cde01dbf9899](http://blog.dolittle.com/ct.ashx?id=ed5fda5d-1e97-4509-befe-01e3752f9f2c&url=http%3a%2f%2fblog.dolittle.com%2fPermaLink.aspx%3fguid%3d71e1b6fd-59bf-41a5-8c33-cde01dbf9899)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: "Persistent Objects Part 3" | ||
date: "2004-08-18" | ||
categories: | ||
- "csharp" | ||
--- | ||
|
||
The one thing I find missing in other persistent object implementations is the ability to persist data from any kind of source. | ||
|
||
You could easily persist data from a Web Service, a dataset, other functionality found in your business logic. Just about anything, actually. | ||
|
||
If you look at your persistent objects a bit like facade objects, this would make a lot of sense. | ||
|
||
For instance : | ||
|
||
<table style="background-color:#f2f2f2;border:#e5e5e5 1px solid;" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody><tr style="vertical-align:top;line-height:normal;"><td style="width:40px;text-align:right;"><pre style="border-right:#e7e7e7 1px solid;font-size:11px;margin:0;color:gray;font-family:courier new;padding:2px;">1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9</pre></td><td><pre style="margin:0;padding:2px 2px 2px 8px;"><span style="font-weight:normal;font-size:11px;color:black;font-family:Courier New;background-color:transparent;">[Persistent] | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">class</span> MyPersistentObject : PersistentObject | ||
{ | ||
[PersistentWebService(<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"<uri for webservice>"</span>,<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"get method"</span>,<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"set method"</span>)] | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">string</span> Name { | ||
get { <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">return</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">string</span>.Empty; } | ||
set {} | ||
} | ||
}</span></pre></td></tr></tbody></table> | ||
|
||
The DoLittle Persistency project found at GotDotNet is going in that direction. The implementation uses a PersistencySource and goes through a manager to get the Default source. The default behaviour can easily be changed by implementing your own source. This source could for instance get data from a file, if that is what you are trying to accomplish. | ||
|
||
It's a world of opportunities.. :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
title: "Persistent Objects" | ||
date: "2004-08-06" | ||
categories: | ||
- "csharp" | ||
--- | ||
|
||
One of the things that are cool with .net Framework 2.0 is the ObjectSpaces. For JAVA developers this has been available for quite some time through libraries such as Hibernate. Today you get Hibernate for .net and there is also a free Objectspaces library for .net 1.1. The only thing with both these that I really find a bit odd is that they rely on XML files to configure the classes and properties to be connected to the datasource. | ||
|
||
The only benefit I can see from this is that DBAs can read the humanly readable XML file and just map out the DB schema for the developer to use. | ||
|
||
Another way to go about creating a persistent object would be to do some magic in the .net framework. The remoting framework provides us with some cool features to do this a bit more fancy and smooth for the programmer. An AOP approach by using attributes is a far more sexy solution. | ||
|
||
Let's say you have an object "Customer" and you have a property "Name" that you want to map to a table with the same name and using the column with the same name. How would the following code sound to do that trick : | ||
|
||
<table style="background-color:#f2f2f2;border:#e5e5e5 1px solid;" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody><tr style="vertical-align:top;line-height:normal;"><td style="width:40px;text-align:right;"><pre style="border-right:#e7e7e7 1px solid;font-size:11px;margin:0;color:gray;font-family:courier new;padding:2px;">1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8</pre></td><td><pre style="margin:0;padding:2px 2px 2px 8px;"><span style="font-weight:normal;font-size:11px;color:black;font-family:Courier New;background-color:transparent;">[PersistentObject(<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"Customer"</span>)] | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">class</span> Customer : ContextBoundObject | ||
{ | ||
[Column(<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"Name"</span>)] | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">string</span> Name { | ||
get {} | ||
} | ||
}</span></pre></td></tr></tbody></table> | ||
|
||
To accomplish this, you have to use the proxy system in the remoting framework. Instead of having a server/client solution we make sure that we get a proxy no matter where it is instantiated. | ||
|
||
We need two things to achieve this. 1. An attribute that implements the System.Runtime.Remoting.Proxies.ProxyAttribute and it's CreateInstance() method. | ||
|
||
2\. We need a proxy for the object that handles the magic. | ||
|
||
The attribute can look something like this : | ||
|
||
<table style="background-color:#f2f2f2;border:#e5e5e5 1px solid;" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody><tr style="vertical-align:top;line-height:normal;"><td style="width:40px;text-align:right;"><pre style="border-right:#e7e7e7 1px solid;font-size:11px;margin:0;color:gray;font-family:courier new;padding:2px;">1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9 | ||
10 | ||
11</pre></td><td><pre style="margin:0;padding:2px 2px 2px 8px;"><span style="font-weight:normal;font-size:11px;color:black;font-family:Courier New;background-color:transparent;">[AttributeUsage(AttributeTargets.Class)] | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">class</span> PersistentObjectAttribute : ProxyAttribute | ||
{ | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> PersistentObjectAttribute(<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">string</span> tableName) { | ||
}</span></pre><span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">override</span> MarshalByRefObject CreateInstance(Type serverType) { PersistenceProxy proxy <span style="font-weight:normal;font-size:11px;color:red;font-family:Courier New;background-color:transparent;">=</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">new</span> PersistenceProxy(serverType); <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">return</span> (MarshalByRefObject)proxy.GetTransparentProxy(); } }</td></tr></tbody></table> | ||
|
||
The proxy could look something like this : | ||
|
||
<table style="background-color:#f2f2f2;border:#e5e5e5 1px solid;" border="0" width="100%" cellspacing="0" cellpadding="0"><tbody><tr style="vertical-align:top;line-height:normal;"><td style="width:40px;text-align:right;"><pre style="border-right:#e7e7e7 1px solid;font-size:11px;margin:0;color:gray;font-family:courier new;padding:2px;">1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9 | ||
10 | ||
11 | ||
12 | ||
13 | ||
14 | ||
15 | ||
16 | ||
17 | ||
18</pre></td><td><pre style="margin:0;padding:2px 2px 2px 8px;"><span style="font-weight:normal;font-size:11px;color:black;font-family:Courier New;background-color:transparent;"><span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">class</span> PersistenceProxy : RealProxy | ||
{ | ||
<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> PersistenceProxy(Type type) : <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">base</span>(type) { | ||
}</span></pre><span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">public</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">override</span> IMessage Invoke(IMessage msg) { <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">if</span>( msg <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">is</span> IConstructionCallMessage ) { <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">return</span> EnterpriseServicesHelper.CreateConstructionReturnMessage((IConstructionCallMessage) msg,(MarshalByRefObject)<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">this</span>.GetTransparentProxy()); }<div></div><span style="font-weight:normal;font-size:11px;color:green;font-family:Courier New;background-color:transparent;">// Use reflection to get the tagged properties... </span><span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">if</span>( msg.Properties[<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"__MethodName"</span>].Equals(<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"get_Name"</span>) ) { <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">return</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">new</span> ReturnMessage(<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"Cool Name"</span>,<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">null</span>,0,<span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">null</span>,(IMethodCallMessage)msg); }<div></div><span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">throw</span> <span style="font-weight:normal;font-size:11px;color:blue;font-family:Courier New;background-color:transparent;">new</span> NotImplementedException(<span style="font-weight:normal;font-size:11px;color:#666666;font-family:Courier New;background-color:#e4e4e4;">"Need more logic..."</span>); } }</td></tr></tbody></table> | ||
|
||
All you need to do is to create an instance of the Customer object and there you have your proxy. Ofcourse the solution for an entire system would include some factories for handling these objects from the DB and such, but the basics of it is pretty much as shown above. | ||
|
||
Another point is that all the solutions I've seen for having persistence on objects are focused on mapping tables and columns. This can be extended to include far more features than that. How about linking a property to a WebService, an ADO DataSet, a static method on another object, a file... The possibilities are endless. | ||
|
||
At the moment I'm working on a project that will be a fully working Component for anyone to use. You'll find it at GotDotNet : | ||
|
||
|
||
|
||
http://www.gotdotnet.com/community/workspaces/workspace.aspx?id=0bb104cb-9ebb-4fc8-947f-2f9649f412b4 | ||
|
||
|
||
|
||
The revised version of this blog's topic can be found on TheServerSide.net : [http://blog.dolittle.com/ct.ashx?id=71e1b6fd-59bf-41a5-8c33-cde01dbf9899&url=http%3a%2f%2fwww.theserverside.net%2fnews%2fthread.tss%3fthread\_id%3d28325](http://blog.dolittle.com/ct.ashx?id=71e1b6fd-59bf-41a5-8c33-cde01dbf9899&url=http%3a%2f%2fwww.theserverside.net%2fnews%2fthread.tss%3fthread_id%3d28325) |
Oops, something went wrong.