paradigms

Mixins vs. Traits

喜你入骨 提交于 2019-11-26 17:54:39
问题 What is the difference between Mixins and Traits? According to Wikipedia, Ruby Modules are sort of like traits. How so? 回答1: Mixins may contain state, (traditional) traits don't. Mixins use "implicit conflict resolution", traits use "explicit conflict resolution" Mixins depends on linearization, traits are flattened. Lecture about traits ad 1. In mixins you can define instance variables. Traits do not allow this. The state must be provided by composing class (=class using the traits) ad 2.

What is the difference between declarative and imperative programming? [closed]

放肆的年华 提交于 2019-11-26 15:34:15
I have been searching the web looking for a definition for declarative and imperative programming that would shed some light for me. However, the language used at some of the resources that I have found is daunting - for instance at Wikipedia . Does anyone have a real-world example that they could show me that might bring some perspective to this subject (perhaps in C#)? A great C# example of declarative vs. imperative programming is LINQ. With imperative programming, you tell the compiler what you want to happen, step by step. For example, let's start with this collection, and choose the odd

OOP vs Functional Programming vs Procedural [closed]

安稳与你 提交于 2019-11-26 14:48:06
What are the differences between these programming paradigms, and are they better suited to particular problems or do any use-cases favour one over the others? Architecture examples appreciated! greyfade All of them are good in their own ways - They're simply different approaches to the same problems. In a purely procedural style, data tends to be highly decoupled from the functions that operate on it. In an object oriented style, data tends to carry with it a collection of functions. In a functional style, data and functions tend toward having more in common with each other (as in Lisp and

Functional, Declarative, and Imperative Programming [closed]

让人想犯罪 __ 提交于 2019-11-26 11:27:12
What do the terms functional, declarative, and imperative programming mean? Shelby Moore III At the time of writing this, the top voted answers on this page are imprecise and muddled on the declarative vs. imperative definition, including the answer that quotes Wikipedia. Some answers are conflating the terms in different ways. Refer also to my explanation of why spreadsheet programming is declarative, regardless that the formulas mutate the cells. Also, several answers claim that functional programming must be a subset of declarative. On that point it depends if we differentiate "function"

Understanding MVC: Whats the concept of “Fat” on models, “Skinny” on controllers?

六月ゝ 毕业季﹏ 提交于 2019-11-26 09:23:50
问题 I\'m trying to understand the concept of \"Fat\" on models vs \"skinny\" on controllers and from what I\'ve been discussing I have the following example (this is taken from a freenode discussion): Q: On MVC paradigm, its said Fat models, skinny controllers. I\'m here thinking, If I have lots of methods (on controller) that uses just a few abstract methods to CRUD (on model), am I creating a fat controller instead of a model ? Or they say, fat model, refearing in what is returned and not typed

Functional programming and non-functional programming

浪子不回头ぞ 提交于 2019-11-26 09:14:57
问题 In my second year of University we were \"taught\" Haskell, I know almost nothing about it and even less about functional programming. What is functional programming, why and/xor where would I want to use it instead of non-functional programming and am I correct in thinking that C is a non-functional programming language? 回答1: One key feature in a functional language is the concept of first-class functions. The idea is that you can pass functions as parameters to other functions and return

Aspect Oriented Programming vs. Object-Oriented Programming

China☆狼群 提交于 2019-11-26 08:38:49
问题 Like most developers here and in the entire world, I have been developing software systems using object-oriented programming (OOP) techniques for many years. So when I read that aspect-oriented programming (AOP) addresses many of the problems that traditional OOP doesn\'t solve completely or directly, I pause and think, is it real? I have read a lot of information trying to learn the keys of this AOP paradigm and I´m in the same place, so, I wanted to better understand its benefits in real

What is the difference between procedural programming and functional programming? [closed]

隐身守侯 提交于 2019-11-26 07:50:28
问题 I\'ve read the Wikipedia articles for both procedural programming and functional programming, but I\'m still slightly confused. Could someone boil it down to the core? 回答1: A functional language (ideally) allows you to write a mathematical function, i.e. a function that takes n arguments and returns a value. If the program is executed, this function is logically evaluated as needed. 1 A procedural language, on the other hand, performs a series of sequential steps. (There's a way of

Double-checked locking in .NET

左心房为你撑大大i 提交于 2019-11-26 04:20:03
I came across this article discussing why the double-check locking paradigm is broken in Java. Is the paradigm valid for .NET (in particular, C#), if variables are declared volatile ? Cameron MacFarland Implementing the Singleton Pattern in C# talks about this problem in the third version. It says: Making the instance variable volatile can make it work, as would explicit memory barrier calls, although in the latter case even experts can't agree exactly which barriers are required. I tend to try to avoid situations where experts don't agree what's right and what's wrong! The author seems to

What is aspect-oriented programming?

。_饼干妹妹 提交于 2019-11-26 04:03:11
问题 I understand object oriented programming, and have been writing OO programs for a long time. People seem to talk about aspect-oriented programming, but I\'ve never really learned what it is or how to use it. What is the basic paradigm? This question is related, but doesn\'t quite ask it: Aspect-Oriented Programming vs. Object Oriented Programming 回答1: AOP addresses the problem of cross-cutting concerns , which would be any kind of code that is repeated in different methods and can't normally