<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Architecture</title><link>http://blogs.x2line.com/al/category/84.aspx</link><description>Posts focused solely on the design and architecture phases of software development. This includes design guidelines, standards and best practices in the format of sessions, discussions, tutorials on .NET. Don't forget hands-on development examples. Software architecture main components including services and logical tiers, allocation to assemblies, run-time processes, identity management, security authentication and authorization, transaction management, thread synchronization and security policies. </description><managingEditor>Anatoly Lubarsky</managingEditor><dc:language>en-US</dc:language><generator>Version 0.97.2006.1</generator><image><url>http://blogs.x2line.com/Images/x2line_logo_feed.jpg</url><title>x2line: Social Network Services, Weblog Hosting</title><link>http://blogs.x2line.com/</link></image><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Natural Key vs. Surrogate Key - Userid in Social Networks</title><link>http://blogs.x2line.com/al/archive/2008/05/30/3445.aspx</link><pubDate>Fri, 30 May 2008 13:36:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2008/05/30/3445.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/3445.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2008/05/30/3445.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/3445.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/3445.aspx</trackback:ping><description>&lt;p&gt;All of us (almost) are the members of different social networks: Facebook, Bebo, Myspace, Hi5, etc. We ARE users. User is a real entity - a real person.&lt;/p&gt;&lt;br&gt;
&lt;p&gt;One of the problems is the ability to identify a user in a unique way across the internet.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;There are 2 approaches to identify entity - both inherited from Relational database model.&lt;/p&gt;&lt;br /&gt;
&lt;h2&gt;Natural Key&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Natural_key"&gt;Natural Key&lt;/a&gt; - a key which has logical reference to (or the same as) already existing unique entity attribute(s). The key has to identify a real entity whose existence can be verified. The most common example is person national ID number, which identifies national passport (?) in a unique way. However the ideal candidate for the persons natural key would be some fictional Global Universe ID. For social networks the best candidate so far is users EMAIL address since:&lt;/p&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Email address is unique.&lt;/li&gt;
&lt;li&gt;Email identifies a user in a unique way across all common social networks. The same email represents the same user in Facebook, Bebo, Myspace, etc.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;The problem: usually email address cannot be shared once this or another social network decides to open its platform and share the user data due to privacy issues. For example email address is not accessible within Facebook API. The second issue is that actually the same user can have several mail addresses, which makes it less trivial to identify the user. Should we use a combination of all user emails to be able to perform identification in a unique way or just use the primary email address ?&lt;/p&gt;&lt;br /&gt;
&lt;h2&gt;Surrogate Key&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Surrogate_key"&gt;Surrogate Key&lt;/a&gt; - a generated key which is not related to the entity attributes. Usually integer (INT or BIGINT, sometimes GUID). For example my userid on facebook is 500491268 and on bebo - 5282127447.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;i&gt;"Because the surrogate key is completely unrelated to the data of the row to which it is attached, the key is disassociated from that row. Disassociated keys are unnatural to the application's world, resulting in an additional level of indirection from which to audit."&lt;/i&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As we can see the surrogate key is not unique across the internet. We get real problem when social networks (and their competitors) open their platforms to 3rd parties and decide to share the data. In order to identify the user in a unique way we need to scale the surrogate key to include another surrogate key which identifies the platform, but it remains still impossible to associate the same user on different platforms.&lt;/p&gt;&lt;br /&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Recently we can see how different social networks are trying to win and dominate the social network space by trying to develop Connect Schemas in order to make connect more sites and applications and make them use their surrogate key to identify users. Recent examples are: &lt;a href="http://www.facebook.com/news.php?blog=1&amp;amp;story=108"&gt;Facebook Connect&lt;/a&gt; and &lt;a href="http://www.google.com/friendconnect/"&gt;Google Friend Connect&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I think this approach will not survive in the long run. The solution is the creation of something like Global Universe ID which identifies a person in the universe, globally and historically unique and shareable. LOL&lt;/p&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/3445.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Business Entity in Component-Oriented Architecture</title><link>http://blogs.x2line.com/al/archive/2007/03/03/2904.aspx</link><pubDate>Sat, 03 Mar 2007 07:01:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2007/03/03/2904.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/2904.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2007/03/03/2904.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/2904.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/2904.aspx</trackback:ping><description>&lt;h4&gt;Intro&lt;/h4&gt;  
&lt;p&gt;So, what is Entity, anyway ? Many folks know they should program using components but smaller part is able to define what Business Entity is up to or can distinguish between Entity and other types of Application components for example Infrastructure Components or Logging Components or User.&lt;/p&gt;&lt;br&gt; &lt;h4&gt;Definition&lt;/h4&gt; 
&lt;p&gt;&lt;b&gt;Start from the Use Case&lt;/b&gt;. Then translate the Use Case to the Business Process (What customer is generally gonna do here and there using our Application). After scetching a bunch of Business Processes we finally can define Business Entities:&lt;/p&gt;&lt;br&gt; 
&lt;p&gt;&lt;i&gt;Business Entity is an independent role in a Business Process.&lt;/i&gt;&lt;/p&gt;&lt;br&gt;
&lt;p&gt;If you can define an independent role for it - it is Entity (for example Order vs. OrderItem in ProcessOrder business process).&lt;/p&gt;&lt;br&gt;
&lt;h4&gt;Characteristics&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Business Entities Provide stateful programmatic access to business data and (in some designs) related functionality.&lt;/li&gt;
&lt;li&gt;Business Entity is passed as I/O parameter of business processes.&lt;/li&gt;
&lt;/ul&gt;&lt;br&gt;
&lt;p&gt;Thus - Entities can be serializable, to persist the current state of the entities. For example, applications may need to store entity data on a local disk, in a desktop database if the application is working offline, or in a Message Queuing message or travel via HTTP and Remoting.&lt;/p&gt;&lt;br&gt; &lt;h4&gt;Business Entity IS NOT&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Infrastructure Component. All functionality that stands outside Use Cases is implemented in Infrastructure Components. Don't mix Business Entities with Infrastructure Components.
&lt;ul&gt;
&lt;li&gt;SMTP, FTP, etc protocols implementation configuration/process/helper classes - are NOT Business Entities.&lt;/li&gt;
&lt;li&gt;Logging components classes. This can be implemented as Logging Configuration, Logging Data Access, etc - are NOT Business Entities. Logging is a bit tricky. For example if you want to audit Business Entity behaviour - need to translate Business Entity into Logging Component before you write to Log. This is because in this case Logging Component is actually a time-stamped copy of some Business Entity component stored in some Logging storage.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;User profile component - is not Business Entity. Anyone who logins and has preferences - is NOT a Business Entity. User Profile could be implemented as Customer, Employee, User, etc. Thus - Authentication and Authorization related components are not related to Business Processing.&lt;/li&gt; &lt;/ul&gt;&lt;br&gt;
&lt;h4&gt;Entities do NOT&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Access the database. All database access is provided by the associated Data Access Logic Component. Rule of Thumb - each Entity will have exactly one Data Access component per single data storage.&lt;/li&gt;
&lt;li&gt;Initiate any kind of transaction. Transactions are initiated by the application or business process that is using the business entities. Actually this means that Business Entity does not implement any kind of functionality associated with Business Logic.&lt;/li&gt;
&lt;/ul&gt;&lt;br&gt;
&lt;h4&gt;Entity Schema&lt;/h4&gt;
&lt;p&gt;Business entities can be built from data that has complex schemas. Single Entity can be implemented via muliple classes and collections. For example, OrderEntity is formed from Order, Product, OrderItem classes formatted and related to each other.&lt;/p&gt;&lt;br&gt;
&lt;h4&gt;Related reading&lt;/h4&gt;
&lt;p&gt;I find both articles only partly useful, but whatever...&lt;/p&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms978496.aspx" target="_blank" title="Designing Data Tier Components and Passing Data Through Tiers"&gt;Designing Data Tier Components and Passing Data Through Tiers&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa697427%28VS.80%29.aspx" target="_blank" title="The ADO.NET Entity Framework Overview"&gt;The ADO.NET Entity Framework Overview&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/2904.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Enterprise Library DAAB: AddParameter vs. AddInParameter</title><link>http://blogs.x2line.com/al/archive/2006/03/25/1579.aspx</link><pubDate>Sat, 25 Mar 2006 20:39:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2006/03/25/1579.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/1579.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2006/03/25/1579.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/1579.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/1579.aspx</trackback:ping><description>&lt;p&gt;I'm playing a bit with Entlib. now. Let's say I'm using it a lot actually :). Speaking of Data Access Block in Enterprise Library I'm coming to conclusion that it is not productive to use &lt;b&gt;AddInParameter&lt;/b&gt; construction in Database object because:&lt;/p&gt;&lt;br&gt;
&lt;ol&gt;
&lt;li&gt;It does not support parameter size causing ADO.NET pass the max allowed for the specified type.&lt;/li&gt;
&lt;li&gt;There is no support for parameter InOut direction (aka AddInOutParameter ?) which I find very useful lately.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I'm going to use &lt;b&gt;AddParameter&lt;/b&gt; instead of AddInParameter, despite that it is a bit less readable. Like so:&lt;/p&gt;&lt;br&gt;
&lt;pre&gt;db.AddParameter(dbCommand,
    "@ProductId",
    DbType.Int32,
    4,
    ParameterDirection.InputOutput,
    true,
    0,
    0,
    null,
    DataRowVersion.Default,
    review.ProductId);
&lt;/pre&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/1579.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Design Guidelines: Generic Type Parameters</title><link>http://blogs.x2line.com/al/archive/2005/12/05/1357.aspx</link><pubDate>Mon, 05 Dec 2005 02:55:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2005/12/05/1357.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/1357.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2005/12/05/1357.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/1357.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/1357.aspx</trackback:ping><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/brada/" title="Brad Abrams" target="_blank"&gt;Brad Abrams&lt;/a&gt; talks about &lt;a href="http://blogs.msdn.com/brada/archive/2005/12/02/497340.aspx" title="Framework Design Guidelines on Names of Generic Type Parameters" target="_blank"&gt;Framework Design Guidelines on Names of Generic Type Parameters&lt;/a&gt;.&lt;/p&gt;&lt;br&gt;
&lt;p style="font-style: italic;"&gt;"Generics are a major new feature of the .NET Framework 2.0. The feature introduces a new kind of identifier called type parameter. The following guidelines describe naming conventions related to naming such type parameters."&lt;/p&gt;&lt;br&gt;
&lt;p&gt;Enjoy&lt;/p&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/1357.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Core Coding Guidelines from Microsoft</title><link>http://blogs.x2line.com/al/archive/2005/01/28/786.aspx</link><pubDate>Fri, 28 Jan 2005 01:34:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2005/01/28/786.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/786.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2005/01/28/786.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/786.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/786.aspx</trackback:ping><description>&lt;p&gt;Internal &lt;a title="Microsoft" href="http://www.microsoft.com/" target="_blank"&gt;Microsoft&lt;/a&gt; basic &lt;a href="http://blogs.msdn.com/brada/articles/361363.aspx" title="coding guidelines" target="_blank"&gt;coding guidelines&lt;/a&gt;. Provided by &lt;a href="http://blogs.msdn.com/brada/" title="brada" target="_blank"&gt;brada&lt;/a&gt;. My favorites:&lt;/p&gt;&lt;br&gt;
&lt;p style="font-style: italic;"&gt;"Tab characters (\0x09) should not be used in code. All indentation should be done with 4 space characters."&lt;/p&gt;&lt;br&gt;
&lt;p style="font-style: italic;"&gt;"Do use a single space after a comma between function arguments."&lt;/p&gt;&lt;br&gt;
&lt;p&gt;It is still very basic but interesting and one can follow the evolution of those since .net release back then in 2002. Despite the fact that I hate guidelines, sometimes (very rarely) it helps. My secret opinion though is that indentation should be done with 3 spaces. Ok, 4 spaces for americans among you. Enjoy :)&lt;/p&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/786.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Smart Client Architecture Guide</title><link>http://blogs.x2line.com/al/archive/2004/08/01/506.aspx</link><pubDate>Sun, 01 Aug 2004 04:22:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2004/08/01/506.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/506.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2004/08/01/506.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/506.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/506.aspx</trackback:ping><description>&lt;p&gt;You can download &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/SCAG.asp" title="Smart Client Architecture Guide" target="_blank"&gt;Smart Client Architecture Guide&lt;/a&gt;. [via &lt;a href="http://blogs.msdn.com/eugeniop/archive/2004/07/31/203117.aspx" title="eugeniop" target="_blank"&gt;eugeniop&lt;/a&gt;]&lt;/p&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/506.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Anatoly Lubarsky</dc:creator><title>Fewer Assemblies better</title><link>http://blogs.x2line.com/al/archive/2004/05/07/269.aspx</link><pubDate>Fri, 07 May 2004 02:32:00 GMT</pubDate><guid>http://blogs.x2line.com/al/archive/2004/05/07/269.aspx</guid><wfw:comment>http://blogs.x2line.com/al/comments/269.aspx</wfw:comment><comments>http://blogs.x2line.com/al/archive/2004/05/07/269.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.x2line.com/al/comments/commentRss/269.aspx</wfw:commentRss><trackback:ping>http://blogs.x2line.com/al/services/trackbacks/269.aspx</trackback:ping><description>&lt;p&gt;As I thought - bigger assemblies are better than lots of small assemblies. &lt;a href="http://blogs.msdn.com/brada/archive/2004/05/05/126934.aspx" target="_blank"&gt;Brada&lt;/a&gt; explains why. My word - keep max 3 per application.&lt;/p&gt;&lt;img src ="http://blogs.x2line.com/al/aggbug/269.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>