- Which of the following do you prefer?
- 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.
Related
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.
His latest book, .NET MAUI For C# Developers will be released by Packt mid-April of 2023.
Liberty is a Senior SW Engineer for CNH Industrial and 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.
4 Responses to Programming Style–Kendo & jQuery