Jump to content

A mini-guide


Abaksoft

Recommended Posts

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.

  • Like 1
  • Upvote 3
Link to comment
Share on other sites

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.

  • Upvote 4
Link to comment
Share on other sites

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...

  • Upvote 1
Link to comment
Share on other sites

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!

  • Upvote 2
Link to comment
Share on other sites

  • Administrators

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

  • Upvote 1
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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!

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

  • Administrators

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.

  • Upvote 2
Link to comment
Share on other sites

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. 

  • Upvote 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...
  • 9 months later...

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.

  • Upvote 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...