Sunday, April 23, 2006

Core OTTEC Techniques

After “8 OTTEC (123 Enterprise Computing) Issues” and “Core .net Tools and Frameworks”, here are the “Core OTTEC Techniques”.

Note that I keep the technique item numbers corresponding to the 8 issues; also, you can find the links to the tools and frameworks in the previous post, or, in the “Links” section of this blog site.

OTTEC Techniques:

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

3-4-5-6. Use the AOP in springframework (or the DynamicProxy in castle framework) to centralize remoting, transaction handling, security, and logging, 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)

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).
---- Note that I said that we use techniques from Java; but CSLA originates from classic VB and VB.net. Further, the “custom class databinding” is indeed a new thing in .net. I admit that it is close to an over generalization; however, please also note that the idea of “custom class and business rule validation” is the mainstream in Java. There is no dataset "pollution" – at least in the days when the mainstream convention was established. The same logic applies to MS Ent lib’s data access block. Wrapping JDBC is a routine, mainstream practice in Java -- that is, if you have not graduated to using OR mapping (e.g., Hibernate).

---- I intentionally use the “over generalization”, is to emphasize that it is a painful learning experience for a classic VB team, to introduce those techniques. The fact that CSLA originates from classic VB, and MS Ent Lib has no direct Java origin, does not change the fact that those things are “routine”, common sense practices in Java, but in a VB team, typically you will have to have serious uphill efforts to introduce them, one by one, sometimes.


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


In my next post, I will give an example, i.e., we will have code! Running code is the king; and the king is coming.

Core .Net Tools and Frameworks

This is part of a reply of a comment (for the comment and reply, just click the title of this blog). It turnes out that it deserves as a seperate blog entry.

Also, I only put the "core" tools and frameworks here. We are overloaded with information now. Too often, too much information is the problem; not too little.
--------------

As an OTTEC practitioner, I do not re-invent frameworks. I just use them. If I feel I need to do some framework development, I participate those projects. I do not mix OTTEC and framework developments.

Before I put out my own code, you can get warm-ups by getting familiar with the following tools and frameworks:

Log4net
http://logging.apache.org/log4net/

MS application blocks (a.k.a. enterprise library), the data access block
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlib.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/EntLib2.asp

Nhibernate
http://www.hibernate.org/343.html
Springframework
http://www.springframework.net/
Casltle framework
http://www.castleproject.org/index.php/Main_Page
CSLA framework
http://www.lhotka.net/ArticleIndex.aspx?area=CSLA%20.NET
Nunit
http://www.nunit.org/

Saturday, April 22, 2006

8 OTTEC (123 Enterprise Computing) Issues

Enterprise Computing (EC) has been the niche of the Java platform; its sweet spot is to have at least three developers, three months development, and thirty end users -- I made the numbers up, but you got the idea.

OTT stands for, well, real simple, "One-Two-Three", which refers to "one developer, two weeks development, and three end users". Obviously, it is about small applications. Traditionally, it is the niche of "departmental computing", in which classic VB is the king.

However, in hindsight, we now know better. OTT is still enterprise computing, for the following reasons:
(a) Many OTT products (or subsystems) consist of bigger systems, and they are mission critical;
(b) An OTT will have a long lifecycle time, during which it usually grows; and even it does not, its maintenance and small enhancements will cost resources and time far more than "one-two-three".

So, OTT is OTT Enterprise Computing, hence OTTEC (or, 123 enterprise computing).

Neither classic VB nor Java can handle OTTEC. Note that I am not talking about the languages per se; I am not even talking about the platforms. I am talking about the techniques and cultures that are carried with VB and Java. To carry out OTTEC, we need C#. It will borrow techniques from lightweight Java world (i.e. non-J2EE world), and will push those techniques to their lightweight extremes. Just to be fair to classic VB, I want to point out again that classic VB was the king of the OTT niche; as a result, classic VB carries the right culture for the sense of how "heavy" the techniques should be.

Note that VB.net is functionally the same as C#. We can use either VB.net or C# for OTTEC. It seems that it is inevitable that we will use both VB.net and C#. For a team, you may feel that you can "standardize" on one language. Then, very soon you may find that you need to use an in-house or an open source product, that uses precisely the language other than you have standardized! As a result, it is inevitable that a competent programmer should know both.

Having said that, I guess we need to know that OTTEC requires borrow and modify techniques from Java, and C# is very close to Java, both syntax-wise and community-wise -- most (but not all though) first-generation open source projects in .net are ported from Java and are in C#.

However, there are some good open source projects originated from VB.net, one prominent example is CSLA, http://www.lhotka.net/ArticleIndex.aspx?area=CSLA%20.NET (CSLA has C# version also).

OK, you may say, enough concepts, tell us about those "techniques from lightweight Java world" and how can we push those techniques to their lightweight extremes.

Before doing that, I need to list eight issues that those techniques try to solve. After all, techniques are just the "means" to some "ends"; and we need to know those "ends" first. However, I also noticed that some of those eight items sound more like techniques, instead of "ends" -- in "technical" context, it is not easy to tell apart "techniques" and "ends" -- let's assume we can justify that they are "ends" by themselves.

1. Have flexible logging
2. Wrap database access
3. Centralize transaction handling
4. Centralize communication handling ("remoting")
5. Centralize security handling
6. Centralize logging (this is different from flexible logging)
7. Separate UI and business logic completely
8. Have automated unit testing for business logic

