Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Some thoughts on DNN after 6 month module developmentSome thoughts on DNN after 6 month module development
Previous
 
Next
New Post
4/22/2007 7:31 PM
 

 Posted 18 hours ago and somehow didn't go through moderation, so it comes again.

First a little background. I'm an experienced software engineer and think himself have some clues on software development and software design. Hope you still agree on this after your reading. Also I've been working full time on a DNN product for 6 months and I'm a happy user. So please don't take this thread as an offence.
 
 
Currently DNN core organizes its most business logic in controller classes, which consist of static methods. Info classes are used as dummy classes to pass information around. IMHO, this is more procedural programming than OOP.
 
A software class should have both behavior and information and they shouldn't be separated, just like us human beings. For example, in an accounting department, there are account assistant, account receivable (AR), account payable (AP) and department manager. Everyone has his own professional knowledge and instructions or rules to follow (information) and do things differently (Behavior). An AP position is different from an AR position not only because they do things differently, but also because they require different professional knowledge, different accounting rules and different input from outside, or we can say In essence AP and AR are different because they do things differently, require different accounting knowledge and follow different accounting practices. Information and behavior are equally important and are two inherent parts of two accounting job.   There is no point to separate these two and no way to separate them if we want accounting things work.  
 
 
Separation of information and behaviors in software classes cause problems as well. When we try to extend a class, we have to extend both info and a controller class, which is a real pain when you have to deal with complex domain model that usually has a lot of inheritances. As a result, the number of classes increase a lot and you have to pass info classes around to do the simplest things, which in true cause more headache. I can write more on this, but you know what I mean.
 
 
When it comes to business logic, there are at least two types of them (forgot when and where I learnt the idea, but it works for me). Some business logic belongs to a single class, and some business logic is related specific business process or part of it. The latter should be in business process classes not controller classes. Usually business process classes delegate its responsibility to other domain classes and coordinate between them to get job done. Thus, business process classes are perfect candidate for transaction control. Putting different concerns into business classes is to ask for trouble. The result is business classes are unnecessarily coupled to other classes and hard to understand, maintain and improve. Sometimes the process logic goes to code behind file when developers find it belongs to nowhere. IMHO, DNN core architecture misses another layer above current business layer- I call it business process layer, which is a facade of business layer and deals with business process. This way we can organize business logic in more understandable and reusable way. One example is in CreateUser method of a UserController class and UserCreateCompleted in manageusers.ascx.vb, user registration logic can be improved easily if there is another abstraction on top of current business layer. Module developers can then call the method in business process class and reuse business logic in both UserController class and the code behind.
 
 
That's all for today. Thanks for reading and I will write more when I got time.
 
Frank
 
New Post
4/23/2007 7:01 AM
 

One thing I always try to keep in mind when evaluating software is the context in which it is written.  Rarely have I ever written a piece of software that I couldn't go back 6 months after the fact and find places where it could be written better or architected differently.  At the time I first wrote the software, there may have been time constraints or knowledge constraints which dictated a certain design.  It is difficult to tell in every case, but given enough project history it is not hard to piece together the context for DotNetNuke. Unfortunately, for most programs there is very little opportunity to go back and rewrite code just for the sake of rewriting it.  This is even more true in frameworks and APIs.  Once a framework is written, and people start to use and extend that framework, then it, for all intents and purposes, becomes frozen.  While it is possible to add to the framework, you will rarely have the opportunity to re-architect it because of all the other code that now depends on the API continuing to function the way it was originally developed.  In many cases, these dependencies extend beyond the syntactic contract of the API.  You will find instance after instance where applications rely on semantic behavior, so something as seemingly minor as returning an empty string instead of a null string to avoid Object Reference exceptions can have a huge impact on code which may have relied on that null string to indicate a certain application state.  So in fixing some obvious errors you introduce others, which because of the semantic nature of the dependency may be even harder to detect.

As for the use of controller classes and data classes not being OO, I would have to disagree.  If you look at Martin Fowler's seminal work on design pattern's you will clearly see that Data Transfer Objects are in fact a valid design pattern which has it's place within any given OO design.  Some would argue that because DNN is not necessarily a distributed application that the DTO pattern does not apply.  If I were building DNN as a static application for my own personal use, then I might not use the pattern, however, the minute I decide that DNN will be a framework, to be used and extended by others, then it becomes a valid design consideration to account for the case of distributed calls into the system.  There are many people who have extended DNN with webservices to enable desktop or remote application calls into the framework.  Without DTO's these extensions would have been very difficult, to the point of almost being impossible.

While one could argue from a purist design perspective that the overreliance on DTOs is bad, I would counter by saying that design consistency is equally important.  Think of this as denormalization for the sake of useability.  If every API required a complete relearning of the foundational understanding of how the system operated then you greatly complicate the learning process for that API.  Given the level of consistency throughout the DNN API, developers can look a a new API and quickly come up to speed on the semantics involved in its use.  There is a controller and there is an info object (or data transfer object).  My controller classes accept and return info objects, and I as the consumer of the API, can decide if I will use these info objects locally or remotely or both.

So, even if you may not agree with the design, at this point, it is what it is.  Changing it is not something that is likely to happen.  Given the size of the API and the size of the user community that has already extended it based on the current design, then it is extremely unlikely that such a fundamental change in the core architecture will occur, especially when there are much bigger items of concern that need to be addressed.


Joe Brinkman
DNN Corp.
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Some thoughts on DNN after 6 month module developmentSome thoughts on DNN after 6 month module development


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out