Hacker News new | past | comments | ask | show | jobs | submit | Olap84's comments login

Anyone got tips for working with FSMs in REST and/or MVC? Very rarely do you find HTTP verbs match FSM events leading to a fudge somewhere


You might find it useful to spend some time looking into the hypermedia constraint of REST itself (i.e. hypermedia as the engine of application state). The point of REST is to represent state machines by including hypermedia links in the responses of the API. Those links describe the state transitions a client may invoke in a given state.

Instead then of mapping CRUD operations to HTTP, you would map your application semantics to HTTP methods via link relations. Link relations let you go as far past CRUD as you would like to go depending on your domain and allow you to describe your states and state machine.

I always think a good way to think about a hypermedia state machine is in the context of HTML. Consider a todo app example. You might enter the application and get an empty list of todo items. If you have permissions to add a todo, you might have a "create todo" HTML form. Once you use that form, that todo has a new form called "mark complete." Once invoked, that todo has new transitions called "mark incomplete" or "archive." Once archived, you might see a new form for "unarchive." All of this captures the state machine and transitions in the REST API itself using domain-specific semantics.

Of course, there are other ways of solving this problem, but REST with hypermedia is a great way to work with state machines. There are lots of hypermedia JSON formats out there if you're interested in exploring (e.g. HAL, Siren, Collection+JSON, etc.).


Missed the biggest point which is cognitive overhead. HTTP is simple to understand and it has thrived because of this. What a pain it is to get Wireshark to decode TLS traffic, which is not just cognitive overhead but debugging overhead too.


Very strange to see it signed off with Sláinte. I never thought it used much outside of Scotland


The dead giveaway that you're looking at Irish and not Scottish Gaelic is the accent direction: Irish uses acute accents exclusively, whereas Scottish Gaelic uses grave accents exclusively in its standard orthography (though older variants, and some holdouts still use both acute and grave accents).


Thanks, good to learn the difference. Graves are a pain on UK keyboards though, I propose they switch!


There are complicated reasons why that's unlikely to happen, which go back to why some people still use both grave and acute accents Scottish Gaelic (vowel quality, essentially) and why standardising on the grave accent was a more natural choice for SG.

It's not a huge deal so long as you use an appropriate keyboard map.


It's very common in Ireland.


Movidus is an Irish company not Scottish.



Firefox reader mode did a stellar job on it


Wait, is this satire or not? Does it advocate people don't use frameworks?

Loved the opening paragraph though


It's definitely not a satire. They are some valid points. It's not against using frameworks. I think it's more about finding the right solution for the problem.


What I take from is not to use PHP, which I do as it pays the bills, but why would anyone choose it for a new project baffles me. This article doesn't help it.


I love PHP. It feels like a complete toolbox to me, whereas other languages like Python or Ruby feel like I'm buying an entire Home Depot for every project. Sometimes you need the whole store. Most times I don't.

I think the OP has some good points about reconsidering the standard answers that everyone gives to questions when asked. There are no silver bullets in web, but many things sure are treated like them.

Maybe there are projects where PHP isn't right. There are probably tons. But that doesn't mean that it's always wrong. PHP is what got me into making web things in the first place. I loved (and still love) how utilitarian it can be.

But perhaps that's where I differ from most people. I see myself as someone that makes web stuff. Most seem to see themselves as app creators or system builders. And they probably are. Sure, I do that too when the time comes, but if most of the time I'm building a front-end to a CMS, I'm hardly "engineering" anything. I'm mostly just trying to make specific art for other people.

Anyway, I don't understand why PHP would immediately be ruled out from this article. It feels like the JavaScript of the server-side world to me. Use as little or as much as you want. You can do awful things with it, but also wonderful things.


Well I certainly agree with the right tool for the right job. And PHP has some roles. My point was more about the article, which would, imo, put programmers off PHP with its contrariness and smugness.


aaisp - your life just became simpler.


So there is choice of course.

match returns match data, and sets the $~ variable

=== returns true or false, setting the $~ variable

=~ returns integer (position) or nil, setting $~

The newest one match? returns a boolean, not setting $~


Also, === is the method used in case statement matching.


Will this be the last release before 3? Is there a defined schedule for 3 yet? Or just "When it's done"?


the target ETA for ruby 3 is "this decade" or 2020, as per http://confreaks.tv/videos/rubyconf2015-keynote-and-q-a-matz

so probably no, this won't be the last release before ruby 3.


Firefox reader mode. It fixes the web, and it makes me slightly sad.


I am seriously thinking of making a small web that parses HN and shows the links in a decent way and when clicking something it opens it with automatic styles like Firefox reader mode. The % of decent (as in readable) articles / articles in HN is too low, and Firefox reader mode fixes them all (so far 100% correct for me after years).


Someone already beat you to it: https://hn.premii.com


That is... awesome! thank you so much


The content loads from his API rather than the website itself, and also there is an Android app made by him.

https://play.google.com/store/apps/details?id=com.premii.hn

I have noticed that some websites are actively obfuscating the content on their page to prevent it being loaded by content-viewers (like the website or the app).

I've had to email him to fix an issue in the app and he pushed a change to the Play store fairly quickly.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: