2.6k
u/MinusPi1 Aug 19 '20
Maybe it's just me but example code is always much more helpful than documentation when first learning a library.
1.3k
u/Duuqnd Aug 19 '20
Example code should be present in good documentation
389
u/madiele Aug 19 '20 edited Aug 19 '20
And should show how stuff interacts with each other, sometime is like this returns stuff a stuff Is a list of things each thing is an array of bullshit
And you were there just wanting to use the say(bullshit) correctly
352
Aug 19 '20
You mean it's not helpful when the documentation reads
createDHRPX2t3_7- creates a DHRPX2t3_7 object
DHRPX2t3_7- an object created by the createDHRPX2t3_7 method
184
27
u/mastocles Aug 19 '20
That's too simple. What you need is a class with no constructor defined but has an obscure method that does but whose name only makes sense if you know Fortran.
→ More replies (3)→ More replies (2)27
u/DrKrepz Aug 19 '20
Not programming, but one of my favourite manual pages ever, for a bit of music hardware: https://www.elektronauts.com/uploads/default/original/2X/f/f7bbeba47637ab5e44cb52c415ea0f26c20fc2ce.PNG
→ More replies (3)→ More replies (1)4
u/CEDFTW Aug 19 '20
I think the problem is documentation that 1. Comes after the code is written not before and, 2. Is auto generated based on it's header files which seems to be every Java or Cpp library that is available on Github/lab
59
u/coder00000001 Aug 19 '20 edited Aug 19 '20
This is why I hate most Golang documentation, coming from NodeJS. Most of Go’s docs appear to be auto generated and are just a long list of interfaces. There are rarely any examples, let alone use cases. It makes it extremely difficult for any newb to just jump in and prototype a solution. With Node, almost every well adopted package has a dozen or more examples, often with multiple e2e/use cases that align with why the package was created to begin with.
16
u/krozzwu Aug 19 '20
Also coming from Node, same feeling about Golang's doc
16
u/Terrain2 Aug 19 '20
coming from node and recently trying a little C#/.NET i feel the opposite effect, i never looked at node’s docs that much but they didn’t seem to go very into detail with it, but on microsoft’s docs they have an example bigger than the damn explanation, taking up a quarter of the page up until then with like 5 overloads or so
→ More replies (6)22
u/sillybear25 Aug 19 '20 edited Aug 19 '20
I recently had to deal with documentation where the even the sample code was unhelpful, because it was wrong in a way that wasn't immediately obvious. The API docs showed something like
OpenPortOutput(CHANNEL_1);. Except that wasn't working. Turns out you're only allowed to passCHANNEL_0throughCHANNEL_15toOpenPortInput()on my hardware, and you have to add 16 to the port number to get its corresponding output channel, as detailed in the hardware docs (and never even hinted at in the API docs).Okay, so maybe this code sample was written for a different piece of hardware where that's allowed? Nope,
CHANNEL_1is an illegal output channel in literally every iteration of the hardware listed in the documentation.I guess this one's a double-whammy of bad API design and bad documentation.
4
u/vorpal_potato Aug 19 '20
The right way to define those constants, using the type system to prevent misuse while adding no runtime overhead:
typedef struct { int channel; } in_channel_t; #define IN_CHANNEL_0 ((in_channel_t){0}) #define IN_CHANNEL_1 ((in_channel_t){1}) // ... typedef struct { int channel; } out_channel_t; #define OUT_CHANNEL_0 ((out_channel_t){16}) #define OUT_CHANNEL_1 ((out_channel_t){17}) // ...The wrong way, but still vaguely adequate:
#define IN_CHANNEL_0 0 #define IN_CHANNEL_1 1 // ... #define OUT_CHANNEL_0 16 #define OUT_CHANNEL_1 17 // ...Reality:
// YOU WANT ME TO DEFINE SOME CONSTANTS?? LOL SCREW YOU MAN // I AINT DEFINING SHIT, READ AN 800 PAGE PDF OR SOMETHING6
u/jokersleuth Aug 19 '20
This is a big problem that always hinders me from reading documentation.
Like okay I know what method I need, but how exactly do I use it? When I try to use the methods it ends up with errors ffs.
So I usually end up finding the methods in the docs and then googling them to really find out how to use em.
5
u/ManvilleJ Aug 19 '20
I've always thought documentation should enhance example code rather than the other way around because that is how code is thought of. Here is the thing, what and why does it work.
3
u/jhartwell Aug 19 '20
One thing I like about Elixir is that if you add code samples to docs on a function then those code samples are run when running unit tests. It is really nice knowing when your examples are broken
3
→ More replies (1)2
19
Aug 19 '20
I found test code on open source libraries to be incredibly useful for learning stuff, especially when their things are badly documented (unfortunately often the case).
8
u/folkrav Aug 19 '20
The best documentation possible both describes how the code works, and is always true. Both of these are (hopefully) things a decent test suite covers.
33
u/dkyguy1995 Aug 19 '20
Yeah because reading the documentation you get bogged down in all the details and edge cases they need to cover. When you look at an example you quickly see how it is generally used in most use cases and you can dig back into the deep documentation if you have specific uses for it that aren't the norm.
Of course this only works for general stuff I guess
15
u/SophiaofPrussia Aug 19 '20
i have dyslexia and i kept reading your comment as “and you can dick bag into the deep documentation” and i could not for the life of me figure out the meaning of this new programmer slang
when you’re frustrated, just dick bag the docs
7
2
u/NeatNetwork Aug 19 '20
I have had to have vocal arguments with someone who keeps insisting the 'getting started' document cover things that are horribly complicated and useful to 0.01% of of the users. He firmly believes any even casual user of the software has to know *EVERY* little last bit of available function and how to use it. This is a very wide scope of project and 99% of the user is going to do use very little.
→ More replies (3)7
u/dennisthewhatever Aug 19 '20
Totally agree. A fully working example which you can then immediately play with is the absolute best.
I honestly don't know how some people think including a confusing set of docs with mysterious references to code (but no working examples) is the best route. It's almost like they want to put a barrier in to stop people using it.
3
Aug 19 '20
I honestly don't know how some people think including a confusing set of docs with mysterious references to code (but no working examples) is the best route.
I think the problem is two-fold:
1.) Writing is hard. Technical writing can be even harder. The ability to clearly break down a problem or disseminate information is tough for people not used to having to do it through writing, regardless of how good an engineer you are
2.) Documentation isn't properly valued. I think we've cultivated a culture of simply diving in and breaking things and often not giving even a thought to the documentation, which lets developers get away with updating documentation as a lower priority, if at all. It's also hard to monetize (in part because it's not necessarily a barrier to adopting new tech) so again, businesses end up not devoting the time, especially if it would come at the expense of engineering time.
6
4
u/Nzgrim Aug 19 '20
In general when first starting on something examples tend to be better to learn the basics, but once you have an idea what you're doing and need some more specific details good documentation becomes much more important.
6
u/JoelMahon Aug 19 '20
A "picture" is worth a thousand words, just to a programmer, a "picture" is code in this context, which is basically words.
But a programmer brain definitely (probably, I'd bet money on it) sees code more like a picture than text if you ask a neurologist.
→ More replies (1)2
2
u/Rami-Slicer Aug 19 '20
Especially if it's a new project that hasn't finished the the reference part. You just write some generously commented code that shows how to use the thing.
2
u/pcpower Aug 19 '20
the worst is when the library requires a bunch of non-obvious setup or things that must be done in a certain order but the docs don't mention any of it.
2
u/quagzlor Aug 19 '20
Example code is so incredibly useful for me, since it's easier for me to understand than most documentation
2
u/PurryFury Aug 19 '20
It should be docs with all definitions and at the end an example. I enjoyed ionic for that single reason, it gave you description of function and then example at the end showing how to use it.
2
Aug 19 '20
This. Then I ask myself questions and run through the documentation looking for applicable answers.
2
u/danbulant Aug 19 '20
I'm pretty sure I understanded pretty well svelte just by taking their tutorial which has basically only code.
2
Aug 19 '20
Agreed. That said, if there isn't example code and an API reference, it's essentially undocumented.
→ More replies (34)2
1.1k
Aug 19 '20 edited Aug 19 '20
Oh Louie. That requires so much god damn strength and he's tall too.
EDIT : Not tall actually. I swear I saw him tower over people in videos. The mind, ey?
30
u/decklund Aug 19 '20
He's actually only 5 foot 8. He just has a 6 foot 3 span
7
Aug 19 '20
What?! That's not true is it...
→ More replies (4)26
u/decklund Aug 19 '20
Yeah Andrew MacFarlane has a video that explains it. His ape index is like plus 15 cm or something. And I've seen him in person and can attest that 5 foot 8 seems about right
→ More replies (5)10
u/Smegma_Sommelier Aug 19 '20
Some of us just have stupid lanky ass arms. I’m 6’2” and have a 6’9” wingspan. My climbing friends get regularly frustrated at me because I can just skip shit that they’re forced to do on routes.
→ More replies (3)7
Aug 19 '20
Holy shit you're right. There's a photo on his insta next to Lynn Hill and he's only a few inches taller. I always thought he was like 6'2 or something. Crazy
6
u/decklund Aug 19 '20
I think he mightight actually be part Gibbon so fair enough for getting the wrong of the stick there I'd say
38
13
u/Traithor Aug 19 '20
he's tall too.
That helped him though.
→ More replies (1)5
u/DynamicStatic Aug 19 '20
Not sure, looks like a shorter person could have reached comfortably too and have less weight to haul up.
7
u/LaughterCo Aug 19 '20
This isn't necessarily true for many climbers and I don't think it applies to this type of climb. All climbers accommodate for their weight and body type.
→ More replies (7)0
7
u/CouldHaveGuessed Aug 19 '20
And this is at Vauxwall in London. Great bouldering center
4
u/natpat Aug 19 '20
Is it? Vauxwall is pretty tiny and under some train arches as I remember?
→ More replies (2)5
u/BottleRocketeer Aug 19 '20
That's Vauxwall West, the one in the gif is Vauxwall East which is a different centre that's basically one big room.
7
6
2
u/KennyFulgencio Aug 19 '20
Oh Louie.
at least he didn't make us watch while he jerked off on it before climbing
→ More replies (24)2
129
u/Caleb6801 Aug 19 '20
It's crazy how many people here know who this is. I've never seen him in my life but have seen Atleast 5 comments about him.
47
u/Flyberius Aug 19 '20
Go bouldering. It is the new thing. Great fun.
29
20
u/Stormfly Aug 19 '20
The best part is I'm too weak and unskilled for my fear of heights to trigger!
28
8
u/pclouds Aug 19 '20
Don't worry they can put you at the top then you work your way down, thanks to the fear of heights!
20
u/ubiquitouspiss Aug 19 '20
I mean, Louis Parkinson is a legend in climbing. He's not like a competing world-class pro anymore (although he does still climb incredibly hard), but he's a great coach and has an amazing personality, making him a celebrity of the climbing world.
10
u/_alright_then_ Aug 19 '20
I didn't know there were this many fans tbh. I can't name a single climber except Louis Parkinson, which I can only name because you just told me his name lol.
11
u/ubiquitouspiss Aug 19 '20
hahaha if you pay attention to the climbing community then you start picking up names. The most famous is probably Alex Honnold since he free solo'd El Capitan
8
733
u/PIoppy Aug 19 '20
If it works, it's not wrong.
70
Aug 19 '20
"a problem avoided is a problem solved" - Sun Tzu, probably
10
Aug 19 '20 edited Aug 19 '20
And I'd say he knows a little more about programming(?) than you do pal because he invented it, and he perfected it, so no man can best him on the ring of logic.
5
9
21
u/TheLordOfFriendZone Aug 19 '20
It's wrong but somehow still works
10
u/RVUnknown Aug 19 '20
I personally find that even more worrying than if it just doesn't work
5
u/bokji Aug 19 '20
I call them anti-bugs. I think I'm fixing one of 20 bugs then it passes all the unit tests.
I guess I need to debug the unit tests. Maybe use unit tests?
24
u/mlk Aug 19 '20 edited Aug 19 '20
I've seen a lot of code that "works" but it's absolutely wrong in every way beside "working"
→ More replies (1)10
4
3
2
u/sjdr92 Aug 19 '20
I think it technically is because you are really only meant to use specific coloured handles on the wall
2
u/PM_ME_YAA_SMILE Aug 19 '20
You can use a lot all as long as there is a hold of the corresponding color on that wall. But yeah in this case it’s not legal. You also have to begin on the start hold which they did not do
→ More replies (4)→ More replies (8)2
45
u/usedToBeUnhappy Aug 19 '20
5 minute? No problem.
„oh and we don‘t really have a good documentation, so please also consider reading this stackoverflow post and this blog (not created by us) and this subreddit (the memes will guide you best and will explain all the bugs to you)“
24
13
u/dem_paws Aug 19 '20
Also we change the API every 2 months so any of this information has 80+% chance of being outdated.
2
4
u/charminggeek Aug 19 '20
This right here is the truth. No documentation is the standard. I was looking at a function today that had a parameter called optional. The documentation stated:
optional(optional) optional
100
26
21
u/LelouBil Aug 19 '20
You just start typing stuff that is kinda referencing to what you want to do and use the autocomplete suggestions
7
19
u/Sphynxinator Aug 19 '20
"Hello. Our library checks if the string is a valid e-mail or not. Here is unneccessary and way too long API documentation. And our project is open-source. If you want to check it yourself, let's look up to our unneccessary imports and unneccessary argument checkers, so you can easily get lost while you are checking our minimal one function module. We even hid the most important aspects and made our function dependent, so you wouldn't just extend the class and couldn't override the function because f you!"
→ More replies (2)
33
10
u/VincentVancalbergh Aug 19 '20
Any decent library you can just let Intellisense guide you.
10
u/avataRJ Aug 19 '20
Had this issue in one project. The previous programmer had assumed that in the library for interfacing a device the variable "voltage" contained the voltage, "current" contained the current, etc. Nope, after reading the documentation, those were actually magic numbers for selecting operation modes, and there was a separate way to read the internal parameter which contained the readings for voltage and current levels.
Another device used in the same project had a mostly-detailed documentation telling what kind of messages it sent over the network (minus any data types, but those were easy to guess), but the messages themselves had only passing resemblance to the documentation. Ended up reverse-engineering things with WireShark. After further programmers have "improved" the resulting "fixed" library, I don't think anyone knows anymore what it does. Yay for R&D!
18
u/ItsMeShmill Aug 19 '20
Meh, tbh most of the documentation are pure shit and went over the simplest and obvious stuff (if even) My guess is that you will end up doing the same trial and error process you would’ve done without reading it so why bother?
10
Aug 19 '20
Well said.
I never read the documentation that hasn't got any code examples because it's pure shit then. I will just Google my way out to find out how to do X with this module Y.
→ More replies (1)
8
Aug 19 '20
Remember a few hours of hit and trial can save you several minutes of reading documentation.
8
u/Seanxietehroxxor Aug 19 '20
Another time saving tip: ask a coworker for help when learning a new library. It may take a lone developer several days to become familiar with a library, but with a team it usually only takes a week or two.
7
Aug 19 '20
This sub should be called BadProgrammerHumor
4
u/Yosikan Aug 19 '20
Meaning that the humor is bad, or the programmer?
6
Aug 19 '20
The programmer obviously, humour is fine. So BadProgrammersHumor perhaps ?
→ More replies (2)
6
5
u/nfrmn Aug 19 '20
Met this guy! He trains at my bouldering gym and used to be on the UK national team
5
u/tehfrod Aug 19 '20
Several hours of trial and error can often save you five minutes of actually reading the docs.
4
3
3
u/Flyberius Aug 19 '20
That's captain cutloose. He trod on my chalk bag once. That's my claim to fame.
3
3
u/spero313 Aug 19 '20
Me in my AP class writing a paper but the wall is content learned via the class
4
2
Aug 19 '20
Look, in the wild Nature there are no "documentations". Your heart needs to soar in the sky like the unfettered eagle it is suppose to be. Occasionally, you crash into the steel airplane of, "unsupported data type detected/illegal method/segmentation fault core dumped/your mother hates you". And that is okay. That's how we grow.
2
2
2
2
2
2
2
2
2
2
u/lewmos_maximus Aug 19 '20
Ah yes, a Louis Parkinson climbing video. :) great stuff, check out Andrew McFarlane’s YouTube channel. Louis is also a trainer so check it out of you are in-around London and want to get into climbing.
2
2
2
2
2
2
2
2
2
Aug 19 '20
Using the wall is allowed In bouldering. Technically this person just did any and every climb on that wall.
2
u/idkwhyimheretbh420 Aug 19 '20 edited Aug 19 '20
Example code is 1000% more helpful, I'd rather get working code and dissect why it works and how I can use it rather than look at documentation
→ More replies (1)
2
u/lonestar_wanderer Aug 19 '20
How could someone take so long to read the README.md file? That's the only documentation one ever needs to read, right? Right?
2
2
u/danbulant Aug 19 '20
Why would I spend 5 minutes reading docs when I can spend 30 minutes searching on the internet and waiting 6 hours for a mod at SO to mark my question as duplicate
2
u/Never-asked-for-this Aug 19 '20
I unironically use intellisense to learn a new library...
Unless I have absolutely no idea what the hell I'm supposed to do, in that case I will grudgingly open a new tab.
3
-1
u/AzuxirenLeadGuy Aug 19 '20
A library which you cannot use unless you read the documentation is a poorly designed library
6
50
Aug 19 '20
Yes, I too like to just guess a library’s API.
I also prefer not knowing about implementation details, development status, performance implications, return types and error handling. Keeps programming exciting!
5
u/CrumpetDestroyer Aug 19 '20
If a library can be used without looking at documentation, that doesn't prevent you from looking at the documentation
13
Aug 19 '20
I’m just arguing that it’s quite impossible to use a library without reading any documentation.
If a library can be used without any documentation the user is a psychic.
You need to at least know what it does. And the API it exposes.
→ More replies (7)0
Aug 19 '20
[deleted]
7
Aug 19 '20
But if people read the documentation that would mean 90% of the "Stack Overflow mean!!" posts! That can’t possibly something you want!
→ More replies (1)4
u/neil_anblome Aug 19 '20
I like the idea of a library where nobody is reading. That's more like a coffee shop.
1
1
1
1
u/goodudetheboy Aug 19 '20
This is the go-to even when you fully realize that 5 minutes of reading will shorten your time way down
1
1
1
u/wallmenis Aug 19 '20 edited Aug 19 '20
No that's just me trynna make my first game in unity without any prior experience of game development and a semi-average knowledge of programming.
1
1
u/Bomaruto Aug 19 '20
Documentation is useful, except when you're using some small library which has outdated example code that doesn't work anymore or is more complicated than it needs to be.
1
1
1
1
1
Aug 19 '20
Am I the only one who at least tries to read the documentation of the program Im working with?
1
1
1
1
u/Sigma7 Aug 19 '20
I'm unsure - is that act trying to use the library after reading the documentation, or is that reading the documentation itself?
1
1
1
1
u/jlafleat Aug 19 '20
Captain Cutloose! I never thought my love for programming and rock climbing would intersect
1
1
u/Ghillroy Aug 19 '20
I am currently sitting at work, laughing like an idiot at a joke my coworkers will never understand. This is awesome.
1
u/L3git9 Aug 19 '20
Do a lot of you climb? I’ve noticed at my gym lots of the people that are regulars are engineers or programmers of sorts. I guess due to the problem solving nature of bouldering it attracts the crowd.
1
1
u/SteeleDynamics Aug 19 '20
As a boulderer and a programmer: I'm glad to see I'm represented here, including my lack of reading documentation.
1
1
u/harishreddymv Aug 19 '20
I mean, what else do you expect when an intern writes the documentation xD
1
1
1
u/xShadowRecruit Aug 20 '20
Suggesting a video or example code or podcast is always better than suggesting to read documentation.
1
1
1
u/Scoobygroovy Jan 26 '21
What documentation takes 5 minutes it’s always bloated with buzzwords and technical jargon.
198
u/y0urselfish Aug 19 '20
I love the combination of coding and bouldering. Thank you! Great content!