What are good tactics to do function extraction in Objective-C to create clean code? -


In the book, the author has advised to break big tasks into small functions, which do a specific thing in languages ​​like Java It translates beautiful, readable code.

  public static string renderpage (page data pageadata) {included header (page data); IncludeContent (pageData); IncludeFooter (pageData); Return page Data.getHtml (); }  

In the Objective-C, as far as I know that the only way to implement such actions is to create personal methods and send them the message self

  - (NSString *) renderPageWithData: (Page_Data *) pageata {(manually included: page data); [Insert yourself: pageadata]; [Self contained footer: pagedata]; Return [pdata html]; }  

I feel like a message self Operation means that the object is doing itself; the C function is not really an option because Do not fall within the class. Which means that I can not access any instance variable or class object extra parallel and add complexity.

I'm looking for a good way to create a clean code in relation to the work or methods I'm looking at your point about function calls: self

And in the same "sentence" include see if things are being included in self, I resolve it with the names of more explicit method:

  - (NSString *) render page videadata: (pagerata *) pagedata {[self-render header data: padata ]; [Data with self-render content: page data]; [Self-renderer withdata: padata]; Return [pdata html]; }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -