Page 1 of 1
Some coding practice advice
Posted: Fri Jun 03, 2011 2:09 pm
by Num3
Hello fellow Pures, I need some advice about building a programming layout that can be easily maintained.
I want to build a management software that is connected to a database.
It will have a main window and a sub-window for inputting data.
Here's my dilemma, i want to be able to easily update each of those sub-windows without recompiling
the entire program.
My initial thoughts where to build each sub-window and control code inside a DLL, that can be easly replaced in case
of an update.
But I would like some advice.
Re: Some coding practice advice
Posted: Fri Jun 03, 2011 3:46 pm
by jesperbrannmark
Webgadgets and server side scripting with either Purebasic or PHP and not so much emphasis on the client side?
Re: Some coding practice advice
Posted: Fri Jun 03, 2011 4:18 pm
by Foz
It sounds like you need a plug-in based system.
This app uses a dll plugin based system:
http://www.purebasic.fr/english/viewtop ... 27&t=35184
Alternatively, you can create lots of mini exe's, and have a database to launch those exe's. To keep the apps in your window, check out this thread and the linked threads:
http://www.purebasic.fr/english/viewtop ... 13&t=42802
Re: Some coding practice advice
Posted: Fri Jun 03, 2011 4:22 pm
by Num3
I do all my prototyping in PHP+Mysql, so the project already works that way.
But i do not want to deploy it in PHP, because the server is on the client headquarters, so all code will be available.
I want to build an executable, so no one can easily steal my 3 years of work.
Re: Some coding practice advice
Posted: Fri Jun 03, 2011 4:39 pm
by Num3
Great, this is more inline with what i want to do, gonna take a look!
Thanks.
Re: Some coding practice advice
Posted: Fri Jun 03, 2011 4:53 pm
by Foz
To take the system we use at work for an example, we went down the route of using DLLs, but have bundled two exe's, App.exe & Launcher.exe
The App.exe starts with a login window, and upon a successful log in, it then checks the db against it's file manifest for a list of updated files to then download. After downloading in the "updates" folder, the App then calls the Launcher, with the App's process id and an automatic login code (for later).
The Launcher then waits for the App's process id to exit, and then moves the downloaded files to the correct location, and then carries on calling the App again where it then automatically logs in using the special code passed between the App and the Launcher.
Golden Rule : ensure your updater works and is 100% solid before moving on to anything else. If the updater fails when you have 500 installs...
Re: Some coding practice advice
Posted: Sat Jun 04, 2011 10:45 am
by Inf0Byt3
Speaking of extendable programs, indeed, the approach of having the updatable parts in DLLs is a good one. In the program you mentioned earlier, I created a set of functions that are common for each plugin type. One set for importers, one set for exporters, etc. The program first loads the DLL and checks it's type and version. Then when it needs to import data for example, the main program sends pointers to callback functions that the plugin will call with the data it has. The main program will then add the data in memory. So basically the DLL calls functions in the main program each time it needs to pass some data. The data exchange itself is based on sending structure pointers between the DLL and the main program.
Another idea would be to code / use an existing scripting language (there was a pretty advanced one made in PB, iirc it was called DracScript), but this could prove to be a bit hard since you'll have to extend the script language to support gadgets, windows, etc.
Please let me know if you need any details, i'll be glad to help.
Golden Rule : ensure your updater works and is 100% solid before moving on to anything else. If the updater fails when you have 500 installs...
Very true

.
Re: Some coding practice advice
Posted: Sat Jun 04, 2011 4:38 pm
by Rook Zimbabwe
PLUS if you use updatable DLL idea you can amybe license the software for trials to other companies and make some extra bucks!
Sell it brotherman!!!
