These days to move a logic from the server to the client, basically is to translate JS into OC. Direct contrast, obviously feel OC is too rotten (for the language itself, iOS app framework does not do)
For example, the following line of JS code:
var Monthtag = bill_year + "-" + bill_month;
After being written as OC, it is very obscure. Of course, with nsmutablestring can have a append method, but the degree of nausea is similar:
NSString *monthtag = [NSString stringwithformat:@ "%@-%@", [NSString stringwithformat:@ "%d", billyear], [NSString stringwithformat:@ "%d", Billmonth]];
Another example is the following line:
Data[tag].total + = Bill.amount;
More unbearable to look directly at:
Nsmutabledictionary *content = [data objectforkey:tag];float total = [[content objectforkey:@ ' total '] floatvalue];float Amount = [[Bill objectforkey:@ "Amount"] floatvalue];total + = amount; [Content Setobject:[nsnumber Numberwithint:total] forkey:@ "Total";
Simply think, OC is difficult to use mainly for several reasons:
1, strong type, and implicit type conversion is not developed, need the programmer to handle
2, a variety of API design is not convenient. Array is still passable, when handling dictionary, very painful. In fact, the programming experience is poor every time we process Nsstring,nsdate,nscalendar.
3, does not support closures (except block), so if you want to split the function, either to pass the parameter, or to define the variable staging, and JS's scope chain is very convenient
Including iOS framework, I feel there are some very poor design, such as: Before IOS8, uialertviewdelegate need to be based on the tag to distinguish multiple alertview, but also through the index to distinguish the button click. By the IOS8, Uialertcontroller was a little better.
To tell the truth, I feel that OC should have left the stage of history if it hadn't been for the Apple hood. Perhaps Apple itself is aware of the problem, and Swift may have improved
Tween: objective-c anti-human