News for hackers. Stuff that matters.
Re:Nobody's just reading your code by curtis on Tuesday February 27, 2018 @01:28AM (#16471480)
> ... willingness to fearlessly dig into someone else's code.

I've done this many times. The problem is that it takes a lot of time, and there's no way you can dig through more than a fraction of a large codebase. You gotta pick your battles.

Re:Nobody's just reading your code by nathanaldensr on Tuesday February 27, 2018 @02:02AM (#16471595)
Pragmatism wins the day, for sure. I'll happily read someone else's code (e.g., an open-source GitHub repository I rely on) if it's necessary to troubleshoot issues or implement a feature. There needs to be a reason (i.e., motivation) to read code.
Re:Nobody's just reading your code by deckard1 on Tuesday February 27, 2018 @04:10AM (#16472099)
On github and the node/JS ecosystem, the way this will play out:

  1. Spend hours digging through layers and layers of crufty JS.   
  2. Find the issue (and the package responsible for the issue).   
  3. Find out there is a Github Issue for the issue.   
  4. Find out there is a pull request for the issue.   
  5. Find out the pull request is sitting in position #35 of #128 pull requests going back to 2015.   
  6. Go binge drinking.
Re:Nobody's just reading your code by rudasn on Tuesday February 27, 2018 @04:14AM (#16472116)
7. (next morning) Fork the project, apply your PR and any others you like, and use your fork in your codebase.

8. (optional) Thank the creators and maintainers for the time and effort they put into it.

Re:Nobody's just reading your code by yoz-y on Tuesday February 27, 2018 @04:28AM (#16472160)
This is not always an optimal solution. Because by doing this you have essentially became a maintainer of a dependency you initially wanted to 'just' use.
Re:Nobody's just reading your code by RobertRoberts on Tuesday February 27, 2018 @04:37AM (#16472192)
This is sadly why I keep my dependencies to a minimum.

After coding for almost 20 years now, full time, I have never regretted not using a dependency. But I have regretted using one multiple times.

(the regret is like a walk of shame during the "separation and cleanup" phase at the end, which makes me question the "got work done faster" phase at the beginning....)

Re:Nobody's just reading your code by bryanrasmussen on Tuesday February 27, 2018 @04:45AM (#16472218)
In 20 years you've never started work on something and after a bit said damn it I think I'll use that library that other guy developed?

If you've ever switched out dependency X for dependency Y I suppose you regretted not using Y to begin with.

If you've ever stopped working on your own solution to a problem and instead used a solution provided in a library didn't you regret not just using the library from the beginning?

Re:Nobody's just reading your code by RobertRoberts on Tuesday February 27, 2018 @07:21AM (#16472788)
>In 20 years you've never started work on something and after a bit said damn it I think I'll use that library that other guy developed?

nope, I am just saying what I said, I never regretted not using one, and have regretted investing in a few that later caused more headaches than they were worth.

When we switched from inhouse code to a dependency, we never regretted doing it on our own to start with because there was so much insight gained from this and many other side benefits (like direct control, intuitive understanding of how our code worked, etc...).

But when you have a dependency you add that you later have to work around, you simply can't fix in the same way can your own code, and you just hate the mess in a totally different way.

When it's your own code, you can fix anything. And replace it a piece at a time if need be. With a dependency, there's usually catches, hacks or work arounds, or conflicts built up over years that finally have come to a head. And it sucks to fix and in many cases if I had waited even a little while, or did more research at the time, I would have picked a different dependency or none at all.

There are a lot of dependencies we use, I don't think you can run a business properly these days without them. They just are not a part of our core systems anymore. We use them for tertiary systems and addons, things that a replaceable. Then our core systems can't be hijacked by stuff like the latest NPM debacle.

Re:Nobody's just reading your code by Ace17 on Tuesday February 27, 2018 @10:29AM (#16474176)
Yeah, this also matches my (+10 year) experience as a professionnal dev ... with one exception, though: the "maintainance-can-of-worm" packages. These are packages which, by design, can never be considered as finished, and periodically need to be updated to stay relevant in your application.

There are three reasons for this:

1) Those packages implement an ever-growing pile of tricks/heuristics to convincingly solve problems from the domain. They include: physics engines, SMT solvers, compilers/jitters/optimizers, computational geometry packages, video encoders ...

2) Those packages implement an unification layer over an ever-growing/evolving set of underlying APIs/protocols/formats. They include: SDL, ncurses, curl, ImageMagick ...

(these are not to be confused with "bug-factories" packages, which might not solve a complex problem, but still require constant updating to fix the current bugs, and benefit from the new ones).

Re:Nobody's just reading your code by wolfgke on Tuesday February 27, 2018 @01:47PM (#16476542)
> There are three reasons for this:

> 1) [...]

> 2) [...]

Where is the third reason?

