Code Monkey home page Code Monkey logo

articles's People

Contributors

fulldecent avatar hpique avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

articles's Issues

Performance is not confirmed

It is stated:

When performance is a concern, better to use nil as a default value.

There is no proof presented that not executing a nil closure is faster than executing an empty closure.

If such proof does not exist, a better statement might be:

If parts of the function may be skipped when closures are not provided then it is better to use nil as a default value.

Others using this recommendation

Thank you for sharing this recommendation:

https://github.com/hpique/Articles/blob/master/Swift/Style%20guide%20for%20functions%20with%20closure%20parameters/Style%20guide%20for%20functions%20with%20closure%20parameters.md

I use lots of onSuccess / onFailure blocks in my network code and it was good to find this analysis.

Unfortunately, an important part of style is: how is everyone else expected to interpret this? May I recommend inclusion of any well known examples in the wild which are currently using this prescribed style.

Fetch image is a poor example

In https://github.com/hpique/Articles/blob/master/Swift/Style%20guide%20for%20functions%20with%20closure%20parameters/Style%20guide%20for%20functions%20with%20closure%20parameters.md

Fetching an image is a poor example of an action which you would react to neither upon success nor failure. A better example may be posting an update or sending a ping.

Also, the example seems contrived when there is a check for success == nil && failure == nil for posting an image. A real world application would never do this.

Updated past Xcode 6.1 Beta 2

The page is written for "Xcode 6.1 Beta 2".

New versions of Swift have since been released and the information may not be accurate anymore.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.