#golang

bh@sysad.org

Free/Libre Open Source Software and not very free…

Open Swiss Knife

Lets look software development at languages like Python, JavaScript, Ruby, GoLang, etc.

Creators of these languages maintain their own repositories of open source software written at appropriate language. Each language have its own repository. The repository is very large and contains newest versions of software.

Repository owners (creators of an appropriate programming language) provides a powerful tools for easy search and install software from this repository.

The repository contains regular applications that you can run and so-called libraries. Programming library – is the set of functions, components and algorithms aimed to help developers to create their applications and possibly other libraries. For example, you’re writing a graphics editor and you want to introduce a blur effect. Instead of writing code of this effect from scratch, you may attach a library of functions for image processing which can do make a blur too.

Listed languages allow you to easily attach libraries from their repositories to your programs. Usually is enough to write names of wanted libraries into special file in your program directory. All the listed libraries will be installed automatically. And it’s not all – the smart installer will also install all libraries that required to work of the listed libraries. So you can easily prepare environment and begin to work on your new program, without manual searching and installation of required components.

The libraries required to work of a program (or other library) are called dependencies of this program. Dependencies may have their own dependencies and dependencies of dependencies. The full list of dependencies required by your program makes so-called dependency tree of your program.

The usage of ready code is very significant part of free/libre software development. We can say that it is the one of main aims of free software.


Ease of attaching and large amount of ready libraries for all occasions allow you to construct programs like lego buildings. You may not touch actual programming at all. Even with minimal skills you able to create very complex programs and calculation systems.


Software is free and open, but not enough. All was beauty and easy in use, but…

Book

Active usage of third-party code is making dependency tree very large. Such tree for easiest program may contain hundreds of libraries. Even you’ve attached couple of libraries – this couple may pull hundred of others.

In such conditions it is hard to just read all the names of libraries or names of their creators. But you trust them some possibly significant calculations, your or others personal data. Area of access of attached library may not be restricted only by data which is processed in your program. Depending on installation method, third-party libraries may have access to all files of current user and, sometimes, to all files at your computer.

Assume that you’ve decided to be careful with your dependency tree and now it is contains only few libraries. Now you able to read their names and know their authors. You able to make reasonable decision to trust them or not to trust. But it is the open source, it means that you do not need to believe – you can verify the code.

Here you will see the other thing. Automatic installers from language repositories are not aimed to do any verification. In usual case, after deep learning of documentation, you anyway can verify the code before installation. Usually you can ask installer to download the code without installation, after that verify it and install. But it will be not easy and sometimes you will need to disable internet connection at installation phase to avoid of possible downloading updated version of already downloaded and verified packages.

Technically you have ability to verify a source code before installation. But language developers do not foresee such usage of their installation tools. And verification process become extremely inconvenient.

*Here need to note that the process of library installation may run some scripts from this library. It depends from configuration of library package that set by the library developers. So if you want to verify code before run it, then you need to do it before running of the installation procedure.

The wide spread practice is to install dependencies without any control. Most of online courses and even programming courses in universities will teach you to an easy installation of third-party libraries, without any notes about risks related with privacy and security.


Use minimal count of dependencies in your programs, or you will be lost in your dependency tree like in a forest.


About repositories of free/libre open source software…

Distros

Almost any distribution of Linux operating system, Debian, Fedora, Gentoo, etc – is the repository of the open source software. All the software placed in such repository is the distribution of operating system (OS).

Of course the authors of distribution suggest you to install not all software, just some parts what you want to use. Nobody installs the full set of software provided by the OS distribution.

The repository provided by your operating system contains not only applications, but libraries too. The same libraries as in the repository of the programming language. But OS repository provides libraries for all languages. This repository is independent from language creators and is maintained by the creators of your OS distribution. You already decided to trust this repository when you chose your OS distribution, and you had ability to choose. You already have powerful set of tools to easy search and install applications and libraries.

So why do you need to use centralized and unique per programming language repositories from language creators?

The main reason is that these repositories contains much more libraries and applications in their latest versions. But why is it so?

