Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

are monads, or more specifically f# computational expressions, a form of aspect oriented programming?

Update:

f# workflow builders have methods other than bind and unit. They have hooks for lots of keywords. see Creating a New Type of Computation Expression.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

To the extent that monads serve to isolate a generalized computation strategy from the specifics of its algorithm or implementation, they can be seen as a basis or theoretical foundation for AOP. I found an interesting paper called Monads as a theoretical foundation for AOP (PDF) that gives this idea a more thorough treatment.

share|improve this answer
    
ugh, am I going to have to learn scheme too? I already feel like I need to learn Haskell just to learn about functional programming. LOL. /end rant –  Charles Lambert May 11 '11 at 22:40
1  
Learning new languages is fun! –  Rein Henrichs May 11 '11 at 22:45
    
After you have the first one down, yes. When you are trying to learn a new programming paradigm, one is enough. I will have to add, functional programming seems more 'natural' to me somehow. I'm starting to get frustrated with c# and what it can't do, the more I work with f#. –  Charles Lambert May 11 '11 at 22:51
    
You only really need to grok the syntax to follow the examples. –  Rein Henrichs May 11 '11 at 23:03
    
well I guess i need to spend an afternoon learning scheme, so i can 'grok the syntax' –  Charles Lambert May 11 '11 at 23:10

for me it somewhat feels a bit like AOP. Classic example in my work is using a "log-Workflow" (better known as a state-monad with the state beeing a log-entry) for loging inside my F#-code to spare me from passing the log-object through every method-call. On the other hand "real" AOP doesn't need you to write log-code inside your methods at all (maybe some attributes). I don't like the "hey I rewrite your code for you"-AOP frameworks so I just use Unity-Injection from time to time (yes I really use Unity - does everything I want from it) and it's ok.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.