Software architecture for multi-platform application development

A variety of applications, such as Firefox, Fring, Skype, work on different platforms. How do they manage their code? Do they have different interfaces for different platforms? As with Firefox, it should use Cocoa for Mac, WinForms, or the Windows equivalent, the QT equivalent in Linux. How is it possible for the same source code to display the diff UI just by compiling diff for the purpose?

They guarantee that a bug fix in one version (for example, a security problem) is fixed in all releases, which means that the code is not duplicated anywhere. So how is the underlying architecture developed?

+4
source share
2 answers

In my experience, that helped me with cross-platform issues:

  • Library code in one language, which is portable to any platforms that you need to develop, in my case C / C ++.
  • Continuous integration with unit tests so you can catch any changes to the interrupt code as soon as possible.
  • Very modular libraries that try to have as few dependencies as possible.
  • Do not be afraid to have specific platform implementations of any concept that you need for speed / functions / independently. There are many ways to hide the fact that you are using platform specific code in your main code.
  • Using design patterns can help achieve your desired results. There are also other executives, such as DRY and SOLID, who also help. This is a better software design than cross-platform.

Some design problems you may encounter depend on what you are trying to achieve. If the UI is not a bargain, then using lib such as QT can be a way. The same goes for any aspect of your application. Using open or paid libraries helps reduce development time, which can be good.

If your application is designed to shine, you really have to code this part yourself.

I can’t talk much about choosing a user interface, since most of the platforms I deal with are so different that you need to redesign the user interface level each time. The fact that libraries and core engine layers are portable between platforms helps make this easier.

+3
source

The main solution is to concentrate the differences in a small part of the application. For example, FireFox has an XulRunner behind the scenes.

You can also use existing frameworks for this. If you use Qt for Linux, you won’t go to WinForms for Windows. You will still use Qt, and this also works on Mac.

As a result, things like security errors are either at the platform level or at the general level. In the first case, you need to fix them only on the affected platform. In the second case, when you correct a mistake, it is fixed everywhere.

+1
source

Source: https://habr.com/ru/post/1285993/


All Articles