[swift-evolution] [swift-evolution-announce] [Review] SE-0023 API Design Guidelines

Rob Mayoff mayoff at dqd.com
Fri Jan 22 22:59:26 CST 2016

> Where this rule feels clumsy to me is in code such as
> func loginWithUsername(username: String, password: String) -> Bool
> vs.
> func login(username: String, password: String) -> Bool
> But maybe it just takes some time to get used to the style.

You're right that loginWithUsername is clumsy, since the first argument is
probably an expression like "username" or "usernameField.text" or somesuch.
But I would much prefer

    func loginAs(username: String, password: String) -> Bool

because it reads like something I'd actually say. Consider telling a
coworker "log in as 'mayoff', password 'bikeshed'".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160122/b4018230/attachment.html>

More information about the swift-evolution mailing list