LuaBinding (integrate Lua script into Delphi native code)
LuaTextFilter (convert eLua into plain Lua executable script just like JSP)
Currently DMVCFramework use Embarcadero WebBroker framework, but is not tied to it. I’m working on a version that use IOCP (that is 10 times faster than plain WebBroker) and other web libraries for Delphi.
Code is enough stable and is already used in big production system.
There are a couple of bugs that affect WebBroker and so, DMVCFramework.
In our system, I’ve applied some patches to solve these problems. If you need those patches, ask me (I cannot publish the full code because it is Embarcadero licensed code).
This is the first “Hello World” for my Delphi MVC Web Framework.
MVCEngine in 'MVCEngine.pas',
BaseController in 'BaseController.pas';
mvc := TWebMVCEngine.Create;
mvc.AddRoute('/', procedure(Context: TWebContext)
Features list (some of them are in the internal roadmap)
Addressable with servername/controllername/actionname?par1&par2
Addressable with servername/controllername/actionname/par1/par2
Can also use anonymous methods as actions for very simple app (in the sample)
Some month ago I wrote a simple article about an MVP variant called PassiveView.
That example was very simple. Now I’ll present a more “advanced” version of that example.
The main problem with first example was the following method:
procedure TfrmCalculatorView.FormCreate(Sender: TObject);
//Link controls with related interface
IFirstOperand := TGUIEdit.Create(EditFirstOp);
ISecondOperand := TGUIEdit.Create(EditSecondOp);
ICalcResult := TGUIEdit.Create(EditResult);
IOperators := TGUISelectableList.Create(ComboOperators);
IError := TGUIEdit.Create(EditError);
//link view and presenter
FPresenter := TCalculatorPresenter.Create(Self); //<<-- THIS IS THE BAD LINE
The “BAD” line links the View with the Presenter but it’s in the view code, so this is meaning that View KNOWS the presenter… and this is not a good thing becouse the view is not so “passive”.
In a more advanced (and complex) version the View should be completely ignorant about the class that implement the presenter and the service.
In the main dpr file now the code now looks like the following.
Application.MainFormOnTaskbar := True;
//SETUP THE MAIN APPLICATION FORM FOR VCL PURPOSE
//SETUP ALL THE LINKS BETWEEN THE MVP TRIAD
MainPresenter := TCalculatorPresenter.Create(CalculatorView as ICalculatorView, TCalculatorService.Create);
Now the presenter take care about all links between the MVP triad.
constructor TCalculatorPresenter.Create(CalculatorView: ICalculatorView;
FCalculatorService := CalculatorService;
FCalculatorView := CalculatorView;
InitView; //does the links
There is another addition to the previous example. Now there is only one constructor in the presenter, and using dependency injection take 2 interface for the view and the service.