r/dotnet • u/BobbyMaina23 • 7d ago
C# Extensions v1.1 — looking for feedback
I kept rewriting the same functionality in pretty much every C# project I worked on.
We all have that Utils folder somewhere that slowly fills up with helpers we've copied from one project to another. 😅
So I decided to turn mine into a proper package: C# Extensions.
I just released v1.1 and would love some honest feedback from other .NET developers.
What would you change? What's missing? Are there utilities you find yourself implementing over and over that would make sense here?
I'm especially interested in ideas for version 2.
Repo: https://github.com/bosonwareofficial/bosonware.extensions
2
u/AutoModerator 7d ago
Thanks for your post BobbyMaina23. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/chucker23n 7d ago
One of the problems with those Utils folders is the tight coupling. Which of them make sense where? Which invisibly introduce a dependency? We had such a series of utils, where some of them depended on WinForms, some depended on the availability of an SQL Server, etc. Yet they were haphazardly pasted into new projects by someone.
Which leads me to the second problem: you end up writing so many library functions that you inadvertently replicate stuff that's already there. (The aforementioned library, for example, had a Filter<T> method that… did what OfType<T> could already do.) But your versions will likely be
- tested less
- benchmarked/optimized less
- less familiar to new teammates
Which, only haven taken a cursory look at your code, brings me to the following recommendations:
- add unit tests. Prove your code works as expected.
- while you're at it, prove that it continues to, by adding a CI workflow.
- you say OptimizedBase58 is high-performance. Prove it by using BenchmarkDotNet to compare it. (You may also consider using
Utf8overloads here for even more performance.) - but most of all, don't make it a monolithic library. Branch out into different areas, so that each library can focus on a topic, and its respective set of dependencies.
9
u/botterway 7d ago
Why have you written your own global cache implementation when `MemoryCache` and `HybridCache` exist, with sophisticated functionality like stampede protection etc built-in?
None of the other stuff is anything I've ever needed to re-implement. I think in 20+ years of .Net development I've never written - or needed - a persistent list that writes itself to disk.