Environments/language choices


  • SockDev

    Hey folks, looking for a bit of advice on this one.

    Looking to build a web service of sorts. Will need to serve some static files, and handle dynamic endpoints. The backend is nothing special, it's largely a straight-forward CRUD application, and I don't need to worry about performance for the most part. The real work of the website will be in the JS/AJAX interface that consumes the web service, meaning that the backend is largely uncoupled from the front end.

    Ordinarily I'd build this in PHP because it's not exactly the most difficult thing but I want to do it in something that isn't PHP for once, mostly due to the clusterfuck that is the PHP frameworks. I was going to do it with Laravel but given the hours already burned just trying to install the dev environment, I figured I'd give it all a miss.

    It's a hobby project so there's no time budget or pressure and I'd like to learn something new for a change. Ideally something I can drop onto a $5 Digital Ocean droplet in the future, or maybe the $10 one.

    Thoughts and suggestions gratefully received πŸ˜„


  • SockDev

    <Recruitment org="SockDrawer">

    You are a veteran of WTFPHP, as such can i interest you in NodeJS?

    </Recruitment>


  • SockDev

    I'm a veteran of both WTF and PHP, the two are not mutually exclusive πŸ˜›

    I did look at Node a few years ago and the entire thing felt like I was building it on sand - and lots and lots and lots of callbacks because the operations I was trying to handle were essentially a series of operations that couldn't really be handled out of order. I think I stopped after hitting 12 nested callbacks 😦

    Maybe it's gotten better or maybe if I looked again I'd realise I was doing it wrong. Maybe I should check out SockDrawer and see if it was me Doing It Wrong...

    At this point, though, I wouldn't even rule out something like RoR... *shudder*


  • SockDev

    @Arantor said:

    Maybe I should check out SockDrawer and see if it was me Doing It Wrong...

    I'd suggest avoiding using the SockSite project as a model for how to do it..... I implemented that as one giant WTF.

    It's on my list to revisit to make it better.

    If you go the node route let me know and i'll be happy to help with your project. I'm told i make an excelent sounding board!



  • There's C# - you can run web apis in self-host mode on top of mono. I've never done it before, but it's definitely a possibility. No idea if it would be something you can put in a droplet though.


  • Winner of the 2016 Presidential Election

    @accalia said:

    I'd suggest avoiding using the SockSite project as a model for how to do it..... I implemented that as one giant WTF.

    QFT.
    Why do you think I haven't done anything for discopaedia.org?


  • SockDev

    @sloosecannon said:

    QFT.Why do you think I haven't done anything for discopaedia.org?

    yeah.... i know...

    i really should have done a better job ther, but i was in a groove, and it was late at night, i may or may not have had a little rum and coke....

    i really should have started with a good web framework like express and just done a proper job of it, it's not like it was that complicated!

    tell you what, after i get v2.11 of @sockbot out the door i'll go back and do a proper job of SockSite.



  • @‍accalia has summoned me, and so I appear.

    <!-- SockBot/2.10.2 (Bewitching Burlap; owner:accalia; user:sockbot) 2015-08-31T19:14:29.925Z -->

  • Winner of the 2016 Presidential Election

    Python+Flask would be my first choice for a simple backend


  • SockDev

    Looks like it might be doable to run Mono on DO but it's a lot of messing about from what I can tell, but will bear that one in mind πŸ˜„


  • SockDev

    Honestly with SockSite it looks like I at least can follow the basics of what it's doing - something I can't really do with Sockbot, because I looked at the repo and tried to have some semblance of 'wtf is going on here'.


  • SockDev

    Haven't done Python in years, never seen Flask before, thanks for the suggestion πŸ˜„


  • SockDev

    @asdf said:

    Python+Flask would be my first choice for a simple backend

    a good choice, but lacking that subtle WTF factor of doing javascript serverside.


  • SockDev

    @Arantor said:

    Honestly with SockSite it looks like I at least can follow the basics of what it's doing

    that's true. it's not a pretty architecture, and it's painful to develop in and i should totally have done better there, but at least it's easyish to follow what's happening.

    @Arantor said:

    something I can't really do with Sockbot, because I looked at the repo and tried to have some semblance of 'wtf is going on here'.

    yeah. there are two things that aren't helping there, one is the code is ES6 code which looks a lot different than ES5 code,

    the other thing is it's dealing with the fustercluck that is the discourse JSON api and trying to sanitize it for the plugins.

    unless you're talking about the legacy 0.xx releases which suffer from even worse design than SockSite!


  • SockDev

    I'll be writing enough JS for the front end that I won't want to write more than I have to.

    And yeah, I can tell dealing with the DC API is a clusterfucky world of pain, like using it is generally.

    I was looking at the current versions in the repos, and I have to say, JS is not my favourite language, I'm still not sure what's new and magical in ES6 to be honest, not like I've had time to study it 😦


  • Grade A Premium Asshole

    Why not give Ruby/Rails a try?


  • SockDev

    @Arantor said:

    And yeah, I can tell dealing with the DC API is a clusterfucky world of pain, like using it is generally

    yeah it is. that's part of why SockBot does as much as it can to insulate the plugins from that.

    @Arantor said:

    JS is not my favourite language

    fair, i won't call you out on that.

    @Arantor said:

    I'm still not sure what's new and magical in ES6 to be honest, not like I've had time to study it

    there are a lot fo nice features: http://es6-features.org/

    the features i went to it for with SockBot were:

    and

    also it's coming and i wanted to learn.


  • SockDev

    @Polygeekery said:

    Why not give Ruby/Rails a try?

    do not want!


  • SockDev

    Unfortunately given that part of the site will be spending its time doing evil with LocalStorage, with the server part being merely a repository of sorts for content and sync purposes, I will have to deal with JS a lot 😦 DO NOT LIKE

    ES6 looks like it has some interesting fun things coming, which is neat.

    Have been reading up on Python/Flask and RoR... Flask is currently winning that particular race and Node is in a close third place right now.



  • @Arantor said:

    Have been reading up on Python/Flask and RoR... Flask is currently winning that particular race and Node is in a close third place right now.

    I'm doing both node.js/express and python/flask ATM. IMO if you want a simple no-hassle web API, go with node.

    I found python to be pain in the ass when it comes to JSON handling. You have to decompose everything down to nested dictionaries and/or objects, can't just do JSON.parse() and have your object exactly as you had it in browser. Then just throw it into Mongo or whatever simple store you're using. Maybe a more experienced dev would have found a better solution, but as a relative python noob, I found myself pining for node all the time.

    Also, there's the whole fuckup with python 2/3 split. It'd make sense to brush up on Python 3 in a greenfield project. However, flask is ATM only officially supported for Python 2. So, it's annoying either way.

    Finally, you can use this as an opportunity to get into ES6, which will serve you well in your future frontend work as well.

    The other option I can sort of speak about is Ruby + Sinatra (not Rails), It's a neat little framework, inspiration for both .NET WebAPI and Flask. If you want to get into ruby, this is a solid choice. I wouldn't. Ruby seems to be losing steam lately.

    You can also look into Go (ask @benlubar about that) and Elixir + Phoenix, if you want the freaking bleeding edge, hot off hacker news. I guess java guys can recommend whatever lightweight-y thing they have too.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.