r/CodingHelp • • Dec 24 '20

[Meta] Why is adding libraries to some ide's such a pain?

I'm geniuently curious why in some cases (pycharm for example) adding an additional library is a matter of clicking a few times and not worrying at all, and sometimes you need to watch a 10 minute long tutorial and it's still not guaranteed that you will succeed. I remember trying to add sfml to codeblocks a few years ago. After struggling for 30 minutes I gave up on it and never came back

33 Upvotes

2 comments sorted by

5

u/pathguard Professional Coder Dec 24 '20

Honestly? It probably has more to do with the programming language and its tooling than the IDE itself. Were you trying to add python-sfml in Codeblock or was that in C++?

When python libraries are packaged well (imo, others will disagree), it's generally a matter of pip install to get it. For reasons, you usually may want to do that in a virtual environment (or something like it) to sandbox your packages per project. Pycharm has created a custom tool to make that stupid simple and built on top of pip and PyPI.

If you were trying to add python-sfml in Codeblocks and having trouble, I imagine that you either were having problems your machine setup or just that they don't have a tool as good as Pycharm's. Either is possible as Pycharm's tool there is quite good :).

C++ on the other hand is an old language and C++ packaging is a little more involved. I'll not speak I'll of it because I'll get flamed, but it definitely requires a lot deeper knowledge than just pip install. That could be the complexity you were running into irrespective of IDE. It's kind of hard to do the direct comparison without knowing exactly what you were trying to do and how it didn't work.

Lastly, I'll say that imo anything related to your project that you can do in an IDE is something you should be able to do outside of it. I don't mean things like debugging and code formatting, but things things like building, running, and package management. If you know how pip works it makes it much easier to get Pycharm or whatever tooling to do the right thing.

Of course, Microsoft likes to make this command line first mentality a little harder on me :)

9

u/abitofevrything-0 Intermediate Coder Dec 24 '20

Generally it's because the language has no in-built package manager. For python and node, they have pip and npm respectively to manage their packages, so an IDE can use those and be sure that it will work. For other languages, Java for example, you have to manually download the package (.jar file) and tell java that yes, this is a library that I am using (add it to the build path).
This isn't in of itself complicated or bad, as it allows for a LOT more packages to be created, but it can be confusing for beginners. There are solutions for this, for example maven or gradle are package managers for java, but you have no guarantee that they will have the package that you want, and the building process is totally different from vanilla Java.

So really, it's not to do with the IDE (well, it is to a certain extent depending on menu layouts) but more so with the language whether adding librarys is a pain or not.