You are not logged in.
Pages: 1
Hi AB,
Thanks for your comment to my question in this thread.
https://forums.embarcadero.com/message. … 484#591484
I am trying to read through your SAD file to understand and start using this framework for web apps.
But your doc is too long to read through in a short period.
I think may be put my questions here to get a quick answers, then I can decide what to do next.
Basically I am trying to search a substitute solution to WebSnap. So I can use Delphi to develop Web App. with multiuser/session handling, AJAX implementation, via JSON. It certainly will be a multi-tier frame work. On the interface part, I put my bet on JQuery(mobile) as I don't know anything of SMS yet.
So far, I can see your mORMot fits most of the requirement, but seems only for Database Client-Server apps. Do you have any sample or doc to describe how to build a robust web Server ( in stand alone/ISAPI dll , or even in CentOS).
I am not a great fan of ORM, sorry, I still like SQL and have some experience of that. Some times sophisticated SQL query is hard to change to ORM code.
I also notice in your SAD doc, data types are different from Delphi. You have RAWUTF8, etc, which make me puzzled , what are they? how much new stuff I need to learn first before I can smoothly use mORMot?
All the objects seem non-VCL components, meaning need code each property and remember them all well. (For this point, I do think make your object/class into a VCL will smooth the learning curve for many Dlephiers.)
I know you have joined the DataSnap performance discussion and your performance won good reputation there. If I want to use your framework to replace my old project of DataSnap, how easy will it be ? Any Demo or teaching lessons available ?
Compare to RTC, what is your advantage/disadvantages?
Can I implement most the key modern functions they list in their home page?
What is the SMS? Do you know any advantage compared to JQuery?
Finally, I just found the Youtude is a good place to teach people how to implement development of programming. Do you have any plan to do that?
I guess it will make more people love your mORMot.
As you know , Delphi killed Web Server Development function, it leaves blank for Delphiers. You answers to above questions will benefit many people.
Looking forward to your answers. Thanks in advance.
Offline
Hi , I Agree with "tanghz",
I have used Datasnap , and I Have Found a lot of docs and videos to implement Datasnap (TCP/IP, REST...)
with MORMOT, a few examples and videos are listed, but need a "real and" Simple Example including Client/Server Project updating/inserting a simple Table in Database , and simple reporting ... it seem for me Very Useful..
I have downloaded an useful Example from GoogleCode "synopse-sqlite-generator" and "synopse-sqlite-demo-r13" but the last one uses an old MORMOT Framework
I Think that the old member can share some examples to increase "Mormot Users"
(sorry for my bad english)
Thanks,
Offline
I added a FAQ section to the SAD document.
Please find below the preliminary content.
Hope it helps.
Thanks for your feedback!
For comparison with RTC, see http://blog.synopse.info/post/2012/04/2 … t-attitude
About samples, take a look at the "Samples" sub folder.
First of all, take a look at the keyword index available at the very beginning of this document. The underlined entries targets the main article about a given concept or technical term.
Feel free to give your feedback in the very same forum, asking new questions or improving answers!
Your SAD doc is too long to read through in a short period.
Too much documentation can kill the documentation! But you do not need to read the whole document: most of it is a detailed description of every unit, object, or class. But the first part is worth reading, otherwise you are very likely to miss some main concepts or patterns. It just takes 15-30 minutes!So far, I can see your mORMot fits most of the requirement, but seems only for Database Client-Server apps.
First of all, the framework is a set of bricks, so you can use it e.g. to build interface based services, even with no database at all. We tried to make its main features modular and uncoupled.I am not a great fan of ORM, sorry, I still like SQL and have some experience of that. Some times sophisticated SQL query is hard to change to ORM code.
ORM can make development much easier; but you can use e.g. interface-based services and "manual" SQL statements - in this case, you have at hand direct external database access classes in mORMot, which allow very high performance and direct export to JSON.I also notice in your SAD doc, data types are different from Delphi. You have RawUTF8, etc, which make me puzzled, what are they?
You can use standard Delphi types, but some more optimized types were defined: since the whole framework is UTF-8 based, we defined a dedicated type, which works with all versions of Delphi, before and after Delphi 2009. By the way, just search for RawUTF8 in the keyword index of this document.All the objects seem non-VCL components, meaning need code each property and remember them all well.
This is indeed... a feature. The framework is not RAD, but fully object-oriented. Thanks to the Delphi IDE, you can access all properties description via auto-completion and/or code navigation. Then you can still use RAD for UI design, but let business be abstracted in pure code.I know you have joined the DataSnap performance discussion and your performance won good reputation there. If I want to use your framework to replace my old project of DataSnap, how easy will it be?
If you used DataSnap to build method-based services, translation into mORMot would be just a matter of code refactoring. And you will benefit of new features like Client-Server services via interfaces - which is much more advanced than method-based pattern, and will avoid generating any client class via a wizard - and additional security and authentication.
If you used DataSnap to access a remote database, you would need additional work, since we do not offer direct access to VCL data-sources.What is the SMS? Do you know any advantage compared to JQuery?
Smart Mobile Studio is an IDE and some source runtime able to develop and compile an Object-Pascal project into a HTML 5 / CSS 3 / JavaScript embedded application, i.e. able to work stand alone with no remote server. When used with mORMot on the server side, you can use the very same object pascal language on both server and client sides, with strong typing and true OOP design. Then you feature secure authentication and JSON communication, with connected or off-line mode.I am trying to search a substitute solution to WebSnap. Do you have any sample or doc to describe how to build a robust web Server?
See sample 09 - HttpApi web server and the corresponding HTTP server paragraph in the SAD pf.Have you considered using a popular source coding host like Github or BitBucket?
We love to host our own source code repository, and find fossil a perfect match for our needs, with a KISS approach. Note that you can get a daily snapshot of the repository directly from http://synopse.info/files/mORMotNightlyBuild.zip
Offline
Thanks AB.
Most of the questions are clear now.
I will start from your sample 09.
Only one thing is critical for DB programming. You mentioned
If you used DataSnap to access a remote database, you would need additional work, since we do not offer direct access to VCL data-sources.
Does it mean your object can not directly connect to ClientDataSet ( I personally feel this one is very handy and useful) and DataSource component (this one links to all DB aware VCLs, very important).
I have another question. My project structure currently is
1)Datasnap server sits in the server machine with the DB connected by UniDAC.
2)Datasnap Client connect with DataSnap server via TCP/IP. This Client also servers as Web server (by web broker+PageProducer) with Jquery embed in code.
If I use mORMot as substitution, what would be the new structures? (for instance where each of your class fit in, do you have a pool mechanism? etc ) any sample of authentications/authorizations?
I can not do now is that
I want each user logged in to be assigned a DataModule instance until his session expires or log out. During the session time, each Datamodule will handle the DB communications with DB and Web request/despatch .
Which units of mORMort I should use?
Many thanks.
Offline
Does it mean your object can not directly connect to ClientDataSet ( I personally feel this one is very handy and useful) and DataSource component (this one links to all DB aware VCLs, very important).
Yes, there is no direct full TClientDataSet support yet.
What you can do is retrieve content from the server, then fill a TClientDataSet with the data - see sample "17 - TClientDataset use".
But you won't be able to upload modifications to the server via this TClientDataSet.
If I use mORMot as substitution, what would be the new structures? (for instance where each of your class fit in, do you have a pool mechanism? etc ) any sample of authentications/authorizations?
If you use only interface based methods, it will be pretty straightforward: just define the methods, and that's all.
You can keep your existing UniDAC connection and SQL statements, or even use our SynDB classes for better performance.
There is a thread pool already included, and you should better rely on kept alive HTTP connections.
Take a look at "16 - Execute SQL via services" sample to see one example of remote execution of SQL statements, including JSON and grid display.
I want each user logged in to be assigned a DataModule instance until his session expires or log out. During the session time, each Datamodule will handle the DB communications with DB and Web request/despatch.
With mORMot, forget about the DataModule.
There is already built-in session support. See "authentication" and "authorization" part of the SAD pdf.
It will use much less resources than using dedicated DataModule.
IMHO you may consider moving away from your 2-Tier infrastucture (i.e. RAD approach).
Using DataSnap as remote access to DB may appear as a 3-Tier design at physical layers level, but it is in fact still a 2-Tier architecture, with no data abstraction, at logical level.
(see n-Tier in the SAD pdf about this distinction between physical and logical layers)
Consider switching to a n-Tier logical layer (n>2), i.e. using objects/classes to define your business logic, then expose them as service.
It will allow to have rich AJAX clients, much more responsive than JQuery, even able to run in stand-alone/offline mode.
And it will increase maintainability a lot.
This is why we did not push into the direction of using TDataSet on mORMot for the client side. Do not rely on database, but objects.
Offline
Hi AB,
Just installed your framework and tested some samples. Very impressed by the speed. I believe mORMot got great potential. I am still not quite clear on following points, hope you can help:
1)In DataSnap, the server and client can select data transfer protocol such as TCP or HTTP. Can mORMot does the same?
2) For most of the Web server samples , if I visit like http://localhost:8080/ it will reply with
HTTP Error 404.
On the server side, can I use the PageProducer to respond the web request? I have old project which involved several PageProducers onHTMLTag event.
3) For the example 19, it really shows the power of mORMot to extend to other direction such as JS thin client. I am not sure the high performance (speed) is the result of ORM or simply because it is non-VCL object, or by any other reason? For me, and I guess most of Delphiers too , we are used to VCL/RAD approach. It seems easier to handle/remember properties, events etc. Although Delphi IDE has the auto complete function, you have to go though many irrelevant properties when you want to find one you need. If a mORMot VCL server component available, we can easily drag and drop to start working on it. Now, I still can not find an easy way to build a standalone web server with authentication function.
I believe this is very standard demands for mORMot framework. I am wondering if you could provide such an example?
4) For me, I often query several tables by Left join, with Order by , group by filters. I am not sure ORM can do it easily. For complicated tables, there will be 30+ fields involved. If change them all into objects, there will lots of typing work. This just gives me a feeling we are going back to stone age, or in computer language DOS age. So, I am wondering if you have an example to show us that we can use our SQL statement ( from old projects) to retrieve the results either via UniDAC or your SynDB, then send the results via JSON/REST way to multi-tier client?
Overall, I believe mORMot is a good framework. The barrier for its being popular is the gap between RAD and your pure coding object approach. Programmer are lazy people as you may agree. If a WebServer complement can make a webserver ready for use without much coding, certainly people will go for it. I just hope mORMot can do sth in this direction, smooth the learning curve by borrowing some conventional RAD concepts (certainly it must be true that VCL does not affect the performance). In that case, I guess it will make more people joint you and make this stronger and more popular framework for Delphier.
Many thanks,
Offline
First of all, ensure you retrieve the latest "unstable" 1.18 revision, not the now outdated 1.17 revision.
The associated SAD 1.18 pdf is also much more evolved and is the reference.
1) HTTP is just a small header over TCP.
No benefit at all, just potential issues e.g. when using firewall and routed networks.
2) http.sys uses a per-URI registration, so you can have several servers at the same port, if all of them have a separate URI.
But you can not share a http.sys URI with an Indy server, which requires the whole port (and is definitively much slower and stable than http.sys).
Use a dedicated port, or see HttpApiServer.dpr in sample "09 - HttpApi web server", or simply use a method-based service to return your content.
3) VCL is not a speed bottleneck by itself.
mORMot is fast due to its http.sys based server and a bottom-up design for speed and multithreading - see http://blog.synopse.info/post/2011/05/2 … plications
IMHO RAD excludes true OOP design: method-based events make your RAD code procedural-oriented, even if "hosted" in a class.
And this is not my unique point of view. Outside the rough RAD use of Delphi/VisualBasic/ASP.NET world, i.e. in business solutions in Java or C#, you use good OOP design, IoC and some other patterns. See http://blog.synopse.info/post/2011/11/2 … principles
For instance, in Domain Driven Design (DDD) which is a pattern I use daily, RAD is excluded within the business layer.
RAD is good for UI design, not for modeling your application.
So limited RAD support in mORMot is not a limitation, it is a feature.
Of course, anyone not able to understand how e.g. sample "14 - Interface based services" works would probably not able to use mORMot.
But none of any modern framework around (e.g. node.js, WCF, or J2EE) either.
4) As stated in the SAD pdf, you can use the WHERE clause to find a row or a set of rows, including an ORDER BY clause if necessary.
If you need something more complex, you can bypass the ORM and use any SQL statements directly.
See sample "16 - Execute SQL via services".
Any small piece of time taken in order to follow patterns proposed by mORMot for modeling your program logic, will help your future projects.
Try to understand the first chapters of the 1.18 SAD pdf, and compile/run all available sample programs.
True n-Tier layered architecture is definitively a plus.
Then you will still be able to enjoy using RAD for designing your UI, without any mixing of logic.
Thanks for your interest!
Offline
Hi All,
tanghz, I have read your conversation with AB and I cannot be more agree with you. I think it is too hard to make a short development and the learning curve is huge. Of course I understand AB point too but I think AB is talking about madium to large developments and not an small webservice exporting 3 functions like the one I'm trying to do. It would be great to have some "WebBroker/DataSnap" like examples of mORMot conected to a TDataSet descendant in case we want to do some CRUD operations on a DataBase. tanghz, if you finally did that I would appreciate some help. Anyway I'm digging into 1.18 SAD but I have to say it is more like a book about good practices than a tutorial to understand a framework. For me, I feel a lack of examples.
Thanks you all
Offline
You can export 3 small functions with method-based services very easily with mORMot.
It is done in a view lines of code.
See http://blog.synopse.info/post/2010/07/1 … phi-7-2010
Honestly, there are already 21 examples, plus the main "SynFile" demo.
We are adding new samples regularly.
I just took a look the SAD pdf:
The "good practice" parts may be:
- "2. Architecture principles" (11 pages)
- "6. Daily ORM" (7 pages)
- first part of "16. Interfaces" (7 pages)
All the rest are mORMot dedicated sections (with code).
So you have 25 pages of "good patterns" theory, for more than 300 pages of introduction to all mORMot features.
Then 794 pages of detailed information about each unit, class or type defined in the framework.
Then the "25. SynFile application"' sample code explained in detail (43 pages), which can be seen as a tutorial.
The issue with the framework is that it has so many potential uses, that there won't be any "one way tutorial" to show.
You have code sample about each mORMot feature, one bigger "SynFile" application, but even this one is only one way of using it.
Trust me, I understand your concern.
I've just upgraded the internal TDataset related classes, to by-pass the TClientDataset, for much better efficiency and less resource use.
See sample "17 - TClientDataset use" - and http://synopse.info/fossil/info/12ec6a5c60
Of course, our TDataSet are read-only.
They are very good if you want to display some content.
But you have only the R of CRUD here.
For the "CUD" part, you should consider dedicated remote methods (like ICustomerRepository.Add/Update/Delete). Putting your logic on the server won't cost more, and will be ALWAYS beneficial, even for a small application.
If you take a look at the sample code source code, you will admit that all is done in a very few lines of code.
Just compare our interface-based services samples (14 - Interface based services) with http://msdn.microsoft.com/en-us/library/ms734712 (especially the .exe.config part) and you will be convinced.
What is missing is some help to reduce the learning curve of mORMot.
Some users are sharing their experiment - see http://synopse.info/forum/viewtopic.php?id=1475
I'm convinced the tutorial should be written by people not involved within the core development of the framework.
Any input is welcome!
Offline
Software development is harder than it seems. I think AB's approach is correct and there's no escaping an incline on the learning curve. The 'bare bones' example's I looked at when starting out were good enough for me.
Offline
Pages: 1