I just find from a forum about cascade. The question was what does cascading means in poo. I tried to find to google the answer, also tried to find some other stackoverflow threads about if but I couldn't. I just find this link http://en.wikipedia.org/wiki/Method_cascading
I know what is chaining, I used it, most in javascript, jquery and other languages, but I coundn't understand the difference between chaining and cascading. Can anybody help me? Or can anybody provide some useful links regarding to this?
Chaining is where you return the result of the method call to be used in the next call.
c#
Enumerable.Range(0,10).Skip(1).Aggregate(myList.First(),(result,listItem) => result += listItem));
//results in 45 being returned
Cascading can be implemented by using chaining when this
is returned (making it sometimes tricky to differentiate between the two). jQuery does this.
jquery
$("#myId").css("background-color","blue").fadeIn().fadeOut();
//results in $("#myId") being returned
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With