| ▲ | quelsolaar 4 days ago |
| When ever i see "never implement your own...", i know i want to implement it myself. People say that about hard things, and I only want to do hard things. Nobody wants people who can do easy things, people want people who can do hard things. The only way to learn how to do hard things, is to do hard things, so do the hardest things. So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard. |
|
| ▲ | mikepurvis 4 days ago | parent | next [-] |
| Some things are good hard, the kind of hard that's driven by an interesting domain, going deep with well-architected tools or systems, learning lots of cool stuff. I expect datetime-adjacent code is basically the opposite of all of this. All the hard parts are driven by fiddly adherence to real-world geography, politics, physics/astronomy, etc. There's no underlying consistency from which a sane model can be extracted, it's just special cases and arbitrary parameters all the way down. I'm up for a challenge of course, but all else being equal, I'm happy to leave work that is the "bad hard" to others. |
| |
| ▲ | yes_man 3 days ago | parent | next [-] | | Reminds me of this passage from Postgres documentation: ”As an example, 2014-06-04 12:00 America/New_York represents noon local time in New York, which for this particular date was Eastern Daylight Time (UTC-4). So 2014-06-04 12:00 EDT specifies that same time instant. But 2014-06-04 12:00 EST specifies noon Eastern Standard Time (UTC-5), regardless of whether daylight savings was nominally in effect on that date.
…
To complicate matters, some jurisdictions have used the same timezone abbreviation to mean different UTC offsets at different times; for example, in Moscow MSK has meant UTC+3 in some years and UTC+4 in others.” Parsing datetimes indeed sounds like a challenge in collecting, knowing and maintaining all these warped out standards and compromises. ”Bad hard” is a great description | | |
| ▲ | popoflojo 3 days ago | parent [-] | | Leap seconds are when it really gets fun. | | |
| ▲ | gus_tpm 3 days ago | parent [-] | | I will never not be impressed with how well we are able to keep track of time in the world |
|
| |
| ▲ | bapak 4 days ago | parent | prev | next [-] | | Correct. It's not hard, just stupidly time consuming to the point of being unable to ever produce anything that works 70% of the time. I hate anyone who will attempt to craft their own 10-lines line parser and then ignore that it fails 4 times a day. Just use the damn library. Thank you. Write it for fun, but don't ship it. You're wasting everyone's time with your craft. | |
| ▲ | taneq 3 days ago | parent | prev [-] | | Exactly. It’s not hard, just annoying. |
|
|
| ▲ | glibby 4 days ago | parent | prev | next [-] |
| By all means, write it. Just don't use it. These warnings are almost always in the context of code you're going to release, not exercises in learning on your own. |
| |
| ▲ | kuon 4 days ago | parent | next [-] | | Hard disagree here. Use it. Of course, if you running code that drive a pacemaker or a train maybe be careful, but in general, do things. We don't want a world where only three old bearded guys can write a compiler or a physic engine. Do the same errors again and you'll learn, eventually you'll do better than those who were here before you. | | |
| ▲ | sabas123 4 days ago | parent | next [-] | | > We don't want a world where only three old bearded guys can write a compiler or a physic engine. Don't write your own OS does not mean do not contribute to something like the linux kernel. | |
| ▲ | patrick0d 4 days ago | parent | prev | next [-] | | Well don't do it and instead of using an off the shelf library that is known to work while the rest of the development team isn't reinventing the wheel.
Doing it for fun and education is fine of course. | |
| ▲ | breatheoften 3 days ago | parent | prev | next [-] | | What IS the right way to model dates in a pacemaker ...? I hope the answer is "just don't do it" -- but I don't know what reasons there might be for a pacemaker to need to depend on calendar dates in order to best do its job ... | | |
| ▲ | fc417fc802 3 days ago | parent [-] | | Well naturally it will need to connect to your phone via Bluetooth for the app to proxy update downloads and historic location data uploads. But in order to do anything on the network securely you need an accurate clock and the ability to parse datetimes because the PKI implementation depends on that. Then the app pings you to remind you that your premium subscription will be expiring soon after which your heart rate will be limited to 100 bpm or less. | | |
| ▲ | 1718627440 2 days ago | parent [-] | | Hopefully no real pacemaker manufacturer is allowed to do that. Creating radiation in the middle of a body near a critical organ without a medical reason sounds like a really dumb idea. Also you want the pacemaker to be as air-gapped and simple as possible, because it needs 100% uptime. (maybe I missed the implied /s) |
|
| |
| ▲ | Hnrobert42 4 days ago | parent | prev | next [-] | | >Maybe be careful Really? | |
| ▲ | Zambyte 4 days ago | parent | prev [-] | | It's interesting that people are disagreeing with you in a way that they're making it sound like they're elaborating on your point. To the people reading this, please don't just disagree with an "obvious counterexample". Explain why! |
| |
| ▲ | flir 4 days ago | parent | prev | next [-] | | In the case of date libraries, I think if I ported the tests from a few well-known libraries to my own, I'd have reasonable confidence in my own. Having said that, I don't think date libraries are hard, I think they're messy. Mostly because humans keep introducing convenience fudges - adding a second here, taking eleven days off there, that kind of thing. | | |
| ▲ | benlivengood 4 days ago | parent | next [-] | | I would not be surprised if the state of unit tests on good date parsing libraries are not sufficient to design a new one from scratch. See the number of unit tests in the Linux kernel, for example. | | |
| ▲ | flir 4 days ago | parent [-] | | You might be right, I haven't checked. It just seems on the face of it such an easy thing to test. Scalars go in, scalars come out. (This could just be me doing the Dunning-Kruger thing). You could run a fuzzer against two libraries at the same time to find discrepancies....... hmm. That might actually be a good exercise. | | |
| |
| ▲ | tbrownaw 4 days ago | parent | prev | next [-] | | > Having said that, I don't think date libraries are hard, I think they're messy. Messy is just a particular kind of tedious which is the most common form of hard. It's not like typical things that need doing tend to include solving lots of unsolved problems. | |
| ▲ | shakna 4 days ago | parent | prev [-] | | Most well-known date library systems have failed in places. Quite a few, still do. So whilst you might get some known regression to test against, nothing can give you a foolproof guide. You can have reasonable confidence that here there be dragons, but not so much that your assumptions about something will hold. |
| |
| ▲ | bdangubic 4 days ago | parent | prev | next [-] | | I write my own, but in production I always use libraries written by some dude from Omaha :) | | |
| ▲ | dylan604 4 days ago | parent [-] | | And that dude is no longer actively maintaining it and you just discovered an issue with it. |
| |
| ▲ | cmdlyne2 4 days ago | parent | prev | next [-] | | > By all means, write it. Just don't use it. I'd say write it, probably don't use it, and don't share it unless it's substantially better than the alternative. This way, you'll learn about it, but you'll more likely stay with something standard that everyone else is using, and you don't share yet another library that wastes others' time and your own (having to read about it, evaluate it, use it, and the migrate off of it when it's abandoned). | |
| ▲ | ramijames 4 days ago | parent | prev | next [-] | | This is such nonsense. All the stuff that we use, someone wrote. If nobody makes them, then how is that going to work? The messaging here is that you should be careful about using what you build on your own because it: - hasn't been battle tested - likely has bugs - isn't mature The only way that it will be all of those things is if someone invests time and energy in them. From an ecosystem perspective this is absolutely the right thing. You want duplicate projects. You want choice. You want critical knowledge to be spread around. | | |
| ▲ | Swizec 4 days ago | parent | next [-] | | > If nobody makes them, then how is that going to work? I see it as “Dont write your own X, unless you want to maintain X. Here be dragons, this problem is deeper than it appears, the first 80% will be easy, the next 15% will annoy you, and the last 5% will consume your life for weeks, months, or even years. Or you could use a library” | | |
| ▲ | ahartmetz 3 days ago | parent [-] | | The latter, if you want to get it completely right. I occasionally read the commits in the Qt framework, and from that, I can tell you that date-time stuff is complicated, and not in an instructive way, but in a super tedious way. |
| |
| ▲ | mattmanser 4 days ago | parent | prev | next [-] | | It's about exposure. The things that people write that everyone uses have had HUGE exposure. They've been exposed to all the edge cases, they've been tested millions, if not billions of times. All the bugs ironed out. The people who've worked on them are now the greatest domain experts on that little corner of comp-sci. Yours won't unless it hits prime time. So yours will be weak, brittle and dangerous. | | |
| ▲ | zelphirkalt 4 days ago | parent | next [-] | | This assumes, that the practices/methods used to create a working library are suitable for solving the problems. They might be ill-advised and include tons of workarounds for bad design decisions. Too often following the advice of never reinventing anything (and possibly doing better), is how we ended up with stacking broken stuff on top of other broken stuff, limiting us at every turn with leaking abstractions and bad designs. It is very possible to have a clean implementation with good design choices overtake an established in time, enabling more extensibility, modularity and maintainability. An example: People still way over-use regexes for all kinds of stuff. Even in code editors people for syntax recognition, where people really should know better. | |
| ▲ | gmueckl 4 days ago | parent | prev [-] | | In order to have these mature libraries, someone hat to start building them. They all had to to be incomplete, immature and horribly buggy early in their lifetime, too. | | |
| ▲ | immibis 4 days ago | parent | next [-] | | Yeah, so do you want to go through that process of shipping broken crap and fixing user complaints one at a time until it happens to work for everyone, which is a mandatory process for all new libraries in one of these areas to go through, or would you rather stand on the shoulders of someone who's already done it? | |
| ▲ | kulahan 4 days ago | parent | prev [-] | | Why would I mature yours and deal with those issues when I can just use the already-mature one? | | |
| ▲ | gmueckl 4 days ago | parent [-] | | You assume that you always have a mature option available. That's (a) definitely not a totally generalizable assumption and (b) my point is that mature options only exist because the people that developed them just did it when confronted with the task. | | |
| ▲ | kulahan 3 days ago | parent [-] | | We are specifically talking about something that does have a mature option available. That’s why it’s stupid to try and implement your own version of something complex. If you change the story such that the product is actually needed and universally immature, of course building it is a valid argument. Regarding b: Right, and the point of this article is that for those types of things, go for the already-mature thing. You’re arguing a point nobody is making. | | |
| ▲ | gmueckl 3 days ago | parent [-] | | I'm not changing any story here. All this "use a library" advice to juniors isn't as universal amd fast as everybody makes it sound. I always find that it sounds too discouraging. There is no magic in these libraries and in their creation - just time and effort. And that's something that needs to be mentioned, too. You can roll your own if you're willing to justify the effort. Depending on the context, it may just not be a good use of your time. That's why it's also important to point out that no significant piece of code is mature and stable from the start, but was brought into this state iteratively using tools and processes that are available to everybody else, too. The biggest difference between existing mature code and new code under any good development process
is age. |
|
|
|
|
| |
| ▲ | ozim 4 days ago | parent | prev | next [-] | | I think there is missing point in this discussion. Most of the time you build something else. Like if you build a todo app and have to deal with scheduling you don’t spend time making date library because it’s not your goal. But people would do that. Heck most developers instead of starting blog on a blog platform start writing code for their own blogging engine. | | | |
| ▲ | DANmode 4 days ago | parent | prev [-] | | Holy shit. The point is, before you release your new thing, make sure it addresses all of the pain points the previous solutions have already slogged through, or that if it doesn't, people are still aware of when they can arise, and why your thing has chosen not to mitigate them yet, or ever, if it's an opinionated piece of tech. | | |
| |
| ▲ | 4 days ago | parent | prev | next [-] | | [deleted] | |
| ▲ | bigstrat2003 4 days ago | parent | prev [-] | | I think that advice makes sense in the context of cryptography, where the consequences for getting it wrong can be quite serious indeed. I don't think it holds true for something as unimportant as a date parsing library. | | |
| ▲ | poink 4 days ago | parent | next [-] | | Correct date handling (including parsing) can be monumentally important. Imagine an app that reminds people when to take their medications, for example | | |
| ▲ | what 4 days ago | parent | next [-] | | You typically take medication at a set time every day. You don’t need to parse dates for that. | | |
| ▲ | poink 4 days ago | parent | next [-] | | 1) Dates are often stored as strings, so parsing them correctly is a necessary component of storing them. Also, those dates need not be simple app state. They could come from an API provided by your doctor/pharmacy 2) Many people (especially the elderly) take enough medications on different schedules that managing them all would be a significant cognitive load for anyone It’s just an illustrative example, though. My point is getting dates right (including parsing their string representations) often matters quite a bit. If you disagree, let’s argue about that rather than quibble about the minutiae of the example | |
| ▲ | 4 days ago | parent | prev [-] | | [deleted] |
| |
| ▲ | computerthings 4 days ago | parent | prev [-] | | [dead] |
| |
| ▲ | leptons 4 days ago | parent | prev [-] | | A lot of cryptography relies on dates, time, etc. |
|
|
|
| ▲ | leakycap 4 days ago | parent | prev | next [-] |
| I get wanting to do hard things, but do you write in binary? Do you crank your own electricity? My most valuable resource is time. Sure, I could learn more low-level aspects of my craft ... and sometimes I find it useful to do so. When I focus on doing the hardest, already solved things by re-implementing them my own way, what value am I adding? I've never met a client who cared about a library or how I did something in code - until it broke. Then, they didn't care who wrote it, they just cared it started working again. |
| |
| ▲ | quelsolaar 4 days ago | parent | next [-] | | Writing in binary or cranking your own electricity is easy. Anyone can do it. There is a difference between things that are difficult and things that just take a lot of work. | |
| ▲ | ok_dad 4 days ago | parent | prev | next [-] | | People have built tables but I still build tables myself. Not as many people will use them as people who use IKEA tables, but that’s okay, I’m still going to build them. | | |
| ▲ | leakycap 4 days ago | parent [-] | | I don't think tables are the hard thing. If you wanted to grow your wood, plane and dry it yourself, etc... then you'd be "hard way" building a table. I assume you use tools? | | |
| ▲ | ok_dad 4 days ago | parent [-] | | I mean, a table is as hard as you make it. I work with rough construction lumber, and make nice finished goods, my point was that people still do stuff that isn’t worth their time financially. | | |
| ▲ | leakycap 4 days ago | parent [-] | | > I mean, a table is as hard as you make it. We aren't talking about the same thing: I stated "I don't think tables are the hard thing." Note the word "the" in front of "hard thing" -- I'm referencing the article we're discussing, which mentions "the hard thing" | | |
| ▲ | fc417fc802 3 days ago | parent [-] | | The entire process is "the thing". In the case of a table by adjusting the inputs to the process you can cover quite a wide range of difficulty and required time. For example, start from a felled tree, use only hand tools, and assemble using medieval joinery techniques. Building a table that way is quite hard by modern standards. Now if you'll excuse me I need to get back to writing this date parsing library in assembly. | | |
| ▲ | ok_dad 3 days ago | parent [-] | | Not even doing it from scratch is the hard thing, the hard thing is getting the experience to know how to fit stuff together the best way to achieve your design and utilitarian goals, what wood to use, etc. The hard thing isn’t building the date parsing library in assembly, it’s learning assembly well enough to do it in the first place. I’m not sure where this discussion began but I was rebelling against everyone who says “just buy it” in regards to anything hard to do. |
|
|
|
|
| |
| ▲ | cortesoft 4 days ago | parent | prev [-] | | > I've never met a client There is difference between “never build your own for a professional need” and “never build your own”. I build my own stuff if it is for my own purposes, and I use proper tools and libraries for my professional work. |
|
|
| ▲ | chii 4 days ago | parent | prev | next [-] |
| > The only way to learn how to do hard things, is to do hard things, so do the hardest things. and i don't want to pay my employees to learn, i want to pay them to produce output i can sell. Doing hard things are good, if this hard thing has never been done before - like going to the moon. Doing hard things which has been done, but just not by you, is not good unless it's for "entertainment" and personal development purposes - which is fine and i encourage people to do it, on their own dime. Like climbing Mount Everest, or going to the south pole. But if you are doing a project for someone else, you don't get to piggy back your personal wants and desires unrelated to the project on to it. |
| |
| ▲ | schindlabua 4 days ago | parent | next [-] | | Except making employers do only easy things will make them stagnate. People who do nothing but simple CRUD apps over and over won't even be particularly good at making CRUD apps... whereas the guy who builds an Unicode font renderer in his free time always seems to write better code for some reason. Getting better at your job is not just a "personal want" but very much something that the employer appreciates aswell. Of course reinventing the wheel isn't good in corporate because the reinvented wheel is buggier than the ready made npm package but employers should go out of their way to find hard problems to solve that they can pass to their employees. It's called a growth opportunity. | | |
| ▲ | keybored 4 days ago | parent | next [-] | | You can’t convince an employer with that attitude. They’re gonna keep exploiting their employees and “encourage” them to do their “personal development” in their free time. | |
| ▲ | pjmlp 4 days ago | parent | prev [-] | | Unless you work for enterprise consulting where employers appreciate replaceable cogs that they randomly drop into any project, and nicely out project budget regardless of delivery quality. |
| |
| ▲ | ahf8Aithaex7Nai 4 days ago | parent | prev | next [-] | | > and i don't want to pay my employees to learn, i want to pay them to produce output i can sell. This can be a bad local optimum. It probably depends on what exactly your business does, but it can make sense to pay an employee to acquire knowledge and skills that are needed in the business. You can't buy this off the shelf in all circumstances. Of course, it also has to make economic sense and be viable for the company. Unfortunately, I often see employees doing things quite badly that they don't really understand because they are not given the opportunity to learn properly. I can't imagine that this burns less money in the medium and long term than giving paid employees adequate space to learn. | | |
| ▲ | pletnes 4 days ago | parent [-] | | Also as an employee, this forces me to job hop to stay relevant. | | |
| ▲ | pjmlp 4 days ago | parent [-] | | Unless you happen to live in cultures where that is looked down upon as not able to keep a job. | | |
| ▲ | pletnes 4 days ago | parent [-] | | Meaning you will job hop less, but you still have to weigh the advantage/disadvantage as always. |
|
|
| |
| ▲ | d_tr 4 days ago | parent | prev | next [-] | | I am in a work environment where I actually get to do hard shit for fun, learn a ton, and also "get stuff done" and my employer is happy. For some of the stuff that has been done already, it might still make sense to do your own implementation, for example if you want to be able to experiment without having to navigate and learn a huge codebase and then have to maintain a fork just to have your own stuff in. Another project we are starting now involves replacing software which is outright crappy and wastes our time. Thankfully my employer was able to see and understand this after talking it through with them. | |
| ▲ | quelsolaar 4 days ago | parent | prev | next [-] | | Your customers will pay more for things that are hard to do. Ask ASML. | | |
| ▲ | motorest 4 days ago | parent [-] | | > Your customers will pay more for things that are hard to do. Ask ASML. What a silly example. ASML is valuable because it does something no one else does. It's not because it's hard, it's because they have the know-how and infrastructure to do it whereas others don't. Juggling is hard. Do you know any millionaire jugglers? | | |
| ▲ | seb1204 4 days ago | parent | next [-] | | No one else does it, because it is hard I thought? Hard to get all the steps and processes aligned to produce what they do. It is so hard, that there is no rich guy that wants to throw money in the hat and do it himself. | |
| ▲ | bdhcuidbebe 4 days ago | parent | prev [-] | | > Juggling is hard. You should try instead. I brought jugglers balls for my team and in a few weeks we had 4 or 5 fluent. |
|
| |
| ▲ | bdhcuidbebe 4 days ago | parent | prev | next [-] | | > i don't want to pay my employees to learn Then how do you expect them to learn? Good luck getting more blood out of that stone, smh. | | |
| ▲ | Latty 4 days ago | parent [-] | | Let's be a little charitable and assume they mean just learn. There are hard tasks you can learn from that also provide something you can't just get off the shelf, rather than just reimplementing the wheel. |
| |
| ▲ | rambambram 4 days ago | parent | prev [-] | | Is quelsolaar your employee? |
|
|
| ▲ | avanwyk 4 days ago | parent | prev | next [-] |
| I can't believe this is such a controversial take. Solving hard things by yourself is growth. I 100% agree, rather solve a hard solved problem yourself than learning yet another JS framework or launching yet another revenue losing SaaS ("successful" because of VC). Or whatever. Push hard boundaries. |
| |
| ▲ | stouset 4 days ago | parent | next [-] | | Nobody is really saying not to build these things. They’re saying the problem is exceedingly annoying to solve—and often not in a technically interesting way but in a way that is just massively tedious—and a better alternative almost certainly already exists. If you want to build it to scratch an itch, go ahead. If you want to build it for fun, go ahead. If you want to build it because an existing solution gets something wrong and you can do better, go ahead (but know that it is a way bigger undertaking than you might assume at first glance). The real advice is “don’t casually build your own X”, but that’s less punchy. | | |
| ▲ | immibis 4 days ago | parent | next [-] | | An exemplary one is "don't build your own timezone database" It's not interesting, it's not fun, it's just a process of getting complaints it's wrong in edge cases and then fixing them, over and over until no one can find another broken edge case. You can start by writing down England is +0, Germany is +2, etc... someone's going to mention DST and you'll put in a field for switching on the Nth Sunday of month X... later you'll run into a country that uses a different rule and you'll add a bunch of spaghetti code or write a Turing-complete DSL, etc... One day someone tells you about a village where they count 17 hour days on seashells and then you'll give up. And if your DB doesn't produce identical results to the Olson DB in all cases then you created an incompatibility anyway. Might as well just use the Olson DB. | |
| ▲ | thfuran 4 days ago | parent | prev [-] | | >If you want to build it because an existing solution gets something wrong and you can do better, go ahead But please at least file the bug first. |
| |
| ▲ | myaccountonhn 4 days ago | parent | prev | next [-] | | I think it's a spectrum and most fall somewhere on the line, hopefully dependent on the project. My personal limit is rolling my own crypto, but I'm definitely more on the DIY scale because I agree. It's a fantastic way to grow and learn, and it's likely you might not have the energy to do it outside of work. | |
| ▲ | brianpan 4 days ago | parent | prev [-] | | It's controversial because 1) good on someone for wanting to do something difficult and 2) I cannot think of a worse thing to try to implement. Maybe trying to parse the world's postal and street addresses is a close second? Just, why. |
|
|
| ▲ | motorest 4 days ago | parent | prev | next [-] |
| > People say that about hard things, and I only want to do hard things. That's perfectly fine. Your time, your hobbies. > Nobody wants people who can do easy things, people want people who can do hard things. No, not really. People want people who do easy things, because they are clever enough to avoid needlessly wasting their time having to do hard things when they could have easily avoided it. It's your blend of foolish mindset that brought us so many accidental complexity and overdue projects. There's a saying: working smart instead of working hard. > So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard. You can cut it out, this isn't LinkedIn. |
|
| ▲ | kurikuri 4 days ago | parent | prev | next [-] |
| > When ever i see "never implement your own...", i know i want to implement it myself. Doing stuff for learning is useful, and the intent behind this general phrase is to not ‘implement your own’ something which is both hard and critical in a production environment. I work in cryptography (for security purposes) and have implemented quite a few things myself to learn, but I still use stable, field tested, and scrutinized crypto for any actual use. > People say that about hard things, and I only want to do hard things. Nobody wants people who can do easy things, people want people who can do hard things. Only wanting to do hard things limits yourself quite a bit: what about things which seem easy but could be improved? I worked in a non-tech related medical manufacturing job for a bit and took time to learn the process and tools. Afterward, I implemented a few tools (using what my coworkers (who have no programming or IT experience) have available to them: Excel and the VBA on the lab computers) to help them prep inventory lists which they have been doing by hand. Doing it by hand took them 3 hours as a group (and the first shift had to do this every morning), which my tool did in 5 seconds with a single button click. They still use it to this day, about a decade later. This wasn’t something ‘hard:’ I glued a few files together, grouped a list by a filter, sorted the groups by a column, and made a printout which was easy to read and mark on as they went about their day. However, my coworkers didn’t even know this was possible until someone came in with a different skill set, learned what they did (by doing the job well for months) and then made a solution. You must be careful with doing only ‘hard’ things. It requires other people to identify what is hard! In addition: crackpots do only hard things and believe they find better solutions than what exists so far (without consulting or learning about what has been done). Interesting people learn about things as they are (with the humility of knowing that they are not experts in most things) and tries to improve them using the knowledge they already have. Don’t waste your time rolling your own crypto when you could do the _actual_ hard thing and identify unaddressed space to make careful and considered improvements. |
|
| ▲ | dracodoc 4 days ago | parent | prev | next [-] |
| It's not because it's "hard". It's all about the nuisance created by human behavior. Calendar, DST, timezone, all the problems you never imagined can happen and can only be met in real life scenarios, and you will meet same problem again, struggle then found out the same problem have been solved long time ago by mature library, and the solution doesn't require any smart or advanced technique, just another corner case. |
| |
| ▲ | geocar 4 days ago | parent [-] | | I disagree hard. Firstly because I have a great imagination, but secondly because I am old and have a lot of real life scenarios to think about. State-of-the-art here has changed a few times in my professional career: Once upon a time most time/date libraries used a single integral type and try to make it do double-duty by being both interval and absolute (whatever that means) time by taking the interval from an epoch. Relatively recently however, that's started to change, and that change has been made possible by people using languages with better type systems reinventing the date/time approach. This has led to fewer bugs, and more predictability with regards to calendar operations in different programs. But bugs still happen, so this approach is still unsatisfying. One thing I keep having to worry about is distance; I record RTT as part of my events, since when I am looking for contemporaneous events, the speed-of-light actually tends to be a real factor for me. So I don't think this is solved simply because my problems aren't solved by existing libraries, and I keep getting into arguments with people who think GMT=TAI or something dumb like that. It's not "all about" anything: Nobody knows shit about what's happening in the next room over, and if there are 12 different date/time libraries now, I guarantee there'll be a 13th that solves problems in all of them, and is still incomplete. |
|
|
| ▲ | VohuMana 4 days ago | parent | prev | next [-] |
| I think in the case of the article the date library isn't necessarily hard but tedious. They mention most date libraries suffer from supporting too many standards or allow ambiguity. I agree with you though, do the hard things even if it doesn't work 100% right you will have learned a lot. In university I had to implement all of the standard template library data structures and their features, it wasn't as robust as the actual STL but the knowledge of how those work under the covers still comes up in my day to day job. |
|
| ▲ | psychoslave 4 days ago | parent | prev | next [-] |
| There are different kind of hardship though. There things which was a result will make your mind click to an other way to comprehend a problem space and how to navigate through it. And there are things which are hard due to pure accumulation of concurrent conventions, because of reasons like coordinating the whole humanity toward harmony with full happy peaceful agreement of everyone is tricky. Handling date is rather the latter. If you dig in the lucky direction, you might also fall into cosmological consideration which is a rabbit hole of its own, but basically that's it: calendars are a mess. |
|
| ▲ | gjm11 4 days ago | parent | prev | next [-] |
| I find this a perplexing comment in view of the fact that almost all of the linked article is in fact about how the author wrote his own date parsing library; the "never do it" bit is just a couple of lines at the start and so far as I can tell is mostly there for fun. (In particular, at no point does the article actually argue for not writing your own date parsing library. It just says, in essence, "Never do it. I did it. Here's what I did and why.") |
|
| ▲ | rgavuliak 2 days ago | parent | prev | next [-] |
| > Nobody wants people who can do easy things, people want people who can do hard things. No, people want people that can provide value regardless of the difficulty. What you're describing is how we end up with not invented here syndrome. |
|
| ▲ | ozim 4 days ago | parent | prev | next [-] |
| Missing context is - there is always something else you work on like the guy was making Eleventy so it was waste of his time. If you work for a company and build todo app most likely it will not be beneficial for you to implement in-house library because there will be stuff that will bring much more value. Like you don't have now 2 years to cover for all hard stuff because you have to make synchronization of tasks between devices and your boss most likely won't appreciate that. "Never roll your own cryptography" is always used in context of building another application it is never "don't become a cryptography specialist". |
|
| ▲ | nicoburns 4 days ago | parent | prev | next [-] |
| > So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard. You can absolutely do these things. What you need to be aware of is that in most cases maintaining these things to a production quality level is full-time job for a talented engineer. So you shouldn't attempt these IF: - You have a higher-level aim you are also trying to achieve - You need a production quality implementation If one of those isn't the case then knock yourself out. |
|
| ▲ | rkagerer 4 days ago | parent | prev | next [-] |
| Don't forget to roll your own crypto libraries. |
|
| ▲ | DonHopkins 3 days ago | parent | prev | next [-] |
| It's so tempting to tell you "never implement your own html parser using regular expressions" just to make you do it. I triple dog dare you! https://www.youtube.com/watch?v=mc6pk2FRhbA |
|
| ▲ | d_tr 4 days ago | parent | prev | next [-] |
| In a scenario where a programmer has to do this for work and might naively think that date handling is simple, the title is invaluable advice. It is one of those things that can cause real trouble. OTOH writing, e.g., your own renderer could cause some funny display at worst and maybe some unnecessary effort. |
|
| ▲ | qwertox 4 days ago | parent | prev | next [-] |
| This past 22nd of July was the shortest recorded day [0]. How would your library handle this? [0] https://www.space.com/astronomy/earth/earth-will-spin-faster... |
| |
| ▲ | gmueckl 4 days ago | parent | next [-] | | Answer: not at all, unless I had to deal with astronomical time to compute locations of celestial bodies with high precision. | |
| ▲ | cortesoft 4 days ago | parent | prev [-] | | No libraries handle this, though |
|
|
| ▲ | junon 3 days ago | parent | prev | next [-] |
| Writing an OS. I've learned more about computers, hardware, CPU design, compilers, etc. that have translated into literally every other facet of my IT world than I could have done without this project. Definitely agree. |
|
| ▲ | geocar 4 days ago | parent | prev | next [-] |
| Yes. Do it. The only way you understand X is by making your own X and trying to support it for a few decades, and our industry needs more people who understand X; fewer who just ask chatgpt/stackoverflow/google for "the answer". |
|
| ▲ | david-gpu 4 days ago | parent | prev | next [-] |
| Software companies make money by providing value to their customers via the software they provide. How does reimplementing a hard but already well-solved problem align with their goals? How does that compare with solving a hard problem for which there are no good solutions yet? |
|
| ▲ | drewcoo 3 days ago | parent | prev | next [-] |
| There's hard and then there's "there are so many unexpected edge cases you'll surely be cut if you touch that code," which not fun-hard. This is the latter. |
|
| ▲ | cookiengineer 4 days ago | parent | prev | next [-] |
| I feel obligated to comment on this. Due to my work I rely on web scraped data for cybersecurity incidents. For Amazon Linux, they are disclosed with the fvcked up US datetime format (Pacific Time) and not in ISO8601 formatted strings which could imply Juliet/Local time. In 2007 there was a new law that changed when Pacific Time enters/leaves Daylight Saving Time. Instead of making this fixed by a specific Day of a specific Month in numbered form like say "YYYY-03-01 to YYYY-10-01", they literally wrote the law quoting "first Sunday of April" to "last Sunday in October". Before 2007 it was "Second Sunday in March" to "first Sunday in November". I'm not making this shit up, go ahead and read the law, come back and realize it's even more complex for other timezones, because some nations seem to make fun of this by going to +14:00 hours and -11:30 hours depending on the president's mood on Christmas or something. In order to find out the Day of a specific calendar date, there's this cool article about Determination of the day of the week [1] which is quite insane on its own already. There is no failsafe algorithm to do that, each method of determining the day of the week has its own tradeoffs (and computational complexity that is implied). Then you need to get all Sundays of a month, count the right one depending on the year, map back the date to ISO8601 and then you know whether or not this was daylight saving time they're talking about. Also make sure you use the correct local time to shift the time, because that changed too in the law (from 02:00LST to 03:00LDT and 02:00 LDT to 01:00LST before, to 02:00LST to 03:00LDT and 02:00LDT to 01:00LST after the changes). Took me over 4 fvcking weeks to implement this in Go (due to lack of parsers), and I hate Amazon for this to this date. PS: Write your own Datetime parser, this will help you realize how psychotic the human species is when it comes to "standards". After all this I'm in huge favor of the Moon Phase based International Fixed Calendar [2] [1] https://en.wikipedia.org/wiki/Determination_of_the_day_of_th... [2] https://en.wikipedia.org/wiki/International_Fixed_Calendar |
| |
| ▲ | GoblinSlayer 4 days ago | parent [-] | | Reporting of cybersecurity incidents are easily late by a month or more, time zones are well below the rounding error. You will be more accurate to display it as YYYY±6month. | | |
| ▲ | cookiengineer 3 days ago | parent [-] | | You seem to be not aware that there are a lot of legal obligations which come with providing this kind of inaccurate data. Especially if things go wrong because of it. |
|
|
|
| ▲ | kyawzazaw 4 days ago | parent | prev | next [-] |
| Corporations and government certainly want people who can execute things that are easy, but reliably and consistently |
|
| ▲ | djfivyvusn 4 days ago | parent | prev | next [-] |
| Yea, date time parsing is probably fine so is rolling your own auth, unicode, font rendering, compilers. Datetime libs themselves? No thanks. |
|
| ▲ | ainiriand 3 days ago | parent | prev | next [-] |
| Yeah but never ever roll your own encryption, or do it but never trust it. |
|
| ▲ | richardw 4 days ago | parent | prev | next [-] |
| Never write your own multi-planetary date/time library in brainfuck. |
|
| ▲ | whoamii 4 days ago | parent | prev | next [-] |
| … but if you plan to sell it, don’t build your own billing system! |
|
| ▲ | fsckboy 4 days ago | parent | prev | next [-] |
| you want to do something people really think is hard? use C. it's not safe. all the people who say C is not safe have downvoted me for quoting them |
| |
| ▲ | quelsolaar 4 days ago | parent [-] | | I exclusively write in C89. I'm a member of the ISO C standard board. | | |
| ▲ | boothby 4 days ago | parent [-] | | The confluence of tinker-for-tinkerings'-sake "hackers" and get-rich-quick "hackers" on this site certainly leads to a lot of fun miscommunication. |
|
|
|
| ▲ | bobsmooth 4 days ago | parent | prev [-] |
| Solve new hard things instead of solved hard things. |
| |