News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Procurios Tech Blog:
Autocompleting a lot of parameters
October 16, 2013 @ 11:14:05

Pim Elshoff has a recent post on the Procurios tech blog looking at autocompletion on function calls and an alternative to the "too many parameters" problem.

Some methods have many parameters. Sometimes they start out like that, sometimes they grow like that over time. Even though a maximum of two parameters is preferable, configuration for a method that does a big thing is difficult. Take curl for example; curl has a lot of options and so several wrappers around curl have arisen to deal with configuring it in a more humane manner. How can we keep the clutter of many parameters as low as possible, while maintaining autocompletion?

He gives an example of a function that takes too many arguments and how it's difficult to read (and remember the right order/types to give). He does mention one way that's sometimes used - arrays - but you lose typing checks with that. His best recommendation is to use a fluent interface instead. Not only does it make it more readable but it also works with the autocompletion in most IDEs.

0 comments voice your opinion now!
autocomplete parameters suggestion array fluent interface

Link: http://tech.procurios.nl/archief/2013/10/11/Autocompleting-a-lot-of-parameters

blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: Did you think your site validated input properly? Think again!

Maarten Balliauw's Blog: PHPLinq 0.4.0 released on CodePlex!

Stoyan Stefanov: Server-side React with PHP

Sebastian Bergmann\'s Blog: Fluent Interface in PHPUnit 3.0

Sebastian Bergmann\'s Blog: Fluent Interface in PHPUnit 3.0


Community Events





Don't see your event here?
Let us know!


introduction composer library laravel conference symfony language community release series security podcast interview list opinion tool voicesoftheelephpant version artisanfiles framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework