Abaksoft Posted February 17, 2015 Posted February 17, 2015 Hi Farshad, I know you are very busy and i praye for you, but we really need a FAQ. Related Topic http://forums.unigui.com/index.php?/topic/2727-cant-we-create-a-best-practice-guide-for-unigui/?hl=practice A short summary will be very helpful : 1. What are the good practices 2. What avoid to do (for example declaring global variable having regard to client instances) 3. How do we take care in server side and client side 4. What is the difference between UniDataModule and ServerModule Etc... Regards. 1 3 Quote
ZigZig Posted February 18, 2015 Posted February 18, 2015 Hi Abaksoft (and everybody), Maybe we could create and fill a wiki site about uniGUI best practices (something like http://unigui.wikispaces.com, which I created for example) - if Farshad agrees ? So we could already share "our" best practices, tips & tricks in a structured way,and let the uniGUI community, Farshad and FMSoft team add, fill and/or correct articles. I already did this for my company (a french-spoken Wiki into our Intranet) and it allowed employees to easily understand and practice uniGUI. I can eventually translate and share our articles. 4 Quote
Abaksoft Posted February 18, 2015 Author Posted February 18, 2015 ZigZig, Very nice idea, hoping to see this happen and not remained in oblivion since Topics 2013 ! I am sure many of us (like me), are developing blindly, groping. That simply works but ??? what about the true rules ? You understand me ! OK, let's go for an official wiki. Merci ZigZig. "Au fait, même en français, je suis preneur. Il me semble qu'il existe des membres francophones dans le site." Salutations les meilleures... 1 Quote
ZigZig Posted February 18, 2015 Posted February 18, 2015 Abaksoft, Let's do it! Too late for me today but I'll begin this (un)official Wiki tomorrow, unless Farshad says that he disagrees. PS : your French is better than my English! Quote
ZigZig Posted February 19, 2015 Posted February 19, 2015 Hi, I created a Wiki at https://unigui.wikispaces.com/ (Wikispaces seems to be a good wiki hosting solution), and set access to public (no need to create an account, just like Wikipedia... but it is not recommanded to be anonymous when editing a wikipage). I put some ideas of topics, I'll try to post some articles this week-end. Please feel free to create/edit everything you want! 2 Quote
Abaksoft Posted February 19, 2015 Author Posted February 19, 2015 Excellent...Bravo ! Ladies and gentlemen, fasten your seat belts ! Unigui, imminent takeoff... 1 Quote
Administrators Farshad Mohajeri Posted February 19, 2015 Administrators Posted February 19, 2015 Hi created a Wiki at https://unigui.wikispaces.com/ (Wikispaces seems to be a good wiki hosting solution), and set access to public (no need to create an account, just like Wikipedia... but it is not recommanded to be anonymous when editing a wikipage). I put some ideas of topics, I'll try to post some articles this week-end. Please feel free to create/edit everything you want! That looks brilliant! Shame on me that I haven't started a similar wiki site yet. Let me inform that after fixing a few glitches in 0.99 my main target will be preparing the help and other documents for uniGUI. I will try to contribute to above wiki site anytime I can. Thanks a lot @ZigZig 1 Quote
ZigZig Posted February 20, 2015 Posted February 20, 2015 Some draft articles are online: - best practice - differences between MainModule, DataModule, ServerModule - how to improve loading time - how to create LiveBindable component - AddJS vs. JSCode vs. SendResponse - what avoid to do (draft) Please feel free to comment, correct and add articles: http://unigui.wikispaces.com ! (and please don't hesitate to correct my horrible English). Quote
Administrators Farshad Mohajeri Posted February 20, 2015 Administrators Posted February 20, 2015 Editing seems to be open to any anonymous surfer. Isn't it better to limit editing to members only? Quote
ZigZig Posted February 20, 2015 Posted February 20, 2015 Editing seems to be open to any anonymous surfer. Isn't it better to limit editing to members only? As you wish! I just changed this to "publish allowed to members only". PS: Farshad, you've full admin access to this WikiSpace, you can change what you want! 1 Quote
Administrators Farshad Mohajeri Posted February 20, 2015 Administrators Posted February 20, 2015 As you wish! I just changed this to "publish allowed to members only". PS: Farshad, you've full admin access to this WikiSpace, you can change what you want! 2 Quote
Abaksoft Posted February 20, 2015 Author Posted February 20, 2015 Hi ZigZig, Thank you very much for this indispensable complement. You are doing a good job ! Oh...maybe a little more clarity : I saw : - in section : Where can I place Data access components ? "...only the database connection component itself has to placed on the UniMainModule or UniMainmodule controlled Datamodule." In Section : The three layers of UNIGUI / DataModule "...On the other way, a DB Connection (i.e. TADOConnection or TFDConnection) can be put on the ServerModule, so it is instanced only one time and shared for all users. Setting a Connection on the ServerModule will be useful if the DB server can manage a connection pool (as MS SQL Server does natively)." So, both of them are possible : the dbConnexion could be in ServerModule and in MainModule. Is it true ? Thank you again Quote
Administrators Farshad Mohajeri Posted February 20, 2015 Administrators Posted February 20, 2015 the dbConnexion could be in ServerModule :excl: Quote
ZigZig Posted February 20, 2015 Posted February 20, 2015 So, both of them are possible : the dbConnexion could be in ServerModule and in MainModule. Is it true ? Well, that's not so simple... As far as I know (but I can make a mistake) : If you put your DB Connection on MainModule (which is recommended), you won't take any risk at all, that is the safest way: everything will work just fine. But if there are 100 concurrent users, you'll get 100 concurrent connections to your DB: thus your DB server will have to be able to manage such a load. On the other hand, if you put your DB Connection on ServerModule, you'll get one, and only one connection, regardless of the number of concurrent users. So your DB Server will not have to manage a huge set of connections (that can be a good thing if you have a small DB Server): your connection will be shared by all active sessions... but the 100th user could have to wait a long time before getting his slot on the DB Server (that's not a good thing: you'll get some undesirable effects as time-out, blank page, long hourglass time, record lock...). So, what is the best practice? - if your application won't be accessed by many users at the same time, and/or if your DB Server can natively manage a pool of connections (*): you can put your Connection on ServerModule. Anyway: you can try. - in all other cases: use MainModule. Farshad, if I'm wrong, don't hesitate to change/adapt/comment all mistakes you'll find. (*) A TADOConnection + Native client driver on a MS SQL Server is a good example of native pool of connection: SQL Server will create a new connection when needed, without asking to Delphi. A TConnection + ODBC on MS Access is a bad example. Quote
Abaksoft Posted February 20, 2015 Author Posted February 20, 2015 Thanks a lot ZigZig. Your expertise and experience brings its fruit. _____ "C'est dans la subtilité que les esprits aiguillés, émergent !" Quote
Administrators Farshad Mohajeri Posted February 20, 2015 Administrators Posted February 20, 2015 On the other hand, if you put your DB Connection on ServerModule, you'll get one, and only one connection, regardless of the number of concurrent users. So your DB Server will not have to manage a huge set of connections (that can be a good thing if you have a small DB Server): your connection will be shared by all active sessions... but the 100th user could have to wait a long time before getting his slot on the DB Server (that's not a good thing: you'll get some undesirable effects as time-out, blank page, long hourglass time, record lock...). A DB Connection can not be shared among different threads unless it is designed to behave so. Each thread must have its own copy of TXXConnection. So as a general practice one should not put a connection on ServerModule. 2 Quote
ZigZig Posted February 21, 2015 Posted February 21, 2015 A DB Connection can not be shared among different threads unless it is designed to behave so. Each thread must have its own copy of TXXConnection. So as a general practice one should not put a connection on ServerModule. Dear Farshad, you are obviously right! Actually, I considered the possibility of putting a TXXConnection on ServerModule, in terms of CPU load and sharing static resources (such as variables)... but I didn't consider at all the thread-safe perspective. What a shame, what an idiot I am! So, to be as clear as possible: dbGO (TADOConnection) is not thread-safe at all, dbExpress seems to be able to manage multitthread connections in some specific cases (but it is not recommended in real world), FireDac pretends to have thread-safe Connection, but with so many conditions that, in fact, it is not thread safe at all. Your conclusion is the only good one: don't put a TXXConnection on ServerModule. I'll modify the Wiki article ASAP. 1 Quote
Abaksoft Posted February 21, 2015 Author Posted February 21, 2015 Here, we are in the stratosphere. It is this kind of articles that I love ! Quote
Mohammed Nasman Posted February 22, 2015 Posted February 22, 2015 Great idea, and will be very helpful for who are using UniGui or for who want to use it. we can add more articles. - Scalability with UniGui. - Session Management with UniGui. - UniGui vs UniGui Mobile. - Using ExtJs commands to overide or extend UniGui Controls 1 Quote
Hayri ASLAN Posted February 22, 2015 Posted February 22, 2015 I started to Best practice for exporting to Excel I Think if we split topics to interested users, It will be good 1 Quote
ZigZig Posted February 22, 2015 Posted February 22, 2015 Great idea, and will be very helpful for who are using UniGui or for who want to use it. we can add more articles. - Scalability with UniGui. - Session Management with UniGui. - UniGui vs UniGui Mobile. - Using ExtJs commands to overide or extend UniGui Controls Good idea, thans Mohammed. Feel free to add all articles you want, you just have to freely register to the Wiki. Quote
ZigZig Posted February 22, 2015 Posted February 22, 2015 I started to Best practice for exporting to Excel I Think if we split topics to interested users, It will be good Thank you Hayri Aslan! Quote
Darth Florus Posted February 18, 2016 Posted February 18, 2016 Pals:For this kind of scalability I recomend to use a DataSnap Server to manage database connections plus bussiness logical and make your UniGui app as a ThinClient of this server.This will help you for example to be a same layer of validations/connections for your Web App and your Web Mobile App or else kind of app your need.Y use something like that to generate pdf/exel files from ReportBuilder reports. This method eases load of work from UniGui to a other thread. And because a Delphi App does not manage very well a load on a multiple-processor system I think this way of work is very usefull.This kind of work allows to execute a process in other server than the UniGui app runs. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.