I will not elaborate why we need to solve those issues. For that, please read any articles that essentially describe "lessons learned" in classic VB projects, and read those articles that essentially recommend "frameworks used" in Java projects. Note that in the latter category, the articles usually say how "lightweight" they are. However, if you used classic VB, or/and if you did some OTTEC, you know that they are still too heavy. That leads to my next post -- to be continued.


P.S.

Why OTTEC is important? -- if you know the importance of classic VB in a company (regardless what Java, perl, or C/C++ people have told you), you know the importance of OTTEC; and wait, there is more. Once we can do OTTEC in .net, and apply good Enterprise Computing techniques, then, we can divide bigger projects into many OTTEC projects. Then, more than 80% of Enterprise Computing are OTTEC! Effectively, this is an extreme vision/version of Extreme Programming (Test Driven Development).

Since we are talking about XP/TDD, I should point out one thing: because OTTEC is so lightweight, although it is double "extreme" of XP, it "cuts corners" (or, “lightweightize”) on some of its "extreme" techniques. For example, in OTTEC, there is no need and no time to unit testing UI; and there is no need and time to use mock objects, since we do not do intensive framework development and the testing is relatively coarse grained -- typically, only those facade methods are unit tested, and the testing purposefully includes database access code. Therefore, mock objects are not necessary. Also, because the code in unit testing does not use mock objects; the code is more ready to be pasted in UI code. This means there is no “extra” time that is “wasted” in unit testing – in OTTEC, every minute counts.

Note that this does not mean you do not need to know mock objects. When you use frameworks, you got to run their unit tests, and so you got to know mock objects. Also, to take full advantage of the nature of open source, to be a competent user, you got to be a contributor, therefore, you got to use mock object to develop frameworks or tools.

OTTEC is flyweight XP/TDD. Note that for XPers orTDDers, it may sound paradoxical; becuase they are used to feel that they are the most agile doves; and now, here are the flies ;-)

Reasons for Blogging and Finding a Blog Host

I finally decide to create my own blog. Why? It is a way to establish a track record of my career and my life, or, my career life -- for my personal life, I would like to set up another blog or web site :-) This is especially important for programming in the age of Internet, when using and contributing to open source projects are everyday practices. I can envision that after a while, a year or so, the blog can be a valuable resource, for my open source friends, my employers/co-workers, and even for myself.

However, regarding to my real world identity, there are two concerns here:
(a) I know what the trade secrets are for the company. However, there is always a large gray area.
(b) My Open Source activities are not always aligned with my work as an employee.

So, as a mechanism of multi-layer firewalls; I will do both of the following:
(a) I will not talk about details of any real system; I will always talk about public domain example systems;
(b) I will not expose my real world identity in this blog -- if you know who I am, that is fine; just keep it between you and me ;-)

Which blog hosting should I choose? It depends on the "requirements", of course. Several things in my mind:
(a) a stable one;
(b) with basic services that I can simply assume that they are there -- I do not want to spend time to experiment -- I am the user now -- as a programmer, I cherish this right! I can just assume, can't I?
(c) I want a professional community – I do not need fancy formatting and layout; however, I need good spell checking. Another feature is that readers can search all my blogs to find related topics.
(d) I want to download all my blogs and back it up, in text files/folder format; so that I can backup and/or move to another hosting easily.

This means I need to pick one that is big and "established" -- call me a snob, but for commodity stuff, being a "snob" is a safer bet.

With the above in mind, I googled "free blog hosting". I got "blogger.com" at the top. I did not know whether it was a big one (remember, I am a "snob" here!), so, I was hesitating.

Then, I googled "online community". No meaningful results. I thought about "myspace", but I feel it is mostly for non-professional use (I may be biased). Then, I remembered yahoo. I went there, I saw geocities. I used it before, it was good; but on the other hand, I feel I should look other things before I go there. I also thought about hotmail. But I do not want Microsoft this time -- since I used hotmail already (diversify ...). Then, I thought about google. Why not use google's blogger service -- but does google have a blogger service? I checked -- ha ha! it is blogger.com -- that is why I got it at the top of the search hit!

I know google will be here for at least a while. So, I decide to use it.

While I was writing this blog, I accidentally went to another page. It automatically saved the content. Excellent! one big plus.

I used the spell checking; I noticed that it does not use Ajax for real-time checking while I am typing. One point off. Also, it does not highlight the word (later, I tried "edit html", the hight light seems working). I do not know. Perhaps I will have to try another one hosting?

Because of the lack of (real time) spell checking high light, I used word, then, paste. Then, I saw all the paragraph info was gone. My goodness. I have to try myspace or geocity or hotmail now – I will report my discovery later.

I searched "start blogging", and I read through the results, I found those are useful. I found them are very good, but just scanned through; I will study them later:

http://www.windley.com/essays/2004/how_to_start_a_blog.shtml

http://www.techsoup.org/howto/articles/internet/page2084.cfm

http://weblogtoolscollection.com/archives/2004/12/30/tips-to-start-blogging

http://wiki.ehow.com/Start-a-Blog

P.S. After experimenting with blogger.com, although I still have to use Word for real time spell checking, it seems that it is OK to paste without losing formatting. The key is to know the difference between the "Edit Html" (raw html editing) and "Compose".
Also, I select a template, and changed a few numbers in the template to make it less "prettier", but more utilitarian (more space for my text than for aesthetics).