Talk:Fluent interface: Difference between revisions
m Signing comment by 208.91.1.14 - "→JQuery: new section" |
No edit summary |
||
Line 74: | Line 74: | ||
Also, I'd like to echo the above topic's concern. This article doesn't make clear what the requirements for fluent interfaces are, beyond method chaining. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/208.91.1.14|208.91.1.14]] ([[User talk:208.91.1.14|talk]]) 22:11, 27 October 2010 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot--> |
Also, I'd like to echo the above topic's concern. This article doesn't make clear what the requirements for fluent interfaces are, beyond method chaining. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/208.91.1.14|208.91.1.14]] ([[User talk:208.91.1.14|talk]]) 22:11, 27 October 2010 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot--> |
||
Regarding "With C# 3.5 and later there are more advanced method chaining techniques". |
|||
I don't think C# 3.5 exist; there is C# 3.0 and .NET Framework 3.5. Do you agree? --[[User:Mortense|Mortense]] ([[User talk:Mortense|talk]]) 03:09, 17 November 2010 (UTC) |
Revision as of 03:09, 17 November 2010
Computer science Stub‑class | |||||||||||||||||
|
Hello!
1) I tried the c#-Sample, but the compiler alerted 12 Syntax-Errors. Please give a sample with runnable code.
2) The "fluent-interface-benefit" (short intuitive code) is not demonstrated very convincing. I would prefer to see something like:
IConfiguration config = ConfigurationFluent.Create().Color("blue").Height(1).Length(2).Depth(3);
or
IConfiguration config = ConfigurationFluent.CreateColored("blue").Height(1).Length(2).Depth(3);
(Create() or CreateColored() would be static methods, returning a new instance as an "entry-Point" into the fluent interface.
That is no really good Sample too, because c#2008 provides the with-Keyword, so one could instantiate without fluent interface as well:
var config = new Configuration() with { Color = "blue", Height = 1, Length = 2, Depth = 3 };
3) A better sample would result in stuff like:
// List<SpecialItem> _SpecialItems = new List<SpecialItem>();
SpecialItem.CreateColored("blue").Height(1).Length(2).Depth(3).AddTo(_SpecialItems);
That would demonstrate, how fluent interface reduce nesting. Compare to:
// List<SpecialItem> _SpecialItems = new List<SpecialItem>();
_SpecialItems.Add(new SpecialItem() with { Color = "blue", Height = 1, Length = 2, Depth = 3 });
Unfortunately the benefit "help from Intellisense" (a fluent interface supports fluent writing code) cannot be shown in an article, or would you like to add screenshots?
ErfinderDesRades (talk) 11:11, 15 December 2008 (UTC)
IMO the published sample is garbage. Chaining in itself does not make for readability and the ALT.NET community is severely abusing mere chaining with this misunderstanding. There's nothing less readable about
myObject.SetValueX(1);
myObject.SetValueY(2);
than
myObject.SetValueX(1).SetValueY(2);
In my opinion, this actually makes it less readable because these are distinct statements that are being slurred together.
I agree that the samples from ErfinderDesRades are better. Jon (talk) 09:52, 30 September 2009 (UTC)
PHP sample
In the PHP sample, what is this part good for?
<?php
session_start();
error_reporting(E_ALL | E_USER_NOTICE);
require_once 'classes/Loader.php';
require_once 'config.php';
?>
Monad
Shouldn't a reference to monad be included somewhere in this article? Dave Sexton (talk) 08:43, 26 July 2010 (UTC)
Fluent Interface vs Method Chains
The article correctly states that a fluent interface entails more than just method chaining but then goes on to to show examples that solely use Method Chaining. This is misleading. The article and the examples could be improved to reflect a Fluent Interface' role in creating internal DSLs. This would make the distinction more clear. —Preceding unsigned comment added by 87.123.52.156 (talk) 08:46, 22 September 2010 (UTC)
JQuery
Is JQuery considered a fluent interface? If so, it should be referenced in this article.
Also, I'd like to echo the above topic's concern. This article doesn't make clear what the requirements for fluent interfaces are, beyond method chaining. —Preceding unsigned comment added by 208.91.1.14 (talk) 22:11, 27 October 2010 (UTC)
Regarding "With C# 3.5 and later there are more advanced method chaining techniques".
I don't think C# 3.5 exist; there is C# 3.0 and .NET Framework 3.5. Do you agree? --Mortense (talk) 03:09, 17 November 2010 (UTC)