paradigms

Pitfalls/Disadvantages of Functional Programming [closed]

﹥>﹥吖頭↗ 提交于 2019-11-29 18:42:54
When would you NOT want to use functional programming? What is it not so good at? I am more looking for disadvantages of the paradigm as a whole, not things like "not widely used", or "no good debugger available". Those answers may be correct as of now, but they deal with FP being a new concept (an unavoidable issue) and not any inherent qualities. Related: advantages of functional programming Why hasn't functional programming taken over yet? It's hard for me to think of many downsides to functional programming. Then again, I am a former chair of the International Conference on Functional

Any research on maintainability of “guard statement” vs. “single function exit point” paradigm available?

亡梦爱人 提交于 2019-11-29 08:28:44
问题 I'm wondering if there has been any research (both casual and robust) on the maintainability of projects that use the "guard statement" paradigm vs. the "single function exit point" paradigm? Guard statement example (in C#): string GetSomeString() { if(necessaryConditionFails) { return null; } if(!FunctionWithBoolReturn(someAttribute)) { return null; } //all necessary conditions have been met //do regular processing... return finalStringValue; } single function exit point example (in C#):

What is the difference between a Char Array and a String?

妖精的绣舞 提交于 2019-11-29 05:40:00
Spending my time on high level languages it suddenly occurred to me that I did not know the difference between a Char Array and a String. I think they are the same thing but not sure. Is there a difference? Is it just a Char Array with some abstraction? a character array is simply an array of characters a string is data structure that uses an array of characters some string representations use a null-terminator (like C), others use a length prefix A String is an abstraction, but of a sequence of characters. It says nothing of implementation. If you wanted to create a String implementation

Do you use AOP (Aspect Oriented Programming) in production software?

依然范特西╮ 提交于 2019-11-28 16:41:09
AOP is an interesting programming paradigm in my opinion. However, there haven't been discussions about it yet here on stackoverflow (at least I couldn't find them). What do you think about it in general? Do you use AOP in your projects? Or do you think it's rather a niche technology that won't be around for a long time or won't make it into the mainstream (like OOP did, at least in theory ;))? If you do use AOP then please let us know which tools you use as well. Thanks! Yes. Orthogonal concerns, like security, are best done with AOP-style interception. Whether that is done automatically

Flow Based Programming

时光毁灭记忆、已成空白 提交于 2019-11-28 15:25:48
I have been doing a little reading on Flow Based Programming over the last few days. There is a wiki which provides further detail. And wikipedia has a good overview on it too. My first thought was, "Great another proponent of lego-land pretend programming" - a concept harking back to the late 80's. But, as I read more, I must admit I have become intrigued. Have you used FBP for a real project? What is your opinion of FBP? Does FBP have a future? In some senses, it seems like the holy grail of reuse that our industry has pursued since the advent of procedural languages. Paul Morrison

Are FP and OO orthogonal?

匆匆过客 提交于 2019-11-28 15:14:37
I have heard this time and again, and I am trying to understand and validate the idea that FP and OO are orthogonal. First of all, what does it mean for 2 concepts to be orthogonal? FP encourages immutability and purity as much as possible, while OO seems built for state and mutation – a slightly organized version of imperative programming? I realize that objects can be immutable, but OO seems to imply state/change to me. They seem like opposites. How does that affect their orthogonality? A language like Scala makes it easy to do OO and FP both, does this affect the orthogonality of the two

How do functional programming languages work?

柔情痞子 提交于 2019-11-28 15:00:41
If functional programming languages cannot save any state, how do they do simple stuff like reading input from a user? How do they "store" the input (or store any data for that matter?) For example: how would this simple C thing translate to a functional programming language like Haskell? #include<stdio.h> int main() { int no; scanf("%d",&no); return 0; } (My question was inspired by this excellent post: "Execution in the Kingdom of Nouns" . Reading it gave me some better understanding of what exactly object oriented programming is, how Java implements it in one extreme manner, and how

Pitfalls/Disadvantages of Functional Programming [closed]

大憨熊 提交于 2019-11-28 13:27:24
问题 When would you NOT want to use functional programming? What is it not so good at? I am more looking for disadvantages of the paradigm as a whole, not things like "not widely used", or "no good debugger available". Those answers may be correct as of now, but they deal with FP being a new concept (an unavoidable issue) and not any inherent qualities. Related: advantages of functional programming Why hasn't functional programming taken over yet? 回答1: It's hard for me to think of many downsides

Practical uses of OOP

你说的曾经没有我的故事 提交于 2019-11-28 03:37:35
问题 I recently had a debate with a colleague who is not a fan of OOP. What took my attention was what he said: "What's the point of doing my coding in objects? If it's reuse then I can just create a library and call whatever functions I need for whatever task is at hand. Do I need these concepts of polymorphism, inheritance, interfaces, patterns or whatever?" We are in a small company developing small projects for e-commerce sites and real estate. How can I take advantage of OOP in an "everyday,

PHP IF statement for Boolean values: $var === true vs $var

点点圈 提交于 2019-11-27 22:45:21
I know this question is not really important.. however I've been wondering: Which of the following IF statements is the best and fastest to use? <?php $variable = true; if($variable === true) { //Something } if($variable) { // Something } ?> I know === is to match exactly the boolean value. However is there really any improvement? Using if ($var === true) or if ($var) is not a question of style but a question of correctness. Because if ($var) is the same as if ($var == true) . And == comparison doesn’t check the type. So 1 == true is true but 1 === true is false. dan_nl As far as speed, I