documented alternative to fluent-style API - Ideas & Feature Requests - Ideas & Feature Requests - Progress Community
 Ideas & Feature Requests

documented alternative to fluent-style API

  • documented alternative to fluent-style API
  • I'm not sure about you guys, but I really hate code like this:
    01.    sf.Documents().GetManager().Provider.SuppressSecurityChecks = true;
    02.    sf.Document().CreateNew().Do(item =>
    04.            item.Parent = sf.DocumentLibraries().Where(l => l.Title == "JobApplications").Get().FirstOrDefault();
    05.            item.Title = title; item.UrlName = title + "_Application";
    06.            item.SetValue("FirstName", firstName);
    07.            item.SetValue("LastName", lastName);
    08.            item.SetValue("Phone", phone);
    09.            item.SetValue("HowDidYouHear", howDidYouHear);
    10.        ).CheckOut().UploadContent(applicationFile.InputStream, applicationFile.GetExtension()).CheckInAndPublish();

    There are all sorts of drawbacks to this sort of code. Not the least of which is that it's not clear when you've made all the necessary calls and in what order. There's no intellisense support when you get down into the later code bits, and it's just verbose() with() lots() of() unnecessary() parenthesis()!!!

    It's like writing in nothing but run-on sentences and expecting your teacher to give a good grade because its short and dense and efficient and maybe you think it looks nicer but it's a lot harder to read because there's no separation of thought.
  • I guess in a lot of places, the developer documentation does have both examples. Just please make sure that you keep this practice.
  • Hi Eric,

    Thank you for the remark.

    We will keep providing both Fluent API and Native API examples. We will also try to explain the Fluent API as clearer as possible so that it is easy to understand how it is used and what are its advantages.

    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items