Programming Style–Kendo & jQuery

  • Which of the following do you prefer? shutterstock_76533307
  • Which is easier to read?
  • Which is easier to write?
  • Which is easier to maintain?

 

 var dataItem = this.target().closest(".k-grid").data("kendoGrid").dataSource.getByUid(this.target().closest("tr").data("uid"));

Or…

var dataItem = this.target()
                .closest(".k-grid")
                .data("kendoGrid")
                .dataSource
                .getByUid(this.target().closest("tr").data("uid"));

Or…

 var grid = this.target().closest(".k-grid").data("kendoGrid");
 var dataSrc = grid.dataSource;
 var dataItem = dataSrc.getByUid(this.target().closest("tr").data("uid"));

I’m not convinced the answers are obvious.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in JavaScript, Kendo, Languages, Opinion, Programming and tagged . Bookmark the permalink.

4 Responses to Programming Style–Kendo & jQuery

Comments are closed.