Jump to content


Photo

A mini-guide


  • Please log in to reply
24 replies to this topic

#1 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 462 posts
  • LocationAlgeria

Posted 17 February 2015 - 05:43 PM

Hi Farshad,
I know you are very busy and i praye for you, but we really need a FAQ.
Related Topic
http://forums.unigui...ui/?hl=practice

A short summary will be very helpful :
1. What are the good practices
2. What avoid to do (for exemple 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.
  • 2

#2 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 18 February 2015 - 11:55 AM

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.


  • 2

#3 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 462 posts
  • LocationAlgeria

Posted 18 February 2015 - 06:16 PM

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

#4 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 18 February 2015 - 06:26 PM

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!


  • 0

#5 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 19 February 2015 - 02:25 PM

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

#6 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 462 posts
  • LocationAlgeria

Posted 19 February 2015 - 05:14 PM

Excellent...Bravo !

Ladies and gentlemen, fasten your seat belts !

Unigui, imminent takeoff...


  • 1

#7 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9815 posts

Posted 19 February 2015 - 06:34 PM

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

#8 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 20 February 2015 - 04:35 AM

Thanks a lot ZigZig!


  • 0

#9 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 20 February 2015 - 02:19 PM

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


  • 0

#10 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9815 posts

Posted 20 February 2015 - 02:32 PM

Editing seems to be open to any anonymous surfer. Isn't it better to limit editing to members only?


  • 0

#11 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 20 February 2015 - 02:35 PM

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!


  • 0

#12 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9815 posts

Posted 20 February 2015 - 03:30 PM

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

#13 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 462 posts
  • LocationAlgeria

Posted 20 February 2015 - 03:30 PM

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
  • 0

#14 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9815 posts

Posted 20 February 2015 - 03:41 PM

the dbConnexion could be in ServerModule

 

:excl: :excl: :excl:


  • 0

#15 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 20 February 2015 - 04:25 PM

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. 


  • 0

#16 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 462 posts
  • LocationAlgeria

Posted 20 February 2015 - 04:41 PM

Thanks a lot  ZigZig. Your expertise and experience brings its fruit.

:)

_____

"C'est dans la subtilité que les esprits aiguillés, émergent !"


  • 0

#17 Farshad Mohajeri

Farshad Mohajeri

    Administrator

  • Administrators
  • 9815 posts

Posted 20 February 2015 - 05:43 PM

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

#18 ZigZig

ZigZig

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 340 posts

Posted 21 February 2015 - 06:20 PM

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

#19 Abaksoft

Abaksoft

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 462 posts
  • LocationAlgeria

Posted 21 February 2015 - 07:11 PM

Here, we are in the stratosphere.

It is this kind of articles that I love !

:)  :)  :)


  • 0

#20 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 137 posts
  • LocationGaza - Palestine

Posted 22 February 2015 - 11:41 AM

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


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users