Hacker News new | ask | show | jobs
by BufordTJustice 3958 days ago
I feel like using RethinkDB, instead of something like SQLite (or if you absolutely insist on NoSQL, maybe LevelDB or BerkeleyDB) kind of seems like using a supertanker for a tugboat's job. Especially if you're going to write your temperature sensor logger in Python, and it's just being used as an embedded application, SQLite really seems like one of the smarter choices you could make there. Maybe the point is to demo RethinkDB features, but wouldn't it make sense for the Python script to also emit the status data and send notifications as well, without needing all those extra Node dependencies?

Also, maybe I'm just crazy, but man I can't believe people are encouraging others to curl stuff from the internet right into a shell. Especially on Raspian where the default Pi user has NOPASSWD in sudoers, this seems like a bad practice that we shouldn't encourage.

3 comments

> Maybe the point is to demo RethinkDB features,

given that this is the RethinkDB blog, I'm pretty sure that is the point: a nice little toy example to show what it can do.

That said, the node parts probably could have been done in Python as well and made the entire thing a bit easier.

Howdy! Author here.

I definitely wanted to do all parts in Python but am somewhat allergic to the `while True:` pattern necessary in Python for changfeeds. I haven't brought myself up-to-date on the more recent asyncio library to write the more Pythonic `yield from` for a changefeeds example.

Would you know how to do this in Python elegantly? Because I would love to rip out the Node/Javascript parts.

Still, it kind of seems like a blog for Kenworth demoing someone using a giant truck to race around a track, I mean I guess you can do it, but it doesn't seem like the intended application.
Howdy! Author here. I can totally agree that there are definitely more simple methods to logging these sorts of things on a Raspberry Pi, most of all `your_basic_data_in_csv_format.log`.

What I think RethinkDB adds here is the WebUI interface and an easy to way to come to grips with what information is being stored on the machine versus digging around in the home directory, or project folder, or /var/log/ for the right log file (I've come to a consensus with myself many times on where I should put it and definitely forget where). Also, spinning up and replicating the data over to another machine is click-easy and convenient.

As for having the entire functionality in one Python script, it was more of wanting to have à la carte functionality since I know projects like this coming in all shapes and sizes. I definitely agree that from a simplicity point of view, one Python script would be much easier. But, I wanted people to be able to just copypasta what they wanted and go from there with multiple sensors or multiple notification messages.

I also did not like the Node dependencies (why is installing Node on RBPi still so hard?). I felt though that I couldn't get behind doing the un-Pythonic `while True:` pattern necessary for RethinkDB changefeeds. In the near future we'll have better patterns with asyncio but Node felt like a better fit from an elegance/grok-ability standpoint in this case.

Well, I get that this is a RethinkDB blog but I can't help to see this as another example of this "virus" that has gotten hold of some segments of the software development world making for utterly bloated and pointlessly complex solutions to simple problems. I call it the "OOP+Framework 'Hello World'" syndrome. It seems nobody can write code without adding layers of classes, loading-up the call stack and megabytes of libraries.

In this particular case a simple C program logging to a comma-delimited text file, or, if you want to splurge, JSON-formatted text file would have done the job.

But, I get it, proposing not everything requires OOP is heresy. What was I thinking?

"When all you have is a hammer..."