Maintainers of these repositories verify only format of configuration files and directory structure. They do not verify the source code. In couple with centralization it allow to make easiest process of publishing of new libraries. Sometime programming language by it self provides functionality to publish your code in centralized repository of software on this language.

Developers of operating system distribution do their job much responsibly. They verify a source code to be compatible with other parts of OS, and modify it if need. Quality of source code and acceptability of its license are also verified. Sometimes maintainers remove parts of code with non-free license or with license that is incompatible with declared principles of OS distribution. And possibly the main point: the newest, non-verified in practice versions of software will never been included into repositories of OS distributions.


Reject of using of centralized repositories provided by creators of programming languages. Use repository of your operating system instead. It is true that sometimes you will need to install some dependencies manually, and write additional instructions for your users about this installation. But it is the price for the freedom of software and, certainly, for your freedom.


static html: https://coolbug.org/users/bw/open-source/open-source-en.html


#opensource #development #programming #privacy
#python #js #javascript #ruby #go #golang #linux #debian #fedora #gentoo
#freedom

bh@sysad.org

Свободное программное обеспечение (ПО) и не очень свободное…

Open Swiss Knife

Возьмём, например, разработку ПО на таких языках как Python, JavaScript, Ruby, GoLang и др.

Создатели этих языков содержат свой собственный реестр открытого ПО написанного на этих языках (у каждого языка свой собственный реестр). Реестр очень обширный и постоянно обновляется, там содержатся самые свежие версии ПО.

Помимо удобного поиска ПО, разработчики языка, они же владельцы реестра, предоставляют удобные инструменты для быстрой установки программ из реестра.

Реестр содержит не только обычные программы, которые можно запускать и использовать. В него также входят, так называемые, библиотеки — наборы функций, компонентов, алгоритмов, призванные помочь разработчикам в создании программ или других библиотек. Например, вы пишете графический редактор и вам хочется добавить функцию размывки изображения. Вместо того чтобы писать весь код самостоятельно, вы можете подключить библиотеку функций обработки изображений, которая умеет делать размывку.

Перечисленные языки программирования позволяют очень легко подключать библиотеки из их реестра. Обычно достаточно прописать названия библиотек в специальном файле в папке с вашей программой и все указанные вами библиотеки установятся автоматически. И не только они — умный автоматический установщик установит ещё и те библиотеки которые требуются для работы выбранных вами библиотек. Вы можете очень быстро начать работу над вашей новой программой не утруждая себя поиском и ручной установкой нужных вам компонентов.

Библиотеки, необходимые для работы программы (или другой библиотеки) называются зависимостями этой программы. Зависимости могут иметь свои собственные зависимости, а они в свою очередь зависимости зависимостей. Полная совокупность библиотек требуемая вашей программе образует, так называемое, дерево зависимостей вашей программы.

Использование готового кода очень важная часть свободного программного обеспечения. Можно сказать что открытые программы для того и открытые чтобы использоваться повторно во многих других программах.


Лёгкость подключения и многочисленность готовых библиотек на все случаи жизни позволяют составлять программы как из конструктора Lego, почти не касаясь программирования как такового. Даже с минимальными навыками, вы можете создавать достаточно сложные программы и вычислительные системы.


Открытое ПО, да не очень. Всё было красиво и удобно, но…

Book

Активное использование стороннего кода приводит к тому, что дерево зависимостей для самой простой программы может включать в себя сотни библиотек. Даже если вы подключили к своей программе всего пару-тройку зависимостей — эта пара-тройка может притянуть ещё сотню другую.

В таких условиях затруднительно даже просто прочитать все названия задействованных библиотек или имена их создателей. А ведь вы доверяете им какие-то вычисления, какие-то персональные данные, свои или чужие. Подключаемые библиотеки имеют доступ не только к тем данным с которыми непосредственно работает ваша программа, но и ко многим (или ко всем) файлам на вашем компьютере.

Предположим вы задумались над этим вопросом и поработали над своим деревом зависимостей, так что в него входит всего лишь несколько библиотек. Теперь вы можете прочитать их названия узнать их авторов, принять решение доверять авторам или нет. Но зачем доверять если можно проверить — посмотреть код.

