Git Product home page Git Product logo

sharpen's Introduction

Sharpen

Sharpen is a Visual Studio extension that intelligently introduces new C# language features into your existing code base. It makes your code smaller, simpler, faster, more expressive and more readable, in one word - sharper.

Twitter Visual Studio Marketplace AppVeyor GitHub release License

About

Sharpen uses static code analysis to identify places in your code that will benefit of introducing new C# language features. The fact that a new language feature can be used at a certain place in code, does not mean that it should be used. Sharpen helps you make an informed decision by providing both positive and negative recommendations. Once your decision is made, Sharpen can refactor your code on an arbitrary scale: single place in code, single file, or a whole project, or solution.

An image is worth a thousand words, therefore:

Sharpen in action

You can install Sharpen from the Visual Studio marketplace.

The below chapters describe in more detail the major benefits of Sharpen.

Faster Learning of New Language Features

C# is a fast evolving language. This fast evolution and short release cycles make it difficult to keep pace with new language features, no matter how exciting and useful they are. Over the years I gave numerous talks and workshops on new C# language features. I learned that the best way to understand and adopt a language feature is to meaningfully apply it to an existing code base, whenever possible. The word meaningfully plays a major role here. Simplified, artificial code samples often used to introduce new language features lack a meaningful context around them. This makes the features harder to stick and could in worst case end up in using them blindly and non-critically.

Sharpen comes with an extensive documentation on C# language features. At the same time, it points to places in real-life production code, your code!, where those features should and should not be used. It puts new C# language features in a meaningful context. This speeds up the learning process. It also helps to develop critical and balanced view on new language features.

Sharpen puts new C# language features in a meaningful context.

Critical Usage of New Language Features

Turning a perfectly readable and easy understandable nested foreach loop into a single 400-character-long line of incomprehensible LINQ is not the best way to utilize LINQ. Yet I witnessed it many times when recommendations coming from static code analysis tools were taken non-critically. By providing well explained recommendations, both positive and negative, Sharpen helps you develop a critical view on new language features. It teaches you to apply them only on the places where their usage will actually result in "sharper" code.

Consistent Usage of Language Features

Once configured on your project, Sharpen helps you ensure that a certain C# language feature is consistently used on the whole code base. Sharpen can be configured globally on the machine level, or on a solution and project level.

Code Refactorings on Arbitrary Scale

Once you trust the given Sharpen recommendations, you can safely refactor your existing code by a single mouse click. Sharpen can refactor code on an arbitrary scale, giving you a full control over the scope of refactoring. For example, you can apply the Use expression body for get-only properties suggestion on highly recommended places in the whole solution and at the same time apply some less recommended suggestions only on a single occurrence in code.

Improving the Design on a Larger Scope

Certain language and corresponding .NET Framework features can simplify architecture and overall design of your code. Replacing BackgroundWorkers with async-await or replacing locally used data-only classes with tuples are just two examples. Sharpen comes with an intelligent heuristics that recognizes such places and gives appropriate suggestions. These suggestions go beyond refactoring only a local point in code. They rather aim to improve the design of your code base on a larger scope.

Note that in the current version of Sharpen the following features mentioned in the above chapters are still not available:

  • Extensive documentation.
  • Recommendations.
  • Refactorings.
  • Configuration.

Release Notes

All notable changes to the Sharpen extension are documented in the changelog. Below is the excerpt from the changelog that lists only the major changes.

0.1.1

  • Icon, preview image and release notes.

0.1.0

  • Display of the analysis results in a tree view.
  • Analysis of the whole solution.
  • Suggestions for usages of expression-bodied members (C# 6.0 & C# 7.0).

License

Sharpen is licensed under the MIT license.

sharpen's People

Contributors

ironcev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.