Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
In 2013, Microsoft added new feature to the .NET framework to help handling asynchronous tasks: async/await.
How does this feature affect the readability of the code?
Here are few disadvantages that I found:
It is the same as using return in the middle of the method: it makes it hard to catch the flow of the code.
It reminds of GOTO in C: it makes it hard to catch the flow of the code.
async/await are not easy to understand, but once you get the principle of synchonization context capture/restore, it's relatively easy to follow the code flow.
The main issue with this feature IMO is the async all the way problem, i.e. once you're writing an asynchronous piece of code, all your code tends to become asynchronous too.
I recommend this excellent article on MSDN Magazine for a good understanding of the whole async topic.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I need to run some tasks in Asp.net MVC, after every 5 minutes. I've never worked on such functionality. So i googled it and got some options to implement this functionality. These are the options here, here and here
I've looked over the above links. These all just confuse the person to choose best process to run background process.
I'm new on such functionality, that's why I'm here to discuss/ask the several ways available to implement it.
You can use Hangfire It's a fantastic framework for background jobs in ASP.NET.You can find HangFie Tutorial Here.
The best feature from Hangfire is its built in /hangfire dashboard that shows you all your scheduled, processing, succeeded and failed jobs. It's really a nice polished addition.
All these libraries are excellent, are open source, and Available as Nuget Packages.
Some Other Options
QUARTZ.NET
FLUENTSCHEDULER
WEBBACKGROUNDER
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm in the process of converting our data layer for a fairly large and complex WCF application to talk to the database asynchronously.
This has resulted in async and awaits being littered everywhere in the calling/consuming code.
Looking at the stack trace for a typical request I can already see many sections for the System.Runtime.CompilerServices.TaskAwaiter doing it's thing with await. And I have only just started this task!
I understand what .net does when it encounters async/await, so my question is the following: Is the extra overhead associated working with async/await worth it when the result is quite a few async methods from the beginning of a request to the end? I understand the benefits of calling the database asynchronously but is there a limit? Particularly when the calling application is fairly large and complex (or more appropriately a large and long call-stack).
Thanks.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have a question about c# programming language, when a method returns an object, and for example I'm forced to return null, which is not clean code, what is the best practise to handle this? I dont want to return null.
EDIT
This was a question because it started as discussion on a software engineering class after reading Clean Code - Robert C. Martin 's book and it really came to my mind that trying to avoid this added unnecesary complexity to the design.
In case to signal "failed to create object" C++ class constructs throws exceptions for this purpose.
Some languages / projects prefer to use exceptions more to keep happy-pass happier while others may not.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
According to StackOverflow Update: 560M Pageviews A Month, 25 Servers, And It's All About Performance (perhaps getting its information from Marco Cecconi The Architecture of Stack Overflow at 29:00),
Some coding is in IL, not C#.
I am not asking about anything specific to Stack Overflow site, but, generally speaking, when would IL-written code be faster than C#-written code?
My understanding, from reading the posts of Eric Lippert, most of the optimizations in .NET are done when JIT'd:
We let the jitter team worry about optimizing the heck out of the code when it is actually spit into machine code; that’s the place where you can get real wins. — What does the optimize switch do?
What sort of optimizations can be made from hand-coded IL?
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
My MainViewModel has to deal with a lot of commands with complex actions inside, therefore its extension has grown inevitable. For keep the code organized I tend to use #region to group similar o related tasks.Does this considered an overuse of this feature or it's perfectly normal? You may say that it depends on me, if I feel right about it. I think that it helps a lot but I would like to know what do others. Here is a screenshot of how the code look like:
The bad practice is a massive single class. #region is simply hiding / coping with it.
If there are groups of methods, delegate them to another class.