Re:Nobody's just reading your code by LasersGoPew on Tuesday February 27, 2018 @09:56PM (#16480318)
Classic off-by-one error.
Re:Nobody's just reading your code by babuskov on Tuesday February 27, 2018 @01:49PM (#16476556)
> In 20 years you've never started work on something and after a bit said damn it I think I'll use that library that other guy developed?

I can't speak for him and I don't know about you, but while deciding whether I would start to work on something, I'm actually deciding if I'm capable of doing it and looking at all the pieces needed to do it. I'm not starting work until I know I have all the pieces in place. Sometimes I may doubt that some piece is missing or might be hard to do, so I make a very small prototype of that system only (this usually takes a couple of hours tops). Once I make a decision and start working, I never go back.

Just like him, I have never regretted doing it myself, but have regretted using another developer's library many times.

Re:Nobody's just reading your code by sgtmas2006 on Tuesday February 27, 2018 @06:35AM (#16472586)
Sometimes yes, sometimes no. I've abandoned writing something to use a dependency in place that got the job done, but could have a number of improvements.
Re:Nobody's just reading your code by boogiewoogie on Tuesday February 27, 2018 @06:56PM (#16479345)
I enjoy Clojure dependencies. They are usually more succinct than other languages.
Re:Nobody's just reading your code by itronitron on Tuesday February 27, 2018 @07:31AM (#16472828)
one of the reasons that I switched from using node.js to ringo.js
Re:Nobody's just reading your code by choonway on Tuesday February 27, 2018 @06:58AM (#16472692)
It's ASIC vs FPGAs...
Re:Nobody's just reading your code by gt_ on Tuesday February 27, 2018 @07:55AM (#16472940)
I have only been coding for 1.5 years and this kind of comment is validating what I worry is a very bad habit. I hate using dependencies unless they have reached a certain level of legend in the community.
Re:Nobody's just reading your code by RobertRoberts on Tuesday February 27, 2018 @05:34PM (#16478680)
>...unless they have reached a certain level of legend

That is a similar tactic I use now for anything core. I know I commented that we don't have any dependencies in our core systems, but as an afterthought, this isn't entirely accurate. We do, but as you said they are "legendary", and don't change a whole lot anymore.

I think you are on the right track. :)

Edit: Keep business practicality in mind, if using a 3rd party library means you feed your family or are productive for the business, you need to weigh these considerations carefully.

It's likely you need to use a dependency to get your work done, and then later when you are more profitable, you can clean it out if need be. Maybe that is how I should have worded my first comment in retrospect.

Re:Nobody's just reading your code by cottsak on Friday March 02, 2018 @12:25AM (#16499286)
Some of this conversation isn't as exclusive and the tone it has.

Many of these dependancies are open source. Nothing prevents you from copy/pasting the code and then maintaining it yourself. Then you alleviate the "hard to change" problem and you can vet it thoroughly inside your own team.

Re:Nobody's just reading your code by FLUX-YOU on Tuesday February 27, 2018 @09:10AM (#16473444)
This is a normal feeling. But one weakness of this approach for javascript is that it's easier to become popular because you have a much larger base of developers.
Re:Nobody's just reading your code by gt_ on Tuesday February 27, 2018 @10:36AM (#16474244)
That makes sense. I use Python the for most part. I feel like I have seen this happen with old libraries where they used to be very popular and maintained then became abandoned a few years ago.
Re:Nobody's just reading your code by funkymike on Tuesday February 27, 2018 @11:05AM (#16474664)
That can be okay. Depending on the nature of the library it might legitimately be "done."

Personally, I would rather see this than a bug fix being committed every week. That makes me question how many more bugs there are and how much I'm going to have to babysit updating the dependency.

Re:Nobody's just reading your code by gt_ on Tuesday February 27, 2018 @04:56PM (#16478358)
That's a great point. Hmmm... I wasn't considering that. Oops. I'm glad I mentioned it! Thanks!
Re:Nobody's just reading your code by PeterisP on Tuesday February 27, 2018 @05:45AM (#16472410)
Well, that's kind of the point - (almost) everybody wants to just use the dependencies, but someone must maintain them for the community to work.
Re:Nobody's just reading your code by eloisant on Tuesday February 27, 2018 @05:01AM (#16472279)
That's a last resort, but it's important to remember that the option is on the table.

Then consider ditching this dependency (either by switching to a different one or with your own code) if the maintainers are not active enough.

Re:Nobody's just reading your code by seattle_spring on Tuesday February 27, 2018 @11:39AM (#16475088)
7. Find out that the sole maintainer of the repo is a "well-respected influencer" in the JS community, and actually has a blog post stating that GitHub should remove the "issues" feature and instead only allow contributions via Pull Requests.
Re:Nobody's just reading your code by jacinabox on Wednesday February 28, 2018 @12:58AM (#16481012)
And then there's the problem that you can't hardly convince the maintainer that something is an issue unless they have the issue on their OS and configuration.
Re:Nobody's just reading your code by lloyd-christmas on Tuesday February 27, 2018 @01:33PM (#16476409)
In my last 4 years of working in node, I've had this issue once. I think you people need to pick better dependencies.
Re:Nobody's just reading your code by deckard1 on Tuesday February 27, 2018 @04:24PM (#16478077)
webpack. My dependency was webpack.

It was a dependency of webpack that was broken (you can pick your bride, but you can't pick your bride's family). And the package owner, in a Github Issue said "not my problem, this package should never be used with webpack and should only be used with Browserify." Looking at the date, that Issue discussion occurred in 2015. Which makes sense. But a WONTFIX on a package that obviously is broken (I looked at the code), and is still an issue in 2018 is clearly a problem. The node world is a circular firing squad where no one wants to take responsibility for fixing their shit because each person thinks they are doing the right thing. When, thanks to the mess of npm, no one really knows who the "user" of their package is and you can't just dictate that so-and-so shouldn't be using your package that way. Because someone will use your package that way.

WONTFIX, issues just suddenly "closed" without reason (why, dammit??), or pull request queues 100+ long and obviously unmaintained are way too common for me. I've lost track of the number of times this has occurred.

Re:Nobody's just reading your code by andrea_sdl on Tuesday February 27, 2018 @02:32AM (#16471693)
This is the only reason (at least for now) that makes me dig into a library code. And I always got some benefit from it.

I think we often treat libraries as voodoo blackboxes, but they're more often thatn not created by normal people with great skills. Sometimes it's a great way to learn a way to code, or even better, to understand the behaviour of a library.

I found myself doing it more often when the IDE itself downloaded and linked the sources. (Lazy, I know).

Re:Nobody's just reading your code by TeMPOraL on Tuesday February 27, 2018 @04:41AM (#16472203)
> I found myself doing it more often when the IDE itself downloaded and linked the sources. (Lazy, I know).

Same here. It's about trivial inconveniences. I sometimes can be bothered to download and read through the codebase of a dependency, but most of the times I end up in third-party code happen when it's just a single jump-to-definition keypress away - the same keypress (M-.) which I use all the time for my code. That seamless browsing really blurs the difference.

Re:Nobody's just reading your code by WingH on Tuesday February 27, 2018 @10:19AM (#16474064)
Absolutely, but I find in many cases, people are just too lazy to want to dig into another piece of code, and just give up prematurely.
Re:Nobody's just reading your code by jandrese on Tuesday February 27, 2018 @04:45PM (#16478260)
Or they look at the tradeoff of:

1. I could dive into the code, find the bug, submit the report and hope the developer accepts the patch. Hopefully this bug isn't there because it is required by some other feature the developer actually cares about.

2. That module wasn't doing that much, I can just redo it by hand and dump the dependency.

3. I could hunt around for a different module that does basically the same thing and use it instead. This might be necessary if the module is doing a lot of work, like an ASN.1 parser or something.

Re:Nobody's just reading your code by radicalbyte on Tuesday February 27, 2018 @02:02AM (#16471596)
This. I'm not afraid of it, but it can take a lot of time. It's also extremely hard to estimate so gets avoided in scrum.
Re:Nobody's just reading your code by sanxiyn on Tuesday February 27, 2018 @03:36AM (#16471949)
The thing is, "digging into someone else's code" is a skill, so you can get better at it, and it takes less time as you get better. It makes sense to invest some time at this skill.
Re:Nobody's just reading your code by marcosdumay on Tuesday February 27, 2018 @07:15AM (#16472760)
> It's also extremely hard to estimate so gets avoided in scrum.

So, one more time Scrum seems to be unable to support actual development needs.

Re:Nobody's just reading your code by _asummers on Tuesday February 27, 2018 @08:18AM (#16473073)
The inability to justify time spent in Scrum doesn't make the time not get spent, it just gets hidden, defeating the whole point. I abhor Scrum, but I would also argue that in this case the development task weight just gets inflated for "unknowns" on the task.Instead of a 5 maybe it's an 8, or whatever.
Re:Nobody's just reading your code by Bartweiss on Tuesday February 27, 2018 @12:03PM (#16475399)
I sometimes wonder what fully-honest Scrum would look like.

I mean... 3 points: dealing with ticketing system. 5 points: looking into bugs/issues which will become new tickets. 5 points: taking questions and talking process on other people's tickets.

The list goes on. I like agile, and I don't hate Scrum, but it's unpleasantly easy to end up running a planning/scheduling process which is completely distinct from one's actual schedule.

Re:Nobody's just reading your code by marcosdumay on Tuesday February 27, 2018 @05:37PM (#16478704)
Tickets based development can not work very well.

