I have Ubuntu 13.04 and I wanted to ask that why the setup files of software in Ubuntu have so many dependencies while Windows and Mac doesn't.
I mean when I download a .deb file of software and take it to my offline machine then the Software center says that package x or y is missing.
You're looking at the way of shared libraries work - in this case dependencies. A .deb
file is not meant to be portable and installable only by itself.
Rather than including all stuff that a single application needs, the components are separated into individual packages. If another application can reuse them, then it can simply depend on it rather than having multiple copies on your system. It is also a lot better tested software and easier to patch if something is broken in a library. Below I will explain these advantages a bit more.
Let's say the JPEG library
libjpeg8
contains a serious bug and suppose you are running 12 applications that use this to display JPEG images. Then if a bugfix is rolled out, none of the application have to be patched, but just thelibjpeg8
package (which is really small). This saves a lot of work for both the application developers as well as the individual end users installing the updates. This enhances security.It will also help to reduce the size of the application package. Let's say you want to install an image viewer and you already have most of the image format libraries installed, then it will significantly reduce the size of the package. Your package management will see that only the few you're missing are required to be installed before the application is working properly. This reduces disk space.
It's also possible to have optional functionality. Suppose you are developing an application and you want to include a feature, but not everyone needs it. Then you can simply add a "recommended" dependency so that the feature will only work if that is installed, but the users not interested don't have to install it. This is especially useful if the dependency is really big. This is how most metapackages work, e.g.
texlive-full
is a full TexLive installation (1.5GB!) with all recommended fonts, but you can also installtexlive-base
to have just basic functionality (~100MB). This reduces disk space (if chosen to).Then there's the principle of single responsibility in software development. The package has a really clear defined set of functionality it will provide and will do it well. Software will be tested a lot better and more efficient rather than pieces of code included in a large application that contains code to be checked all over. Moreover, a developer doesn't always need to reinvent the wheel. A JPEG library already exist? Then why not reuse it? Reusability enhances development speed and overall software quality.
Another reason is memory footprint. If a library is already loaded into memory by an application and another wants to use it as well, it doesn't have to be loaded again into memory. So, your image viewer and your web browser will just share the libjpeg8 library already loaded. This reduces loading time and memory.
Windows application are usually very much portable. Most libraries are statically built into the installers and this is why a typical Windows installation is so big. Also patches have to be rolled out for application individually, so that's one reason for why you see so many individual updaters e.g. "Adobe Updater", "HP updater", "Java updater", etc. Clearly, this is much less efficient.
No comments:
Post a Comment