Monday, July 31, 2006

Books I am reading, will read, and have read

Books I am reading, will read, and have read ;-)

I believe a responsible programmer should read a lot. Experience and reading, both are important.

I thought I should put this to my “links” of the blog site; however, I guess I will add things to it pretty dynamically, so, let’s start it with a blog.


----------------------------------------
----------------------------------------
----------------------------------------

Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (Microsoft Net Development Series) (Hardcover) by Krzysztof Cwalina, Brad Abrams

http://www.amazon.com/gp/product/0321246756/sr=8-6/qid=1154388094/ref=pd_bbs_6/102-8806264-7010541?ie=UTF8

------I like it, because it is very readable, and really provides insights for .net libraries. It is not just theory, so, even it contains mistakes, those mistakes and their "reasons" are worth to know ;-)

---------------------------------------

Sunday, July 23, 2006

Reading materials in Ajax/ASP are different from winform world

Reading materials in Ajax/ASP are different from winform world.

In winform world, although .net, especially C#, is much similar to Java world, the whole thing is still a “closed” system – if you use Oracle database, then, you have another vendor; otherwise, it is all M$. One vendor for everything, nice.

The downside of it is that it tends to hide things irrationally, even for C# and C++. It is not technology, it is business/politics. As a result, developers begin to use clicking to replace thinking. Consequently, reading is very limited.

In ASP, even classic asp, it is different. HTML, XML, Javascript, and http, they are standard based. Even you only program to IE, there is still some openning for some fresh air.

However, classic ASP is so dumb, little can be said.

ASP.net has much more to say. ASP.net 2.0 has even more, because it finally catches up with the Java world.

Ajax makes it even more interesting, because Ajax means the browser platform has more freedom.

As a result, for Ajax, we have more reading materials. In addition to Atlas and the background ASP.net 2.0, we can read more general Ajax books.

I know I am making it sounds all wonderful. However, it can be a bad thing: I have a life, why I want have more technical reading?

The thing is that the fact that you can read more relevant materials means you are living in a larger world.

Domain Driven Design: data modeling as the core of the domain modeling