We need tickets (hell, I have to write them for myself on personal projects, otherwise I get locked), but we need something else too. I also wonder how we can formalize that something else - time-boxing it is harmful, full attention to it is harmful, having to explain it too much is harmful.

Re:Nobody's just reading your code by Bartweiss on Wednesday February 28, 2018 @11:53AM (#16484350)
I have a strong suspicion that the reason points and time-boxing are so bad is that they're trying to weld two distinct processes together.

Tickets are great; they bound tasks, provide a clearinghouse for all relevant information on an issue, and help monitor and prioritize needed work.

The instinct to turn the "what work exists at what priority?" tool into a "let's organize our work" tool is totally understandable given all that, but I think it's a serious mistake. Tickets define tasks, but their times are highly variable (timeboxing is ugly, storypointed "investigation" tickets are uglier) and they exclude a whole bunch of non-ticket work: communication, bureaucracy, unstructured inspection, and so on.

If you make tickets the basic unit of scheduling, you're suddenly building "buffer" tickets and padding ticket durations to account for "something always comes up". It's Goodhart's law in action; your metric - storypoints - becomes a target and stops being an accurate metric.

Re:Nobody's just reading your code by marcosdumay on Tuesday February 27, 2018 @10:32AM (#16474208)
The inability to justify time makes people avoid doing the work. Some people will strongly avoid it, other people will just weakly avoid it, but nobody will be more inclined to do it than if the time was taken into account.

If your methodology makes people avoid doing important work, it's a bad methodology.

Re:Nobody's just reading your code by timrichard on Tuesday February 27, 2018 @08:18AM (#16473071)
My experience too. Velocity trumps everything else. IMHO, Scrum is like Communism. Okay in theory, but never implemented properly. And it's always the people at the bottom who suffer.
Re:Nobody's just reading your code by mikelward on Tuesday February 27, 2018 @10:49AM (#16474428)
Or it could be handled as a Spike.

It's not perfect, but it captures the idea of uncertainty by having a time-boxed investigation, the end result of which is an estimate of how long it will take to fix.

https://www.leadingagile.com/2014/04/dont-estimate-spikes/ https://www.scrumalliance.org/community/articles/2013/march/...

Re:Nobody's just reading your code by dalbasal on Tuesday February 27, 2018 @07:38AM (#16472854)
Picking your battles may in fact be (one of) the things that'd set one apart. You can get bogged down in the weeds of dependencies. You can also end up with kludgy half-solutions to persistent problems by treating them like black boxes.

But, before you you can pick battles you need to treat such things as possibilities, something you've done before an feel comfortable doing.

Re:Nobody's just reading your code by dingo_bat on Tuesday February 27, 2018 @03:45AM (#16471993)
Also, when you're using 3rd party proprietary code, you don't get the option of fixing it. So delving into it can feel silly.
Re:Nobody's just reading your code by hinkley on Tuesday February 27, 2018 @09:43AM (#16473684)
But there are often times when you can trick it into doing what it’s supposed to do.

And a really targeted bug report can often get a bug fixed pretty quickly. Several times I’ve been working at a place where the goddamned IP lawyers were so power mad that I could not file a patch for a bug even though I knew how to fix it, but filing a bug with an exact line number and description of what’s wrong with it can get it fixed anyway.

Filing a razor sharp bug report seems to be a rare skill, but if you can learn it your quality of life is better.

Re:Nobody's just reading your code by convolvatron on Wednesday February 28, 2018 @01:56AM (#16481232)
10 points for tricking it. often times its not completely broken, but may have been written with different assumptions, be failing on an avoidable edge case, or have an issue with a dependency.

knowing and deciding you can't reasonably fix it is a much better position to be in than shrugging and hoping it gets fixed in a later release, trying lots of versions or trying to refactor around it.

Re:Nobody's just reading your code by giancarlostoro on Tuesday February 27, 2018 @07:12AM (#16472754)
bsimpson still raised a good opportunity to do this: when you get a stack trace. Another idea is whenever you have no idea how something works... Or when the documentation for a certain piece does it no justice, it sure woudln't hurt to try and look under the hood to see what it's doing, sometimes you might even find comments that do a better job than the docs.
Re:Nobody's just reading your code by dalore on Tuesday February 27, 2018 @12:45PM (#16475872)
A nice middle ground is to step through with the debugger when you're in your own code and see what other code it's calling that isn't yours. You don't/can't read all of it as you said. But perhaps knowing the bits your interacting with helps a lot.
Re:Nobody's just reading your code by rtkwe on Tuesday February 27, 2018 @01:09PM (#16476160)
Along those lines are there any tools that are really good for that? I'm looking for a program that can do some things like IDA does for assembly where there's the ability to label blocks/variables and then see where it's used elsewhere etc.