Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move -debugDescription implementation to -description method for improved debugability #107

Merged
merged 2 commits into from
Feb 29, 2016

Conversation

rastersize
Copy link
Contributor

This PR moves the -debugDescription implementation to the -description method instead. The reasoning being that it makes debugging easier if a request or response object is logged instead of printed using the debugger.

Also aligns the format with Apple’s standard (<ClassName: 0xDEADBEEF property-1 = "string value"; property-2 = 42>).

@spotify/objc-dev

@rastersize rastersize changed the title Change debugdescription to just description Move -debugDescription implementation to -description method for improved debugability Feb 29, 2016
@8W9aG
Copy link
Contributor

8W9aG commented Feb 29, 2016

👍

@ChocoChipset
Copy link
Contributor

Why not both? If we log these objects we will use -description, but we might still want to po individual objects in the console.

I would suggest returning the -description string from -debugDescription.

Note: I'm assuming the default implementation of -debugDescription just prints the object and its address.

@rastersize
Copy link
Contributor Author

@iOSCowboy: This will work with po in the debugger as well. Unless we want to output something extra, or special, when printed from the debugger all that’s needed it so implement -description. See the documentation for -[NSObject debugDescription]:

- debugDescription
Returns a string that describes the contents of the receiver for presentation in the debugger.

NSObject implements this method by calling through to the description method. Thus, by default, an object’s debug description is the same as its description. However, you can override debugDescription if you want to decouple these.

https://developer.apple.com/…/NSObject/debugDescription

rastersize added a commit that referenced this pull request Feb 29, 2016
…description

Move -debugDescription implementation to -description method for improved debugability
@rastersize rastersize merged commit a572b33 into master Feb 29, 2016
@rastersize rastersize deleted the change-debugdescription-to-just-description branch February 29, 2016 16:53
@ChocoChipset
Copy link
Contributor

Perfect! Thanks for the note, @rastersize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants