6 ms·
Show HN: I made a command-line Slack chat client
- imothee 11y agoI was building something similar in Go for the exact same reason so looks like there is validation for the product at least! Great work on shipping, incredibly well commented and clean.
- bkanber 11y agoThanks, appreciate it! I considered Go for this too, but wanted to use PHP because you don't see too many curses PHP apps around, and I wanted to observe one for myself ;)
- masukomi 11y agoi was all interested until i saw PHP. That's not a dis on PHP. It's just that PHP is so not the right tool for the job for a command line client. Sure, it appears you can coerce it to do that but... it's designed for embedding in web pages. that's what it's good at. if you want to write command line tools, write them in a language that's actually designed with stuff like that in mind.
- tshadwell 11y agoI'd agree with you, but somehow arcanist manages to be written in PHP.
- masukomi 11y agomany impressive things are written with the wrong / a bad tool. That doesn't mean it's a strategy that should be followed.
- GrinningFool 11y agoOn the other hand, it could just mean that definitions of "the right tool" are more arbitrary than not.
- masukomi 11y agothat sounds harsher than i meant it. My point was more a) use the right tool for the job and b) if you do use the right tool people will be more interested in actually using and supporting it. I can cut down a tree with a belt-sander but trying to convince other people to do the same isn't going to go over well.
- babuskov 11y agoSo, what do you reckon is the right tool this time?
- tonyarkles 11y agoFor me, my go-to tool for stuff like this is Python. It's been a while since I've done an ncurses tool with it though, I'm not sure how painful/unpainful it would be. It's easy to install on Windows, and generally just works out of the box on OSX and Linux.
- bkanber 11y agoI actually intended to write a comment in the README about my choice of language, but as things go, I forgot. This was, first and foremost, an educational pet project for me. I /like/ building things in the wrong language. Hell, I run a blog called "Machine Learning in JavaScript", and I can't tell you the amount of criticism I've gotten over the years along the lines of "wrong tool for the job!". I was actually surprised how well this worked in PHP. The only issue is that the ncurses PHP extension, not being compiled by default in most package managers' PHP distribution, does force you, the user, to take an extra step in installing it. That is unfortunate. That would be a grave issue if I saw this as a product, but since it's a pet project, I see that as totally acceptable :) I actually never even intended to release this publicly!
- aikah 11y ago> I /like/ building things in the wrong language. That's not the issue here. You could have written that in shell script it wouldn't matter. Just that PHP(+ all the extensions required) makes it more difficult to deploy for someone who just want to try out your project.
- deleted 11y ago[deleted]
- babuskov 11y agoThis reminds me of people who say: "JavaScript is designed for embedding in web pages. Node.js developers are crazy too." The Right Tool for the job is not the same for everyone. Unless you can state exact reasons what makes PHP bad and something else a better replacement, this is only PHP-bashing we see on HN all the time. P.S. I wrote many ncurses clients in PHP, C and C++ and did not see much advantage in any of them. Unless there's some special requirement, I'd still pick PHP's duct-tape hashmaps/arrays over anything any other language has to offer.
- ssunstruck 11y agoWhy not use Python then? Its implementation of arrays/dictionaries is much less duct-tapey.
- babuskov 11y agoActually I see PHP's duct-tape interface as an advantage. It allows you to express the data structures and manipulate them in less verbose manner, which results in less code, which is easier to debug and maintain.
- meritt 11y agoIt hooks into ncurses and executes some HTTP requests. It's incredibly simple and you know what? It just works. Virtually any language is suitable for something like this.
- deleted 11y ago[deleted]
- bkanber 11y agoYou're the only person in here who criticized my use of PHP that I actually agree with. I never intended to release this app, and wanted to build it in PHP for fun, so I stuck with it. But you're absolutely right on the portability problem. I do agree that, had deployment been an actual interest of mine, PHP would be the wrong language for this.
- LukeHoersten 11y agoSlack has an IRC backend and IRC has CLI and Curses interfaces you can use (even Emacs interfaces).
- bkanber 11y agoThat's true! But there are two reasons I didn't go that route: 1) I wanted to build this ;) 2) Slack's IRC integration does not mark messages as read until you exit the IRC client. (Granted, mine doesn't mark them as read at all, but -- it _can_!)
- jwise0 11y agoI upvoted this comment because I really like the idea of "I built this because I wanted to". I like the idea of Show HNs as an "I made this thing for me, and not for any other reason". Thanks for posting your project!
- PhasmaFelis 11y agoReminds me of this comic, which I've always thought had something positive to say to engineers: http://wondermark.com/666/ http://wondermark.com/666/
- stephenr 11y agoI love that thank you
- zobzu 11y ago2) is a pretty good point actually, maybe slack could integrate that in their backend - basically if the irc client is set as away do not mark read. if not or returns from away, make all buffers read. Not too hard and would be quite convenient (im not a slack user, but if i become one, id like that in case i log in the webui later..)
- jjawssd 11y agoGood on ya son
- deleted 11y ago[deleted]
- simi_ 11y ago> http://i.imgur.com/pRImcAn.png http://i.imgur.com/pRImcAn.png lol'd
- deleted 11y ago[deleted]
- bkanber 11y ago> command line interfaces should be written in bash, perl, python, go Says whom?
- nodesocket 11y agoBasically, anything that can be compiled into a single binary, or has the least dependencies and best portability.
- bkanber 11y agoRight. Hard to argue with that. But if you're going to say that to me, then you'll also need to tell that to everyone releasing software that gets installed via `npm install -g` or `gem install`, too!
- aikah 11y agoAbsolutely and that's why orgs like Heroku,Github and co are moving all their cli tools to Go.
- xasos 11y agoHow did you like working with PHP for the project? Pros/cons?
- bkanber 11y agoHonestly PHP was a breeze! There's only a couple of things that stood out to me as suboptimal: - PHP ncurses is not well documented beyond just function signatures. Of course, curses itself is well documented, and ncurses functions map one to one with the PHP extension, so that wasn't really that bad. - I should have separated my classes and built a PHAR (PHP archive), but I got lazy. - There's the portability comment I've made a few times already But other than all that, PHP did its job perfectly. Easy to write, read, and organize.
- joshfriend 11y agoDid you know that Slack itself is also written in PHP? https://twitter.com/SlackHQ/status/426469205005705217 https://twitter.com/SlackHQ/status/426469205005705217
- svisser 11y agoNote that this tweet clarifies that P stands for PHP and not Python or Perl: https://twitter.com/SlackHQ/status/499432194398756864 https://twitter.com/SlackHQ/status/499432194398756864