Best practices for building an app that will update frequently - C ++

I am developing a portable C ++ application and have been looking for some guidance on this. This application will have frequent updates and I need to build it in such a way that parts of the program can be easily updated.

  • Is it best for a program that is updated frequently to create program parts in libraries? If parts of the program are in separate libraries, users can simply replace the library when something changes.
  • If the answer to 1 is yes, what type of library should I use? In LINUX, I know I can create a "shared library", but I'm not sure how portable this window is. Which library should I use? I am also aware of DLL errors on Windows.

Any help would be great!

0


source to share


5 answers


  • Yes, using libraries is good, but the idea of ​​"just" replacing a library with a new one may be unrealistic because API libraries tend to change and applications often need to be updated to take advantage of or even be compatible with different versions of the library. With a good amount of integration testing , you should be able to "maintain" a number of different versions of the library. Or, if you manage the library code yourself, you can ensure that changes to the library code never break the application.

  • Windows DLLs have a direct equivalent to shared libraries (sic) on Linux, and if you compile both in a shared environment (either using cross compilation or using MingW on Windows) then the linker will just do it the same way. Assuming, of course, that all the rest of your code is cross-platform and properly configured for the target platform.

    IMO DLL hell was really more of a challenge in the old days when applications would install their DLLs in a shared directory like C: \ WINDOWS \ SYSTEM which people don't actually do anymore just because they create a DLL addon ... You can put your shared libraries in a more suitable place where they won't interfere with other unfamiliar applications, or, at the simplest, just have them in the same directory as the executable they want.



+3


source


I'm not entirely sure if separating the executable parts of your program makes upgrades easier in any way. It may be possible in some rare cases to make the update installer smaller, but the effort will be substantial and certainly not worth it when you go wrong. Replace all executable code as one in most cases.



On the other hand, you want to be very careful about tinkering with anything your users might have changed. Draw a bright line between the part of the application that is just code and the part that is user data. Handle user data with care.

+3


source


If this is an application, my first choice would be to submit a statically linked single executable. I had the opportunity to work with a product that was shipped to 5 platforms (Win2K, WinXp, Linux, Solaris, Tru64-Unix) and thought maintaining shared libraries or DLLs with a large database was a hell of a lot of work. Let's assume it's a non-trivial application that involves using a third party GUI, threads, etc. Using C ++, there is no real way to do this on all platforms. This means that you still have to support different codebases for different platforms. Then there are some strange behaviors (errors) of third party libraries on different platforms. All this will create a load if the app is submitted using different versions of the library,that is, different versions must be tied to different platforms. I've seen people ship libraries to all platforms when the fix is ​​only for a specific platform to avoid version confusion. But it is not that easy, the client often has a different approach to how he / she wants to update / schedule, which also needs to be considered.

Of course, if the binary you are building is huge, then DLLs / shared-libraries can be considered. Even if this is the case, I would suggest creating your application as layers like: - Application -> GUI -> Platform -> Base -> Fundamental

So, some libraries can have common code for all platforms. Only specific libraries like "Platform" can be updated for specific actions. It will make your life easier.

IMHO the DLL / shared-library option is viable when you are building a product that acts like a complete solution, not just an application. In this case, different subsystems share logic at the same time within your product framework, the logic of which can then be shared in memory using DLLs / shared libraries.

NTN,

+2


source


Once you try to get to grips with both Windows and a UNIX system like Linux, life gets complicated.

What are the service requirements that you must satisfy? Can you control the updating of client systems? How many systems will you need to support? What is your need for backward compatibility.

0


source


To answer your question, why are you making the application native if portable is one of the key goals?

You might consider switching to a virtual platform like Java or .Net / Mono. You can still write C ++ libraries (shared libraries on linux, DLLs on windows) for anything that would be better than native code, but the bulk of your application will be truly portable.

0


source







All Articles