Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coding Priorities: Performance, Maintainability, Reusability?

This came about mainly due to answers to SQL questions. UDF's and Sub Queries are intentionally omitted because of performance. I didn't include reliability not that it should be taken for granted, but the code has to work.

Does performance always come first? So many answers are provided with performance as the main priority. My users seem to be more concerned with how quickly the code can be modified. So a report takes 15 seconds instead of 12 to run. They can live with that as long as I'm not making excuses for not providing solutions.

Obviously if the 15 seconds turns into 15 minutes, there is an issue, but users want the functionality. They want the application to adapt with the business rule changes and enhancement requests. I want to be able to look at the code 6 months from now and be able to make the change in one easily identified spot and not chase down all those places soneone copied and pasted code because they thought calling another function or sub routine or Udf would hinder performance.

All that being said, I would order: Maintainability (Change is a fact of life.), Performance (No one likes to stare at the hourglass.), Reusability (Difficult to determine what code should be used again.).

like image 437
JeffO Avatar asked Feb 07 '09 05:02

JeffO


People also ask

What is maintainability in coding?

Code maintainability is a capability that requires organization-wide coordination, since it relies on being able to search, reuse, and change other teams' code. Managing dependencies effectively is often a major source of pain when working with large codebases and large organizations.

What are code quality metrics?

Code quality metrics are a number of variables used to measure and determine if code is of high quality. Teams can then use those metrics for code review for changes, test coverage, and other actionable insights. Variables such as code complexity, portability, security, clarity, reusability, and others.

What are all the Ilities?

The top four ilities are, in order, quality, reliability, safety, and flexibility.


1 Answers

1. Maintainability: If the code is un-readable it's useless, no matter how fast it is. And it definitely won't be be re-used.

2. Reusability: Not all code is reusable, but a lot of it is. If you can, by all means make your code simpler. The easiest is divide and conquer. For example, create simple components you'll use over and over and over. UI widgets are the most common. But it's the same with utilities. As well, creating a structure/framework to your code helps. Error validation code, etc.

3. Performance: Generally most code is performant enough. And if not, use a code profiler. More often than the bottleneck will far outweigh any small code optimizations you could have made at the cost of either readability or re-useability.

like image 171
Stephane Grenier Avatar answered Oct 31 '22 11:10

Stephane Grenier