Дело в том, что автоматические установщики библиотек от языка программирования не предусматривают возможность посмотреть код до его запуска. Во многих случаях вы всё-таки сможете это сделать, внимательно изучив документацию, и запустив процесс установки по частям — сначала скачать, потом установить скачанное. Но даже здесь вам придётся на определённом этапе отключить интернет, чтобы установщик не скачал из сети какое-нибудь обновление для ранее скачанной и проверенной библиотеки.

То есть техническая возможность проверить исходный код у вас есть, но разработчики языка просто не предусматривают, что их пользователи захотят что-то проверять. И вам будет крайне неудобно это делать.

*Тут надо отметить, что процедура установки библиотеки предусматривает, в зависимости от настроек которые задал её автор, запуск какого-то кода из устанавливаемой библиотеки. То есть решение доверять или нет необходимо принимать до запуска процедуры установки.

На практике же широко распространена абсолютно неконтролируемая установка зависимостей. Этому учат на разных онлайн курсах и даже в университетах безо всяких оговорок и предупреждений о рисках в плане приватности и безопасности.


Используйте минимальное количество зависимостей, иначе заблудитесь в дереве зависимостей как в лесу.


О реестрах свободного ПО…

Distros

Дело в том, что практически каждый дистрибутив операционной системы Linux, будь то Debian, Fedora или Gentoo — это по сути реестр свободного программного обеспечения. Вся совокупность программ представленных в реестре и есть операционная система (ОС).

Конечно, вам предлагается установить не полный набор ПО, а только те компоненты которые вам необходимы. Никто не устанавливает полный набор программ операционной системы.

В реестре программ вашей ОС представлены и библиотеки. Точно такие же как и в реестре от языка программирования, только в реестре ОС представлены библиотеки сразу ото всех языков программирования. Этот реестр независим от создателей языка и управляется создателями вашей операционной системы. При установке ОС вы уже приняли решение, что доверяете программам из этого реестра. У вас уже есть удобный набор инструментов для быстрого поиска и установки программ и библиотек.

Зачем же вам дались эти централизованные, единственные в пределах языка, реестры от создателей языков?

Дело в том, что в эти реестры занесено намного больше библиотек, чем в реестры операционных систем, и библиотеки там самые новые. Но почему так?

Операторы реестров от языков программирования проверяют только формальную структуру папок и конфигурационных файлов библиотек и программ. Исходный код никто не проверяет. В сочетании с централизацией реестров это позволяет максимально упростить процедуру публикации новых библиотек, иногда до такой степени, что сам язык программирования предоставляет функции публикации.

Разработчики де дистрибутивов операционных систем более ответственно подходят к своей работе. Они проверяют исходный код на совместимость с остальными компонентами системы, и модифицируют его, если это требуется. Также проверяется и качество кода, и приемлемость его лицензии. Иногда удаляются части кода с несвободной лицензией или с лицензией несовместимой с принципами разработчиков дистрибутива. И, наверное, главное: в реестр операционной системы никогда не добавляются самые новые, не проверенные на практике, версии программ и библиотек.


Откажитесь от централизованных реестров ПО предоставляемых создателями языков программирования. Используйте реестр вашей операционной системы. Да, иногда вам придётся устанавливать недостающие библиотеки вручную и описывать процесс их установки в инструкциях для ваших пользователей. Но ведь это ради сохранения свободы программного обеспечения, и, как следствие, вашей свободы.


static html: https://coolbug.org/users/bw/open-source/open-source-ru.html


#opensource #development #программирование #privacy
#python #js #javascript #ruby #go #golang #linux #debian #fedora #gentoo
#freedom #свобода

paulkater@diasp.org

Maybe I see it all wrong. I've been trying to convert a simple #python script to #golang / #go today.

I wrote the python script a while ago, in about 10 minutes.
After 4 hours, the Go program still doesn't do what I want it to do. Biggest hurdle: writing an int to a file.

Why on earth would you need to import ioutil AND os to get something simple done as write an integer to a file, and jump through hoops to get it almost done?

All I need is to read the int, increment it, check it against a value and write the incremented value back. Does someone here have some insight on how to do that the right way?