RxSwift icon indicating copy to clipboard operation
RxSwift copied to clipboard

Change "rx_text" by "rxText"

Open TofPlay opened this issue 10 years ago • 8 comments

Hi, You do not follow Apple Coding Standard or the Swift API Design Guidelines For example a property like rx_text must be replace by rxText

TofPlay avatar Apr 24 '16 19:04 TofPlay

hey @TofPlay, this is a port of a multi-platform library, it is uniform between many different languages

icanzilb avatar Apr 24 '16 19:04 icanzilb

I believe it's done this way because it's basically an Objective-C API (although the code is written in Swift). rx_text is an extension to Objective-C class, which is why it's in the RxCocoa sub project. This style of prefix is common among ObjC libraries that extend the original class.

It's not really a Swift API

taonos avatar Apr 24 '16 19:04 taonos

@icanzilb Swift is also a multi-platform language and if you want to create a library for Swift you must follow the Swift API Design Guidelines

TofPlay avatar Apr 24 '16 20:04 TofPlay

I must??? 😂 I'll just leave it to the repo owner to decide what to do here

icanzilb avatar Apr 24 '16 20:04 icanzilb

Hi guys,

The previous discussion was recorded here https://github.com/ReactiveX/RxSwift/issues/82

We always try to follow guidelines, but this library was released before those guidelines were published and Apple keeps changing them.

I haven't find anywhere where Swift design guidelines speak specifically about extension rules. If I have missed them, please let me know, so we can consider this for 3.0.

Extensions are convenient, but ambiguity and naming collisions are a serious issue. Partially because of ObjC legacy, and partially because it probably hasn't been considered by Swift team or I've missed that part where it has been discussed :)

kzaher avatar Apr 24 '16 20:04 kzaher

@icanzilb I speak about library for Swift in general 😄
Swift is very popular. Right now many library are written for this language. And unfortunately when the developer of the library before developing in Ruby, PHP or any others languages often he will apply the conventions of these languages in Swift. When we want to use theses libraries in our applications... it's not look good. The consequence is that it's confusing and it requires more effort to maintain our applications. From my side to avoid this issue I do not use libraries that do not follow the Swift conventions and Apple conventions for iOS and OS X applications.

@kzaher I know it's not easy because Swift continue to evolve. But you can follow this process: First check the Swift API Design Guidelines. If you don't found any useful information check the Apple Coding Standard. And if you do not find the answer check how Apple design their own APIs. If the APIs of the library looks like Apple APIs developers use it more naturally. 😉 It's all about consistency 😄

TofPlay avatar Apr 25 '16 06:04 TofPlay

Hi @TofPlay ,

Please correct me if I'm wrong about this.

I think you've maybe misunderstood what does that rx represent and why it is there.

It is not part of method description or parameter name.

Apple doesn't design third part libraries that extend their APIs so Apple doesn't have this problem.

If you could point me specifically to a part of documentation that talks about these problems or paste me those parts, that would be helpful.

The guidelines evolve over time, and Apple is conflicting their own guidelines right now. Yes Swift will evolve, but it's currently breaking Cocoa conventions. So I would argue that what ever conventions you are following, you are breaking the other ones, but this doesn't bring anything constructive to the table.

I think it's fair for people to create their own opinions and use what ever libraries they chose for what ever reason they chose. I would agree that having consistency is wanted property.

Maybe this is a part of language barriers, but I personally find the tone of the initial message and title disrespectful

Change "rx_text" by "rxText" Hi, You do not follow Apple Coding Standard or the Swift API Design Guidelines For example a property like rx_text must be replace by rxText

If I was trying to constructively suggest a change to some project, a more proper way would be to first try to understand why was that tradeoff to chose rx_ prefix been made, and then try to bring some novel arguments.

kzaher avatar Apr 26 '16 09:04 kzaher

Hi @kzaher

Maybe this is a part of language barriers, but I personally find the tone of the initial message and title disrespectful

I am really sorry you have felt this way about my first post. It was not my goal. I spent some time to evaluate and play with RxSwift and I just mention what I observe. Nothing less nothing more. RxSwift provides a different way to develop applications. One of my task is to evaluate objectively whether it can be interesting for our projects. See what the impact is. I'm doing this for all the libraries not only for RxSwift. What is important for me it's the whole project. I usually do not get involved in the libraries development. I would love to but unfortunately I do not have time for that. Just take my first post as an advice.

TofPlay avatar Apr 26 '16 13:04 TofPlay