Timeline for What is a proper way to chain instructions if previous one is ok [duplicate]
Current License: CC BY-SA 3.0
21 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 12, 2017 at 7:31 | history | edited | CommunityBot | replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/ | |
| Jun 17, 2015 at 0:46 | history | closed | CommunityBot gnat durron597 | Duplicate of Approaches for checking multiple conditions? [duplicate], When, if ever, should I daisy chain functions? | |
| Jun 12, 2015 at 7:31 | comment | added | Strannch | Thank you @gnat. I should consider more orthogonality and probably apply the return/break solutions. | |
| Jun 11, 2015 at 21:21 | comment | added | gnat | see also: Elegant ways to handle if(if else) else | |
| Jun 11, 2015 at 18:07 | vote | accept | Strannch | ||
| Jun 11, 2015 at 16:15 | answer | added | cmaster - reinstate monica | timeline score: 0 | |
| Jun 11, 2015 at 15:27 | comment | added | Robert Harvey | You don't need to say "UPDATE" and "UPDATE2." Every Stack Exchange post has a detailed edit history that anyone can view. | |
| Jun 11, 2015 at 15:22 | history | edited | Robert Harvey | CC BY-SA 3.0 | deleted 26 characters in body |
| Jun 11, 2015 at 15:07 | comment | added | 9000 | Just in case, there is a library for functional programming in PHP. It includes all the stuff that would be needed for easy chaining of functions that may fail. It would take a certain change of approach in the rest of the code, though. Also related to the problem: Railway-Oriented programming slides. | |
| Jun 11, 2015 at 15:06 | comment | added | Strannch | What do you mean with "For rare errors with no proper local response" ? I thougt of exceptions, but can they be used to pass variables ? | |
| Jun 11, 2015 at 15:00 | history | edited | Strannch | CC BY-SA 3.0 | Give more information about the "//fail" parts |
| Jun 11, 2015 at 14:57 | comment | added | CodesInChaos | For rare errors with no proper local response, apart from aborting the transaction, I'd use exceptions. (e.g. your database error) | |
| Jun 11, 2015 at 14:51 | comment | added | Strannch | Righ now, they just "raise a flag" to say there has been a problem and further in the code, after the if/elses, it rollbacks all changes (transaction rollback with PDO). But then I would like to warn user there has been a problem, write a message (database error ? empty values ? ...) and maybe pass more informations like variables to be displayed. | |
| Jun 11, 2015 at 14:50 | answer | added | gbjbaanb | timeline score: 4 | |
| Jun 11, 2015 at 14:50 | review | Close votes | |||
| Jun 17, 2015 at 0:46 | |||||
| Jun 11, 2015 at 14:37 | comment | added | Gerino | I'd say that it highly depends on the //fail part. For example if it's common to all elses, then maybe just throwing exception from functionN() would be fine? | |
| Jun 11, 2015 at 14:36 | comment | added | Strannch | I use PHP5 and according to google, it doesn't natively support Monads (I didn't really grasp the concept of a Monad though). I'll check it anyway, thanks. | |
| Jun 11, 2015 at 14:32 | comment | added | Carcigenicate | Monads are nice for this; especially the Optional/Maybe monads. If your language supports them, I'd look into these. | |
| Jun 11, 2015 at 14:30 | history | edited | Strannch | CC BY-SA 3.0 | explaining why it is not a duplicate of http://programmers.stackexchange.com/questions/272356/when-if-ever-should-i-daisy-chain-functions |
| Jun 11, 2015 at 14:18 | review | First posts | |||
| Jun 11, 2015 at 16:55 | |||||
| Jun 11, 2015 at 14:16 | history | asked | Strannch | CC BY-SA 3.0 |