Vikas wrote (http://vikasnetdev.blogspot.com/2006/07/domain-driven-design-vs-data-driven.html): I am excited about Domain Driven Design otherwise I would not have spent 50$ and wasted my time to read it. After finishing it, I am going to rate this book either 1 out of 5 or 5 out of 5. This is one of few books in which I am going read case studies. Generally I skip them and use in real practice. Be paitent with me. :)


This makes me feel that I may be missing some gold mine; so, I took a deeper look of the “Domain Driven Design” website and its summary ( http://domaindrivendesign.org/book/PatternSummariesUnderCreativeCommons.doc ), its book comments on amazon, and its google results for its related literatures.


The following are three specifics:

1. In the past, when I was young ;-) I studied analytical/language philosophy pretty intensively, so, I am very much at home when I read the Domain-Driven Design book – believe it or not, I also found discussions on “ontology” in domain driven literatures! ( see http://www.st.informatik.tu-darmstadt.de:8080/ecoop2005/maw/acceptedPapers/Hruby.pdf ). I really feel that they are seriously taking OO to the next level -- expanding its perspectives.

---- However, I feel it is interesting that DDD does not pay special attention to database modeling.

2. I honestly believe that I had been doing DDD for a long time, at least it started eight years ago when I read Martin Fowler’s analysis pattern book (I noticed vikas also list it on his book list on his blog site – great people read alike ;-). However, I must add that I read that book together with other two books (I did not dramatize it; I did read them about the same time: coincidence or lucky): David C. Hay’s “Data Model Patterns – Conventions of Thought”, and (as an anti-dose for normalization) “The Data Warehouse Toolkit” by Ralph Kimball.

I especially appreciate the subtitle of the Hay’s book, “Conventions of Thought”. OO is not the only thing that we can think about. Further, I would argue that relational model and dimensional model are actually subsets of domain modeling thinking, and those subsets are indeed the more robust and more important ones -- because persistent data are more important by themselves (the “core domain”), and relational multiplicity is more important than anything else. Talking about “deep insight”, I always find realizing things that need to be persistent and the multiplicity of those things is the deepest insight.

Also note that database forces people to share data. So, it is the natural place where people have a ubiquitous language. Further, data warehouse is the ultimate place where we have a ubiquitous language across the whole company. Talking about ubiquitous language without digging into data warehousing, it again shows the tunnel view of “pure” OO.

3. The last item is a whole-hearted recommendation: on the one hand, we need a “process” to reduce the chaos in software development; on the other hand, using the metaphor of manufacturing is really very misleading. So, this article is very convincing:
http://domaindrivendesign.org/articles/blog/evans_eric_software_is_not_like_that.html

Saturday, July 22, 2006

8 Basic Programming Techniques v4

List of updated items :

1. I expanded the item "unit testing", added "3-in-1 document writing for Spec, Test script (Fit or Fit-like), and User Manual".

2. In the beginning I added references about architecture diagrams.

I thank vikas http://vikasnetdev.blogspot.com/ , because both updates originate from responses to vikas's blogs.

==============================8 Basic Programming Techniques v4

Note: Those 8 techniques are described in a top-down style – I assume there is only one (basic) “architecture”, and you know THE architecture. I know it is unusual that we need to talk about THE “architecture” before we talk about the “basic” techniques. Actually, that is NOT that “unusual” -- without knowing those architecture diagrams, a programmer is working in the dark. Again, note that there are many diagrams, but they all convey the same basic architecture.

Reference diagrams from Sun (“Core J2EE patterns”) , Ejb community (“EJB Design Patterns”), and MS-MSDN best practice (“application architecture”):

http://java.sun.com/blueprints/corej2eepatterns/

http://www.theserverside.com/tt/books/wiley/EJBDesignPatterns/index.tss)

http://msdn.microsoft.com/practices/topics/arch/default.aspx?pull=/library/en-us/dnbda/html/distapp.asp


----------------------backend techniques
----------------------The only thing I can argue about grouping logging with databases, is that for a long time, I always put them together. Perhaps it is because the most important logging is database access logging; perhaps it is because logging is somehow similar to database anyway. Note that the second logging in the middle-end is different from the first logging in the backend. The second one is focusing on the “aspect” aspect of it (the “client-side” of the logging); the first one is on the logging itself (i.e., the “server-side” of the logging).

1. Use log4net, in a simplistic style (avoid fancy stuff)
2. Use MS Ent Lib’s data access block
2’. Use Nhibernate, instead of Ent Lib, when we are in “advanced” situations

----------------------middle-end techniques
3-4-5-6. Use the DynamicProxy in castle framework to centralize remoting(3), transaction handling(4), security(5), and logging(6), at the façade level.

Note: In order to do that, Use programmatic IoC (i.e., centralize all “Factories”); but for most projects, do not use XML style IoC (that is too heavy)

--- to avoid client casting, use factoryMethod
--- use abstrctFactory for switching easily
--- put class name, method name, variable name in the factoryMethod


----------------------front-end techniques
----------------------You may ask: why you put unit testing in the front-end group? Reason: I could put it in the middle-end. However, for a long time in my mind, it has always been in the front-end group, perhaps for two reasons: (a) it is an alternative of the UI code; (b) its very existence depends on the diligence of keeping UI code thin and clean -- remember, I do not believe in unit testing UI code -- that is the next generation stuff; not nowadays everyday practice.

7. The above security and logging can be at property level (i.e. "entity" level, instead of "facade" level or "data access logic" level);
7'. Use the custom class business rule validation technique in CSLA; but via AOP (see above about AOP, but at property level).
7''. Use the “custom class databinding” technique in CSLA; but via AOP (see above about AOP, but at property level).
--- class-to-form using custom event
--- form-to-class (onchange; no exception in set; use rule)

--- tip: listview/read-only-grid read-only: this is good for user anyway;
so, no need of typed collection (note: sorting etc are control's business)
--- tip: update's return object: only get the seq and update the property
do not try to replace the whole object
--- tip: use read-only properties to "borrow" fields for m-m-like
--- tip: inheritance or parent -- pass reader, tx, parent etc.


--- "CSLA with dynamic proxy/aop":
(a) not limiting to 4 (CRUD) methods;
(b) so, no need of special workflow objects,
(c) so, no need for special “criteria” and “exists” classes.

(d) At property level, cleaner property/get/set,
because no CanRead/WriteProperty, PropertyHasChanged calls.

(there is more background info in this blog:
http://www.blogger.com/comment.g?blogID=26752431&postID=115078085354288833
)


--- leverage the full power of the “custom class” in the age/context of “SOA”:
Javascript subset C# to Javascript translator. The good news is that I believe I found it in Ajax framework community.



8. Use Nunit, but only on façade methods.

8'. 3-in-1 document writing for Spec, Test script (Fit or Fit-like), and User Manual: Unit testing is the pivot in all development activities. However, that is easy to say than do. To get that done in a smooth and controlled manner, we need to take a larger perspective, hence this item. For details, please read my related blogs.

---- Note this does not mean this 3-in-1 document writing takes away the pivotal position of unit testing. Unit testing is still the king – from a developer’s biased/tunneled perspective anyway :-)

---- Also note that by this small step, we are combining XP (TDD) with RUP/UP/ISO 9000. Because the key idea of the latter is “document driven”; and “3-in-1 document writing” is “document driven”. I really believe that in the electronic world, when we routinely take notes in Word (OK, or “StarOffice”? – actually I take notes using VIM, so, do not flame me for being M$ centric) and emails, there is no justification to use those story cards or ORC cards or pieces of napkin anymore – although they sound romantic. In other words, we can expand this further: taking electronic notes is one of the eight basic programming techniques. I know it sounds craze; however, and take some observation yourself:

In meetings, how many people are taking notes using a paper notebook? I guess it will still take a while for us to use a notebook computer, a tabletPC, or, a smaller PDA, or, just use the “old” technique that use a piece of paper and then later put the notes into a computer. The latter practice requires discipline; but it works. Regardless, if you really think about it, contrary to what XP/TDD tells us, those paper notes are not and cannot be simply thrown away; as a result, those paper notebooks are at least one of the sources of unagility.

Friday, July 21, 2006

Business Object, Domain Object, and Entity Object; also Façade Object, Workflow Object (or Process Object), and Data Transfer Object

Business Object, Domain Object, and Entity Object; also Façade Object, Workflow Object (or Process Object), and Data Transfer Object


As always, I read vikas’s blog. His recent post: http://vikasnetdev.blogspot.com/2006/07/soa-friendly-architecture-version-of.html , which links to http://codebetter.com/blogs/jeffrey.palermo/archive/2005/04/02/128598.aspx , reminded me the confusing terms used in the typical enterprise architecture – yes, I am saying that there is only one typical enterprise architecture; but there are many terms referring to the same thing.

The rest of this blog has two parts: a long background talk, and a short comment on the blogs of vikas’s and Jeffrey’s.


1. Long Background:

It started in Java. The best and also most influential two books are: “Core J2EE patterns” (http://java.sun.com/blueprints/corej2eepatterns/ ) and “EJB Design Patterns” (http://www.theserverside.com/tt/books/wiley/EJBDesignPatterns/index.tss). Those books and related efforts standardized the terms used in Java community.

However, old habits die hard. There is a widespread -- almost ubiquitous -- confusion, because of the double meaning of “Business Objects”: on the one hand, it means the “Domain Object”, which contains no methods that call database access code; on the other hand, it means the “Façade Object”, which contains methods that call the Data Access Layer, which specifically contains database access code.

OK, in order to clarify the confusion, in the above paragraph, I have to use the terms “Domain Object” and “Façade Object”. However, in the domain modeling “movement”, the term “Domain Object” has the same fate as that of the “Business Object”! Now, we have to use “Entity Object” to refer the same thing. In .net world, this is just perfect; in Java world, the term is close to "EntityBean"-- but it is perhaps a good thing, because it does not have the “bean” in it, and it leverages the similarity.

That is exactly what had been done in MS’s application architecture diagram (http://msdn.microsoft.com/practices/topics/arch/default.aspx?pull=/library/en-us/dnbda/html/distapp.asp ). If you look at it carefully, it is obvious that the diagram is copied from J2EE diagrams – I am not complaining – it is a good thing, especially if you consider that MS does not have a track record in enterprise computing.

There is only one thing in the diagram that I feel I need to complain: the term “Business Components” – it is still very confusing. It should be named as “Business Façade”. Obviously, the term “Business Component” is from M$’s past, the COM – COM is love, and we got to keep some of its trace.

To avoid confusions, I will continue to use “Façade Object” or “Business Façade”, instead of “Business Component”. I understand I am not doing what I am preaching (or implying to preach) -- I am not 100% compliant with M$’s terminology also – old habits die hard.

Another thing that is confusing (but have two different reasons, see below): “Business Workflows”, “Business Components”, “Business Entities” are at the same horizontal line. One reason is that “Business Entities” are used cross tiers/layers. Another reason is that “Business Workflows” should be one level higher than “Business Components”, but sometimes it goes directly to “Data Access Logic”.

“Data Transfer Object (DTO)” is similar to “Entity Object”, because it also does not contain methods that would invoke, directly or indirectly, database access code. However, DTO is even simpler: typically, it does not contain any logic at all. Also, it can be very ad hoc, determined by some UI (or Database) needs, while “Domain Object” is determined by the domain knowledge/logic.

2. a short comment on the blogs of vikas’s and Jeffrey’s

If you look at the diagrams in vikas’s and Jeffrey’s
http://vikasnetdev.blogspot.com/2006/07/soa-friendly-architecture-version-of.html http://codebetter.com/blogs/jeffrey.palermo/archive/2005/04/02/128598.aspx , you will find that they used other terms:

“Business Object Manager” (I guess it is the “Façade Object” -- it is very popular to use "XX_Manager" and "XX_Facade" interchangably)

“Process Object” (I guess it is the “Workflow Object”)

“Repository Object” (I’m pretty sure it is the “Façade Object”).

Perhaps my guesses are not correct: are there any differences between M$’s application architecture and the ones in vikas’s or Jeffrey’s? -- Yes, I am trying to advocate we use M$'s terminology at least as a "reference". Again, I realize that I am already guilty of not compliant when I use "Business Façade”, instead of “Business Component”.

By the way, I understand a lot of people feel “application architectures” and “service architectures” are critically different, but I am totally not convinced, so, I use them interchangeably: any not-short-sighted application architecture must also be a “service architecture”, and any not-just-an-air-ware service architecture must also be an application architecture.

Friday, July 14, 2006

3-in-1: Spec, Test script, and User Manual

3-in-1: Spec, Test script, and User Manual

I know there is the other side of the same coin: you may say that the “test” in “TDD” is not just “testing” per se; or, the user perspective in the spec is not just “user manual writing” per se -- they are deeper, etc.

However, before we get deeper into it; let’s test the water, and try the “shallow” things first and see how powerful it can already be.



---- “Test script” introduces a very good thing: it forces us to use consistent data in a scope that as large as possible. Fit makes it more explicit (see my previous posts; vikas has some good posting http://vikasnetdev.blogspot.com/2006/07/faq-fit.html); however, even you do not use Fit per se, you should use the concept of it: use “real” data (OK, as realistic as possible), in tabular format.

---- “User Manual” introduces another very good thing: it presents the UI, and describes things according to the typical usage flow, of the result of button-clicking. All other things (for example, typing, tab ordering etc.) are organized into those UI and button-clicking descriptions.



You may say, we are a big company, and we are doing large projects, and we have different official formats for those different documents. Good. Re-format the same document according to their official formats. You can ask some lucky volunteers to do that, or even better, create a program to do the conversion.

You may say, our QA department and Users department own those documents, so, it is not up to us … OK, in that case, it is simply a gift to them that IT has done most of the work already – they are going to love it.

Thursday, July 13, 2006

Domain modeling or data modeling

Domain modeling or data modeling?

(a) Users do not care “objects”. They care UI, and the fact that the data on the UI are saved in databases. So, by definition, UI and the key data are the “business language”; objects are not.

(b) The pragmatic inevitability of Anemic Domain Model http://www.martinfowler.com/bliki/AnemicDomainModel.html-- OK, just in case I am not clear enough, I am saying that although sounds terrible, anemic domain model is a good thing. -- Just as others pointed out, OR mapping encourages this. Again, a lot of people believe it is a bad thing (and therefore, OR mapping is a bad thing!), I believe it is a good compromise.

(c) Part of the reason of (b) is that > 80% of the function of an application is “data CRUD”; so, why bother domain model.

(d) Because of all above, domain model can be “skipped” at least for smaller projects; for larger projects, it is certainly a good exercise. However, even in the latter case, the first-cut of the major database tables should be done first; therefore, the key objects should be “copied” from data model. The key reason is, of course, users (see (a)). This is crucial. You may find ways to “bypass” the data modeling phase, and say that you start with a “domain model”. However, if you think of the reason how you get the major objects done, it is always “we need those key data”! OK, the value of being honest to ourselves? – Time saving: > 90% of the domain model can be done within one or two days, after data model is done. And data model is much easier to do, because you can get help from users directly. You may say, how about the rest 10%? – Those are the low-level objects, they are implementation oriented; and we should not talk about them with users anyway.

(e) Fit can fit in perfectly, even when we do not use domain modeling. The key is data.

Sunday, July 09, 2006

Between unit testing and functional spec

Excellent info! Vikas! http://vikasnetdev.blogspot.com/2006/07/faq-fit.html

You convinced me that Fit should be considered as one of the basic programming techniques – yes, I tend to go to "extremes", and a pun is intended :-)

1. In a lot of tiny projects, there are no business analysts (BA). The responsibilities of BAs are carried out among programmers, project managers, and power users. Project managers are not very technical; and they do not know domain very much either. So, it is crucial that power users can use Fit-tables.

Now, the key is how to steer power users to use Fit-tables. After reading your post, I put more thinking on it.

Currently, I am using documents containing story-board mockups plus buttons’ behaviors. It is a common sense approach of "functional spec"; if you really want some names, Alan Cooper’s “forms and behaviors” http://www.cooper.com/content/why_cooper/the_process.asp is a good source. I usually also intentionally “leak” the major (but not all!) database tables as the “key concepts” to users, so that I can verify the 1-1, 1-m, m-m concepts directly. Note that I never show the whole ER diagram to them, because that would scare them or confuse them. Also, totally contrast to what is in most OO books, I learnt not to talk about “objects” at all to users; they do not care, and they get confused by those anthropomorphical talking quickly. OK, I know my point is controversial; but I know I am very good at OO; and I also attended those official, intensive training courses from well-known companies, a few times; so, I know what I am talking about; and, I am not against using OO concepts within developers, or, even with some Business Analysts.

---- Note: the source of using OO (“domain model”), instead of ER, in functional spec/stories/use cases, is the assumption of the separation of code design and database design. That assumption is obsolete long time ago. Nowadays, in all tiny or small projects, developers, instead of DBAs, are responsible for database table designs. For larger projects, in the original analysis/design phases, it is also developers, not DBAs, who are doing the database table designs. Nowadays, because databases are so “easy”, and the coding is also so “easy”, database table design is totally developers’ responsibility; DBAs responsibilities are more for production issues and performance tuning. Again, I understand this point of view is controversial;what I am talking about is perhaps from bad habits or the long time braining-washing of "worst practices" (but to be fair to myself, I know it is the “reality practice” of at least more than half of the projects in the world) , so, read it with a critical mind ;-)

Obviously, the "functional spec" or “forms and behaviors” is also the “stories” (XP) or “use cases” (UP); just that it emphasizes that the mockups are crucial here – I know, it is a sharp contrast that in development, everything is around the unit tests, which is totally anti-UI – it seems that the value of Fit is that it provides a bridge between this yet another outrageous impedance mismatch.

Now, here is the fun part: in the “buttons’ behaviors” section, we have already used a lot of tabular format; now, by FIT, we can make those tables directly testable. We have two documents now; but that can be get used to easily.

So, after all, FIT can fit in very easily. Thank you, Vikas for posting this.

2. Another smaller issue (but still crucially though): it seems that it can be run by an open source program that is “tiny” (i.e., if I want to, I can get into it and fix or “customize” it in a few days, instead of a few weeks).

---- If possible, it should be able to be run without the web. In the cases that we do not have business analysts; or, business analysts do not care to run Fit by themselves, that would make things even closer to ordinary unit testing.

Tuesday, July 04, 2006

Re-read O’Reilly’s “JavaScript”, google "javascript" and re-introduction to javascript

There are two things that are always in my mind:

(1) When I learnt Javascript many years ago, I read O’Reilly’s “Javascript” book (the “rhino” book), and I learnt that javascript is extremely powerful: totally dynamic and totally OO capable. The “everyday” use is only a small portion of its full power -- just like our brains ;-)

(2) Non-database related business logic (i.e. “business validation” logic) in Java/C#/VB should be constrained within a subset of Java/C#/VB that can be easily translated into JavaScript. Automatically converting validation logic into javascript is the ultimate leverage of good “custom class” design in Java/C#/VB.net.

I understand it will take a village/community to do something about the above. As an application developer, all I can do is to talk about them, hoping “framework developers” or "vendors" will eventually pick them up (and, continuously re-validate the vision from feedbacks) ; and make sure what I have been doing will not work against “the power of Javascript”; and wait and follow closely the development in this field.

Finally, the time has come, with Ajax.


Here is a list of references:
1. The rhino book (go to amazon, search for javascript, you cannot miss it).
---- if you have already known a few languages, especially if you know a variety of languages, for example, C-family, VB, perl, and lisp, then, to learn a new language, especially to re-learn a "new" language, believe it or not, the fastest way is to get an "academic" book, not a “for dummy” book.

2. http://www.javascriptsearch.com/guides/Beginner/articles/Re-IntroductiontoJavaScript.html
---- I really like this article, because it says all what I want to say.
3. Just google “javascript”, and follow your instinct.

Sunday, July 02, 2006

C# culture and VB culture – from the “source”

Now we all know that that currently, the differences between C# and VB are only syntactical. If you need to make a choice, then, the decision is mostly “cultural”, plus a bet on the future.

Yes, the future. On M$ platform, the future is determined by M$. You may say, we developers also have a say. Right, that is true, just remember that that “say” must go through M$’s marketing department.

So, we need to take a look of the cultural differences directly from the “source”.
In this blog, I provided a link, and some excerpts. For details, please follow the link; or, better, google “C# creator”, “C# team” etc.

The excerpts are self-explanatory. When I have time, I will try to find what is the “culture” in the VB.net team? How do they innovate: researching, polling, “brain-storming”, “surveying”?

------------------------------------------------------
http://www.microsoft-watch.com/article2/0,2180,1837434,00.asp

--------excerpts from the above link:

Question: In regards to Visual Studio, do you see all the languages that are supported now evolving in parity? Will you continue to do to Visual Basic everything you do to C#?

Anders Hejlsberg: …. I do think there are some differences in the profiles of VB (Visual Basic) programmers and the kinds of characteristics they're interested in, and C# programmers, who are probably a little bit more interested in the bleeding edge of language technologies.

------------
Question: I've been interested in some of the various Microsoft Research projects around the various "Sharps," like X#, F#, Spec#. Are things that Microsoft is learning in those projects going to change what you're doing? How?

Anders Hejlsberg: …. Generics started out as a research project done by Don Syme and Andrew Kennedy at Microsoft Research in Cambridge (UK). These two researchers effectively took the C# language and the .Net platform and added parameterization of types on top of it. They modified it. They wrote two papers about it and gained some experience with it.

… It was, to me, a wonderful example of technology transfer from research into a product. I think Don and Andrew are great researchers and very pragmatic engineers. That's a great combination. I wish there were more like that.

… Don is now working on this thing called F#, which is taking a deeper look at functional programming languages on the .Net platform. And certainly a lot of the stuff we're doing with C#, going forward, will learn from — and is already learning from — functional programming languages.

… So in that sense, I'm an engineer at heart. But I'm keenly interested in research. So, yeah, F# and Spec# is stuff that we look at and evaluate all the time. We meet with the researchers. Our C# design meeting, which is a series of meetings that have now been going on for six years in the same room, in the same time slots, we have researchers come regularly and give presentations on what they're doing and vice versa. Those are all technologies we look at. C-Omega (formerly known as 'Xen' and 'X#') is another one. Some of the members of that research project are actually now members of the C# design team.

8 Basic Programming Techniques v3

List of updated items :

(1) I changed the name to “8 Basic Programming Techniques v3”, because nowadays, most, if not all, programming is enterprise computing. By changing its name, it makes it clearer that knowing the syntaxes of some languages, knowing "OO" or “design patterns", do not mean you know how to program.

Yes, I am raising the bar; however, you may also say that I am simply trying to shift the focus. If you do not know the syntax of VB.net (or C#, or Java etc.), but you know those techniques, with real hand-on practices, you are still a good programmer.

As a matter of fact, I changed the whole blog title to “on Programming or Enterprise Computing”.

I removed a lot of comments, but I added “3”, “4”, “5” and “6” marks in the 3-4-5-6 section.

(2) I added loose grouping sections ("backend", "middle-end", and "front-end"), to make it more understandable. Note that the grouping is really a very “loose” one. It is more a kind of "feeling" than anything else. For the “loose reasons”, see the corresponding sections.


(3) The item that directly prompted me to post this new version is:

--- leverage the full power of the “custom class” in the age/context of “SOA”:
Javascript subset C# to Javascript translator. The good news is that I believe I found it in Ajax framework community.


(4) I removed the Pro-Java comments; I guess it is politically incorrect to do that in the age of "close to teenage" of .net. However, I am getting more serious about how to get the best from both C# and VB cultures. I will post them later.

==============================

----------------------backend
----------------------The only thing I can argue about grouping logging with databases, is that for a long time, I always put them together. Perhaps it is because the most important logging is database access logging; perhaps it is because logging is somehow similar to database anyway. Note that the second logging in the middle-end is different from the first logging in the backend. The second one is focusing on the “aspect” aspect of it (the “client-side” of the logging); the first one is on the logging itself (i.e., the “server-side” of the logging).

1. Use log4net, in a simplistic style (avoid fancy stuff)
2. Use MS Ent Lib’s data access block
2’. Use Nhibernate, instead of Ent Lib, when we are in “advanced” situations

----------------------middle-end
3-4-5-6. Use the DynamicProxy in castle framework to centralize remoting(3), transaction handling(4), security(5), and logging(6), at the façade level.

Note: In order to do that, Use programmatic IoC (i.e., centralize all “Factories”); but for most projects, do not use XML style IoC (that is too heavy)

--- to avoid client casting, use factoryMethod
--- use abstrctFactory for switching easily
--- put class name, method name, variable name in the factoryMethod


----------------------front-end
----------------------You may ask: why you put unit testing in the front-end group? Reason: I could put it in the middle-end. However, for a long time in my mind, it has always been in the front-end group, perhaps for two reasons: (a) it is an alternative of the UI code; (b) its very existence depends on the diligence of keeping UI code thin and clean -- remember, I do not believe in unit testing UI code -- that is the next generation stuff; not nowadays everyday practice.

7. The above security and logging can be at property level;
7'. Use the custom class business rule validation technique in CSLA; but via AOP (see above about AOP, but at property level).
7''. Use the “custom class databinding” technique in CSLA; but via AOP (see above about AOP, but at property level).
--- class-to-form using custom event
--- form-to-class (onchange; no exception in set; use rule)

--- tip: listview/read-only-grid read-only: this is good for user anyway;
so, no need of typed collection (note: sorting etc are control's business)
--- tip: update's return object: only get the seq and update the property
do not try to replace the whole object
--- tip: use read-only properties to "borrow" fields for m-m-like
--- tip: inheritance or parent -- pass reader, tx, parent etc.


--- "CSLA with dynamic proxy/aop":
(a) not limiting to 4 (CRUD) methods;
(b) so, no need of special workflow objects,
(c) so, no need for special “criteria” and “exists” classes.

(d) At property level, cleaner property/get/set,
because no CanRead/WriteProperty, PropertyHasChanged calls.

(there is more background info in this blog:
http://www.blogger.com/comment.g?blogID=26752431&postID=115078085354288833 )


--- leverage the full power of the “custom class” in the age/context of “SOA”:
Javascript subset C# to Javascript translator. The good news is that I believe I found it in Ajax framework community.


8. Use Nunit, but only on façade methods