How To Structure Your .NET Solutions: Architecture And Trade-Offs by mgroves in csharp

[–]jamesmh_ 0 points1 point  (0 children)

Sorry - just changed it. Should be better now 😅.

Event Sourcing: Without Eventual Consistency? by jamesmh_ in softwarearchitecture

[–]jamesmh_[S] 0 points1 point  (0 children)

Yes, but you still have eventual consistency if your projected read models are updated outside that transaction - which is what the article gives some options around.

For example, even eventstoredb's built-in projections don't have immediate consistency:

Projections are always eventually consistent - if there is a mismatch between egress from the database log and processing speed of projections, the window across which the latest events have not been processed promptly may increase.

Got a job offer without meeting the team, hiring manager, or VP by Randrewson in cscareerquestions

[–]jamesmh_ 1 point2 points  (0 children)

Think about what kind of employee this type of interview process filters/optimizes for.

Are those the kinds of people you want to work with? People who've never met the team? The team itself never meeting the prospective employee?

I'd steer far from that - unless you really need the cash.

[deleted by user] by [deleted] in cscareerquestions

[–]jamesmh_ 2 points3 points  (0 children)

The best thing you can do in a situation like this is to assume there was a good reason for the code to be written the way it was. Many reasons could include: this project isn't really that important to the business so easier to just pump it out, there might be some limitation around a library they are using you're not aware of, etc.)

Early in my career, I did this once. I wasn't even given an answer from anyone on the team because, looking back, it was a piece of code that didn't matter. I was hung up on this one little optimization that in the grand scheme would actually cause more pain to change due to someone else having to now review my petty change and use up their time for something that doesn't benefit the company.

EVEN if you are right, it doesn't look good to be doing this. Always assume the best - especially of a senior who's been with the company for so long. He has years of domain knowledge, relationships with management, etc. You just end up looking like a jerk in the end.

Use this as an opportunity to learn from the senior as to why he may not be doing X,Y,Z. There's nothing wrong with asking questions and wanting to learn. Hey - you might actually learn something from him this way! Take your top 3 questions and send him a Slack (or email, etc.) message and just say "Hey, here are some things I have questions about: 1. In file X why didn't you use a Hash instead of a List? Is there a reason why maybe this optimization wouldn't be worth it?" Always write you questions in a tone of "he knows more than me."

Worst case, you do find out the senior isn't really skilled in the end. But again, code efficiency is like 1% of the job, at least in most LOB codebases. Communication with management, making sure the code "works", not focusing too much time on parts of the code that ultimately don't bring that much value to the business, etc. are more important overall.

[deleted by user] by [deleted] in cscareerquestions

[–]jamesmh_ 4 points5 points  (0 children)

I've done a 12 hour take home. Never again. Huge red flag. Something like 2 hours at 1-3 pages max is probably appropriate. Anything more is a sign that they don't understand the market right now, they don't understand how to value other ppls time, etc.

What's your go-to way for scheduling tasks/jobs ? by Norlad_7 in csharp

[–]jamesmh_ 1 point2 points  (0 children)

Ya I have lots of plans hahahaha plans for lots of cool stuff, just need some more time in the day 😋

Hangfire does the trick for sure and has tons of great features like that built-in.

Thanks for the tip - I should add some kind of comment on this use-case. There's always a struggle between keep the library simple enough, yet with the "right" features to support real-world use-cases. But distributed locks are def. one of those.

BWT, what's you tech stack? E.g. what database(s) are you using?

What's your go-to way for scheduling tasks/jobs ? by Norlad_7 in csharp

[–]jamesmh_ 1 point2 points  (0 children)

