4 ms·
> But it will be your code And your colleagues will have great difficulty figuring out how it works because there is no documentation and no community support.
by amelius 4y ago
> But it will be your code
And your colleagues will have great difficulty figuring out how it works because there is no documentation and no community support.
- fileeditview 4y agoWhich is true for most libraries pulled from Github also.. but additionally you cannot just ask your colleague.
- KptMarchewa 4y agoBut most people don't pull 100s of random libraries, just the few most popular and needed. The strawman where people download tens of libraries just not to write oneliners mostly does not exist, besides javascript land.
- PeterisP 4y agoHaving to ask your colleague is an extra cost - for common tasks (like the example of parsing of command line arguments used in the parent comment) you should be using the exact same code as your colleagues unless there is a good reason to make an exception (which there rarely is), so you should be able to read and maintain others' code just as yours because it's written in the same way as you would, making the same style of calls to the exact same functions. And furthermore, the third party libraries (at least for Python) are so standard that a new hire would have used the exact same library if they ever had to do the same task - for most things there's going to be just a few reasonable ways (and often just a single idiomatic one) to do that thing in the language, which sometimes used a built-in library and sometimes uses a popular third-party library. If your company has a dozen tools which need the same functionality, "rolling your own" for each codebase (or worse, copy/pasting it without being able to update them from a single place) is obviously not a good solution - the choice is between making and using an internally maintained library, or using an open source one.
- avidphantasm 4y agoThen you flog mercilessly people in your organization who write code like this. When I was coming up, the greybeards were bastards, but they taught me the right way to go about things.
- randomdata 4y agoCode is only hard to figure out if you don't understand the business goals. Third-party libraries/frameworks will almost never explain the business to you. However, there is a practice known as testing that is supposed to document the business goals so that your colleagues aren't left in the dark. Hopefully you haven't skimped there, regardless of where the functional pieces came from.
- king_magic 4y ago> Code is only hard to figure out if you don't understand the business goals. Ah right, so when an architecture astronaut picks up the GoF Design Patterns book and creates a rube goldberg architecture with an interface for every. single. class., it's not going to be understandable because folks didn't understand the business goals.
- randomdata 4y agoAgreed. It's not terribly hard to think like the person who wrote it, even if they went rube-goldbergesq, if you understand where they were coming from. If the business details have been lost, it becomes harder.
- fuckstick 4y agoI think who you’re replying to is being sarcastic (a clue is using a pejorative - “architecture astronaut”). FWIW, I agree with their sentiment and disagree with yours.
- randomdata 4y agoYes, exactly. Even architecture astronauts are well intentioned, and if you understand the conditions under which they worked then it is quite easy to follow what they've done. It only becomes difficult when that context is lost. So hopefully they've encoded that context in tests. Worst case, if you never learned how to read code, you can throw the implementation away and the intention will remain validatable. But if you don't have the business end of the code documented... Good luck!
- Test0129 4y agoI've rarely had a hard time understanding code that was written for a purpose rather than importing a library. Except in rare cases (like dates, big APIs) a library is often unnecessary cruft. Should I go pull a fat logger when all I need to do is send data over TCP to rsyslog? As long as I consider all of my use cases, and properly defend the cases I wont use I can write faster, often times more understandable, code. An example of a great, but often unnecessary library, is Pandas. I've seen Pandas imported for trivial CSV work, simple data manipulation, etc just because it was "familiar" rather than the right tool. Pandas is so, so, so heavy that if you're not using it completely for data science oriented work you are probably wasting your time...people seem to not understand this distinction. I've had people cut juniors/data scientists/etc loose on a "be-all-end-all" framework and ended up with the worst code I've ever seen. Edges so sharp just looking at them will cut you. I've seen code that imports trivial things like line counting! I've even been on the response team for a security incident involving several internal packages that imported the wrong thing from the package managers! I've had to re-write important library functions for a package that was imported and deprecated, and the author just went to do something else. Libraries are great, but they are not a fire-and-forget tool. When you use them, you must use them sparingly, correctly, and securely. Importantly, you need to pray a library will be maintained over the life of your software. "Documentation and community support" is worth absolutely, positively, nothing if the usage of the library enabled the writing of poor code. Hire better developers, and create strong coding standards at your company. Let software engineers do what they do best and choose the right place to include a library after evaluating all options. Experience level matters. Late seniors and staff+ understand the difference. New seniors, TLs, and of course braindead management love to bring in the universe on every project.
- halostatue 4y agoYour job as a software engineer is to solve business problems set before you. If your job is to send data over TCP to rsyslog, then you’re doing your job. If sending data over TCP to rsyslog isn’t your primary task, then doing that is a distraction, at best. Maybe the rsyslog protocol is simple enough that writing your own function is sufficient. Maybe it isn’t. I’ve been doing this for 28 years professionally and will often choose a library (and I _do_ typically look at the code and compare code diffs across versions on upgrade) over writing my own, because: 1. My job is not to write a task runner—so I use Sidekiq or Celery or Oban. 2. I’m not confounded by the illusion of NIH being lesser. I will always write my own code if it’s core to what I’m doing. If it’s a sideshow, I will absolutely outsource it to a library or a compiler or whatever. Anything else in the context of the job you’re hired to do is irresponsible.