Live data from Hacker News

Json-Base – Database built as JSON files

github.com

151–160 of 189 posts

Re: Json-Base – Database built as JSON files

#151
I'm not trying to be a huge asshole here, but this has zero tests and just saves json files to disk. There's literally a full readme and contributors guide but zero tests for something that's supposed to store data for you?

For a community that loves it some Jepsen analysis, I can't for the life of me figure out why this has been up-voted so many times. This is just saving JSON file to disk. I'd argue this is harder than using Redis (flushing to disk) or (vomits in mouth) Mongo. Or shit, just use your filesystem and `jq`, you'll have something likely faster, safer, and more maintainable.

Re: Json-Base – Database built as JSON files

#152

I'm not trying to be a huge asshole here, but this has zero tests and just saves json files to disk. There's literally a full readme and contributors guide but zero tests for something that's supposed to store data for you? For a community that loves it some Jepsen analysis, I can't for the life of me figure out why this has been up-voted so many times. This is just saving JSON file to disk. I'd argue this is harder…

What are you talking about? They have tests right here: https://github.com/Devs-Garden/jsonbase/blob/master/test.js

Just uncomment the tests you want to run! Easier than using a testing library IMO.

Re: Json-Base – Database built as JSON files

#153
post #140

Earlier quoted context omitted.

That is a little more complex than, "Here's a .exe, it will save files into your My Documents. Click Export to make a zip, import to read someone else's zip." Plus generating instructions on how to do that would have been tough, and this way should be much easier to spread the app around. Basically, you don't have a bad idea, and if I were a couch expert or were not on the other side of the world, I might have chosen…

I understand, it was mostly or the-in-the-future-maybe-have-a-web-function-to-sync. I also suggested Couch because outside of western countries, you seldom find laptops or desktops (outside of cities), but smartphones with a recent browser are ubiquitous, so if it worked on IE7 it would run anywhere, even in the most remote area with no/crappy network. And the first time I used couch, my programming "knowledge" was v…

> And the first time I used couch, my programming "knowledge" was very basic HTML (no JS).

That probably explains a lot: you have a hammer and everything looks like a nail.

CouchDB makes no sense whatsoever for the requirements described.

Re: Json-Base – Database built as JSON files

#154
post #29

Earlier quoted context omitted.

And there's never a serious consequence to the ones who did it. By then they switched to a new position somewhere else. Like most prima donnas. And this shows that deep, deep down they know they are fake.

That sounds like it comes from some specific experience you had... but it's pretty uncalled for to apply it so confidently to someone you don't know. Don't be mean, right? Actually, another view is that there's nothing wrong with tinkering and DIY. Perl, JS, Redis all came from people hacking their own solutions (as far as I know). Also, many big software orgs build extensive internal tools themselves. Plus, making y…

There is nothing bad about writing your own solutions.

What is bad is putting them in production when you don't have a clue about the domain.

Re: Json-Base – Database built as JSON files

#155

You definitely shouldn't use this in production. Looking at the code there's: - race conditions everywhere. - bad and inconsistent formatting, which doesn't help with the - huge if-else monstrosities. - Also uses synchronous IO and asynchronous IO randomly. - Uses try-catch liberally, doesn't check the caught errors, and just re-tries blindly forever in some cases. If you do any parallel updates/inserts/removals with…

They're using readFileSync? Doesn't this lock up the thread?

Yes. They’re also using fs.exists in the exact way that the official documentation says not to use it.

Re: Json-Base – Database built as JSON files

#156

Earlier quoted context omitted.

That sounds like it comes from some specific experience you had... but it's pretty uncalled for to apply it so confidently to someone you don't know. Don't be mean, right? Actually, another view is that there's nothing wrong with tinkering and DIY. Perl, JS, Redis all came from people hacking their own solutions (as far as I know). Also, many big software orgs build extensive internal tools themselves. Plus, making y…

There is nothing bad about writing your own solutions. What is bad is putting them in production when you don't have a clue about the domain.

Being ignorant didn't make you a prima donna tho, as above says.

Also, they have to have some clue about the domain, because the domain is their own problem and they're writing a solution for it. So I don't think we can really just someone as not having any clue about their own engineering challenges.... especially if they're working solutions to them....

Antirez said literally he didn't know about existing solutions when he went to write redis, and he and redis are awesome. nothing bad about that