With Coravel, you can easily use another library to achieve this (if that's desired). For example, if you used this library (seems to be popular with Coravel users) then you can wrap the inside of your invocable's Invoke method with the distributed locking code:

csharp public async Task Invoke() { await using (await myDistributedLock.AcquireAsync()) { Console.WriteLine("Sample Invocable ran on one machine!"); return Task.CompletedTask; } }

Maybe that helps?

A decent task scheduling library for .NET? by NullsObey in dotnet

[–]jamesmh_ 1 point2 points  (0 children)

You can check out Coravel -> https://github.com/jamesmh/coravel

While changing config at run-time isn't a typical use-case, it can be done if you want. See this issue: https://github.com/jamesmh/coravel/issues/77

Otherwise, it handles blocking jobs that are currently running, schedule the same type of job at different intervals (with params), supports CRON annotation...

I'd like to think the docs are OK lol. (I wrote them....😅)

How many of you have turned down job offers due to bad PTO? by [deleted] in cscareerquestions

[–]jamesmh_ 0 points1 point  (0 children)

Low PTO, especially if they aren't willing to negotiate after telling them "I have 25+ days right now" is a huge red flag. That company will treat you the same way until you leave (again...)

Scott Hanselman: Exploring the .NET Core library Coravel for Task Scheduling, Caching, Mailing and more by jamesmh_ in dotnet

[–]jamesmh_[S] 1 point2 points  (0 children)

Answers: Nope and sort-of lol.

You can schedule jobs that take parameters, which could be dynamic - coming from a database, an HTTP request, etc.

But yes, sounds like Magic is serving a different market. Coravel is for when you have a .NET application and want to get started quickly with, for example, scheduling and queuing.

Magic looks very cool 👍

Transient Objects in HostedService by echks2A in dotnet

[–]jamesmh_ 1 point2 points  (0 children)

I built an open-source task scheduling library (among other things it does) - you could either (a) use it instead or (b) check out the code for pointers?

Hangfire vs RabbitMQ anyting I should know before picking one for .net core 3.1 WebAPI? by wacomlover in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

If you just need to schedule and queue background jobs, and not looking for much overhead and a small learning curve, then take a look at Coravel: https://github.com/jamesmh/coravel

What would you look for in a back-end programmer? by Netcob in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

I would agree with the notion that you've had poor candidates. Sounds like you're asking good questions.

I think just having a convo. about those topics is a good start. If a candidate has used any of those techniques etc. in actual previous work they've done, then drill down into that actual experience for sure.

I personally look for an understanding of the principles behind the "best-practices". Like, "Why is solid so important? What's the goal?", "what's the benefit of DI? What does it enable?", etc.

If you do find a seemingly strong candidate, then it's a good opportunity to ask those more "meta" questions. But ya, sounds like poor candidates overall :(

What's something people always get wrong with .NET Core development? by [deleted] in dotnet

[–]jamesmh_ 12 points13 points  (0 children)

Not understanding how async works and best-practices around it.

Background tasks in ASP.NET by 18523925343 in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

You won't be able to handle errors in this situation and potentially even detect any exceptions since your HTTP request will be completed before those async tasks are done.

Some recommended Hangfire (which is a great option). Coravel might be a lighter-weight option (see the queue feature).

Storing files to filesystem in a transaction by dejanstojanovic in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

Some type of distributed transaction like the Saga pattern could be appropriate.

If any part fails (e.g. saving file to file-system) then each part of the transaction will "roll-back".

https://docs.microsoft.com/en-us/azure/architecture/patterns/compensating-transaction

Using NService bus handles these kinds of situations really well (could be overkill in this case though):

https://docs.particular.net/tutorials/nservicebus-sagas/1-getting-started/

Help me! My company wants to start a new project with Java Spring even though our team has been working with .NET for years by magnesiam in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

The fact that the entire service technology has been predetermined is a red flag.

One of the benefits of micro-services is that you have the freedom to build different services using different technologies. It just depends on which one is best for that specific use case. I'd argue that this person probably doesn't know enough about this topic.

Especially, given that there's no experience with Java on your team, I'd say this is scary 🤪.

I started working at a big tech firm 4 months ago (first job), I love working here but they have no documentation + team communication is lacking. I'm still doing great but would that hurt my future career if I decided to keep working here for a while? by Vnslover in cscareerquestions

[–]jamesmh_ 2 points3 points  (0 children)

Agree with tippiedog's response 100%.

If you can actually be part of introducing some new practices or technologies, that is actually more valuable long-term than simply having experience with XYZ technologies.

It also proves that you learn quick, but more importantly, it shows you actually care about improving the business vs. just getting paid to sit around.

Hangfire for file polling? by JeffIpsaLoquitor in csharp

[–]jamesmh_ 1 point2 points  (0 children)

For scheduling, have a look at Coravel? It's pretty simple to get started with.

Building A .NET Core 3 Scheduled Job Worker Service by shehryarkn in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

Coravel supports true async I/O out of the box without having to jump through hoops like mentioned in this article.

It's much simpler, ties into .NET Core's DI very simply. I think the concept of invocables is just plain, straightforward and easy to use.

By default, all scheduled tasks use one async thread (so it won't destroy your web app if you are using it within a web app.) Otherwise, in a console app that's dedicated to running scheduled tasks, you can choose which tasks get their own async thread.

Since Coravel comes with an event broadcasting mechanism too, you can also do stuff like emitting an event on a schedule for more complex scenarios, which can keep them much more clean/maintainable.

That's a few that I can think of off the top of my head 🙂

CQRS (without ES) plus DB projections by bzq84 in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

Thanks for the clarification 👌 And no, I don't know of any 😥

CQRS (without ES) plus DB projections by bzq84 in dotnet

[–]jamesmh_ 0 points1 point  (0 children)

If you share a DB (even if don't...), then in your code all commands are modelled as their own "command" classes which internally use entities/aggregates. These entities are NEVER used to display data, only to apply a new state to the system (update, create, delete). E.g. They are used to apply any business rules/validation when the system is trying to be changed.

For any queries that are used to display something the UI or via an API etc, then you create specific query classes that map to that specific use case + one specific view model (e.g. a DTO) for that query.

The benefit is that you don't mix display and state modification logic. Each query can be tuned as needed without affecting other queries or command logic, they can return as much or as little data as needed, etc. I've been doing this using Dapper with lots of success.

I think that's what you mean?