but I get your point about bad solutions are bad but that's sort of a tautology, doesn't add much value, and who are we to judge someone else's solutions are bad we don't know everything about their use case.

Again... even if we can say that you choosing someone else's technology for your problem is not a good solution we just can't criticize the author because it's your responsibility what you choose. so I just don't think it's valid to criticize the author

Re: Json-Base – Database built as JSON files

#157
post #16

Someone at my old company basically did this and put it into production. The first problem he encountered was that multiple connections couldn't both be using the database at a time without clobbering each other. "No problem," he thought, this is a good use case for micro services. A service sitting on top would ensure that there was only one operation being performed at a time. Next, his problem was that the databas…

Someone at my old company basically did this and put it into production.

The is the mentality that plagues the industry, that anything more than a few years old is obsolete, and therefore experience is worthless, and therefore the wheel must be reinvented every time because those old programmers must have been dumb, why would they use SQL otherwise. Why real engineers don't take "software engineers" very seriously (and in turn why software engineers don't take webdevs seriously).

Re: Json-Base – Database built as JSON files

#158

I'm not trying to be a huge asshole here, but this has zero tests and just saves json files to disk. There's literally a full readme and contributors guide but zero tests for something that's supposed to store data for you? For a community that loves it some Jepsen analysis, I can't for the life of me figure out why this has been up-voted so many times. This is just saving JSON file to disk. I'd argue this is harder…

What are you talking about? They have tests right here: https://github.com/Devs-Garden/jsonbase/blob/master/test.js Just uncomment the tests you want to run! Easier than using a testing library IMO.

I can't tell if you're being serious but one of the main features of tests is they are automated. They should be able to run as part of the build.

And just because you're not using a library doesn't mean you shouldn't have assertions. All these "tests" do is log. What do I check the output for?

All you need to do to have a somewhat respectable build is uncomment those tests, make them clean up after themselves, change the console logging to be assertions instead, and make them run on GitHub.

Re: Json-Base – Database built as JSON files

#159
post #49

Earlier quoted context omitted.

I tried. I held a meeting to talk about the code. I found the problems hard to predict and hard to describe. It was decided that after the meeting he would work more on making his code less hacky and more production ready. But the real answer is that our team was very siloed. No one knew what anyone else was doing. The other problem was that he was actually solving real world problems, and he was a very high performe…

It's unfortunate that in this industry, on a lot of teams, "high performer" means "sloppy coder who lets his co-workers finish their project." The problems he encountered with his dumbass solution were EASILY foreseen by an even noob coder. What did he "get done"? How did writing his own shitty version of a database add value to the company? He is good at finishing his own pointless tasks quickly, maybe, but if I was…

My interpretation of this as a manager is that this developer was probably a creative thinker with a decent track record who got stuck going down a bad path on this project, and nobody paid attention or intervened until it was too late. They were also probably pretty junior but perhaps had some past accomplishments that made them appear less likely to make this kind of mistake. Once it was in production, the developer very well may have been "stuck" with it (i.e., unable to get permission to scrap it and redo it, since it was technically working and solved some business problem).

Given the team dynamics and lack of involvement from this person's manager, I wouldn't move to fire them. I'd move to rethink the entire team, admonish the manager, and possibly remove them. The team itself wasn't working, and this was a symptom: someone had a bad idea, pursued it for too long, nobody did enough to stop it, and then they couldn't go back.

This is a classic consequence of a manager who has stopped paying attention to their own team. The team was most likely also overburdened with too many tasks, which is why everyone was working on something separate and independent and nobody knew what anyone else was doing. In reality this developer shouldn't have been given a project like this without being paired with a more senior engineer to supervise it, but that would cut down on the number of story points the team could get through and would thus be discouraged in a dysfunctional environment.

Re: Json-Base – Database built as JSON files

#160

I'm not trying to be a huge asshole here, but this has zero tests and just saves json files to disk. There's literally a full readme and contributors guide but zero tests for something that's supposed to store data for you? For a community that loves it some Jepsen analysis, I can't for the life of me figure out why this has been up-voted so many times. This is just saving JSON file to disk. I'd argue this is harder…

What are you talking about? They have tests right here: https://github.com/Devs-Garden/jsonbase/blob/master/test.js Just uncomment the tests you want to run! Easier than using a testing library IMO.

Come on folks have some humor this is clearly sarcastic.
Post reply on HN