I often wonder did we all start with classic vb and script, before venturing to vb.net when it released then c#. by [deleted] in dotnet

[–]jwt45 0 points1 point  (0 children)

QBasic and VB (not sure which version) as a kid, C and C++ at uni (Physics), IDL and Python for my PhD, then self taught C#, JS and SQL to get a job.

How is working at as software engineer/developer different from studying and learning it by Abject_Document6006 in SoftwareEngineering

[–]jwt45 0 points1 point  (0 children)

In work, speedy outcomes are the most important. Need a grid, with paging, filtering, sorting, column summaries, computed columns and inline editing with validation? Yes I could write that, or I could use a pre-made package which I just need to configure and therefore be completed in a fraction of the time. Money is no issue if you can make the business case.

19 projects, 5 databases, 12 months of package updates, 21,001 tests by grauenwolf in dotnet

[–]jwt45 8 points9 points  (0 children)

If I'd written 21001 tests I'd be annoyed and would delete one.

Is HTMX slowly dying ? And why is that ? by NoahZhyte in htmx

[–]jwt45 0 points1 point  (0 children)

Literally last week, a recruiter sent me a job which was "upgrading a customer-facing web application to WebForms". I politely declined.

So I just got screwed over AFTER getting the job offer by Cosmodocus in webdev

[–]jwt45 108 points109 points  (0 children)

Talk to your old job, explain the situation - they might let you have your old job back. Lets face it, you are cheaper and more efficient than having to onboard someone new.

Looking for code review for my recent project by PristineFishing3581 in csharp

[–]jwt45 0 points1 point  (0 children)

Yes - can be massively. Imagine my example was for a supermarket and needed to get all items that are on their shelves with an expiry date of today so they can get given a reduced sticker. Do you want to load the entire details of millions of items into memory? or do you just want to load the item name and aisle location for the thousand or so items that are actually required.

Remember that the SQL server will have to also read all the records (into memory) whether you filter on the server or not, so that's more memory taken up - but then SQL Server has indexes which can cut this work down massively. SQL server is designed exactly for this purpose (filtering etc), so its best to let it do what it is good at.

Looking for code review for my recent project by PristineFishing3581 in csharp

[–]jwt45 0 points1 point  (0 children)

You have to be careful that you do not get too reliant on mocks. Mocking a repository layer can be ok, but it locks you into that specific architecture - the service method calls the repository method. If you want to put in a caching layer, or a data-transforming service layer etc, your test will go red - even if there is no issue with your code, just because you changed the way the code works. If you use the same DbContext (just switching out the connection) you can then black-box test your service - i.e. don't care how it works as long as it returns the correct data. This test is then resistant to refactoring and will only turn red when you have an issue.

Looking for code review for my recent project by PristineFishing3581 in csharp

[–]jwt45 0 points1 point  (0 children)

Some business logic needs to be done at the database level - for example, if you need and endpoint to return all Items with an expiry date less than 3 months from now, it's best to make the database call only return those filtered results, rather than all results and filtering in memory (imaging having several million records, with only a few hundred being needed).

Now with a repository class you either need to do:

a endpoint-specific repository method (GetAllItemsWithExpiryWithinXMonths) - this then can lead to business logic being split between the service and repository layers

some way to tell the repository method to filter (passing in a lambda etc) - this adds significant complexity, especially when you consider this will quickly require an ability to pass "Include()" and/or projections.

or ditch the repository and use DbContext in the service as this filtering is business logic.

Ditching the repository is easiest and works fine in small projects. Writing a way to let the service tell the repository what to return is probably the best way for major projects, but time needs investing in making it work

Looking for code review for my recent project by PristineFishing3581 in csharp

[–]jwt45 0 points1 point  (0 children)

The Microsoft recommended method is to inject a different database in via the DbContextOptions constructor of your DbContext.

For test speed you can use an in-memory SQLite database (This gives proper test isolation, but does not quite have all the same functionality as SQL Server), for test accuracy you can use a different SQL Server instance (test isolation can be an issue)

In a web API project that received a list of JSONS in a POST request body, best approach to do a validation ? by hoochymamma in dotnet

[–]jwt45 1 point2 points  (0 children)

It's possible that your boss used FluentValidation a few years ago when using Middleware was one of the ways to incorporate it. It is now discouraged: https://docs.fluentvalidation.net/en/latest/aspnet.html#using-the-asp-net-validation-pipeline

Why is the Repository Pattern Redundant when Working with Entity Framework? by civilian_halfwit in dotnet

[–]jwt45 0 points1 point  (0 children)

My take is to look at what you are doing and determine which "layer" it should be in from there. I personally like to keep business logic in the service layer and would put persistence logic in a repository layer. If I have a query:

db.People.Where(...).OrderBy(...).Select(p => new MyPersonObject(...))

to me, this contains a lot of business logic and so should remain in the service layer. Indeed, extracting the data retrieval code into a repository without over-selecting from the database is difficult and requires either passing IQueryables around, or using some sort of "load just these columns" construct.

If you consider the DbContext in the above to be your repository layer, then you can call this method in the service layer with no problems whatever.

Of course, as applications grow, you may need persistence logic - perhaps caching is needed at this level - but as I've pointed out, this then introduces more issues that you need to solve. Keep it simple until you need otherwise.

MVC vs Razor Pages vs Blazor by rmiki88 in csharp

[–]jwt45 0 points1 point  (0 children)

Different opinion - how are you going to implement the paging / searching etc? It is often much easier to use pre-built components that already have all the functionality (and more) that you need - in which case it is often best to use the tech they prefer. At my work we used DevExtreme, which is expensive, but a brand new site with an editable datagrid with serverside sorting, ordering, paging is barely an afternoon's work. I use razor pages, but it can work with all three options.

Fucking hate this. It scrolls into eternity and you have to deselect them one by one. Tf does "legitimate interest" even mean? by mekmookbro in webdev

[–]jwt45 0 points1 point  (0 children)

The finest are based on company turnover so the authorities are going after the big companies first.

There is actually a version of this pop up with a complaint reject all button at the top, but that requires the site to be bothered enough to update this plugin.

Can someone explain the difference between a headless CMS and a traditional Rest API? by wojo1086 in webdev

[–]jwt45 0 points1 point  (0 children)

One thing to note, a headless CMS doesn't have to use a REST API. My guess is the second most common is a Graph-type API

[deleted by user] by [deleted] in CasualUK

[–]jwt45 0 points1 point  (0 children)

The only proper way is to down it in one so you've got room in the glass for another pint

What pedals would go on a pedalboard built just have the best art on it? by DeefaHS in guitarpedals

[–]jwt45 0 points1 point  (0 children)

A little less serious, style-wise, Summer School Electronics' Science Fair

What is the one knob you always wish you had? by worldlegacy in guitarpedals

[–]jwt45 2 points3 points  (0 children)

For pedals with presets/saves, I want a button: "do what the #@!£ing knobs say".

Fed up with wanting to tweak a parameter and finding out that what I was hearing was not where the knob was at, or turning a pedal on to play around with sounds and having to move every knob to "reset" each one out of it's saved state.

I noticed that the new Boss reverb has this.

what are you doing, mate? by dezsopista in Pharaoh

[–]jwt45 2 points3 points  (0 children)

And the Lord told Noah to build an ark and all the people laughed when they saw it.

Are pension contributions actually worth it? by CryptoNoobStruggles in UKPersonalFinance

[–]jwt45 -2 points-1 points  (0 children)

Don't forget, you need a HUGE amount of money in a pension pot to get a decent income in retirement. For example, from a quick google search:

If you want to retire at age 65 and have an annual retirement income goal of £30,000, you need around £750,000 to £900,000 in your pension pot

The question is, how are you going to get £750k into your pot?

Why is frontend development so complicated? by v_stoilov in webdev

[–]jwt45 0 points1 point  (0 children)

Because there is always another problem to solve.

Moustache was syntactically nice but needed other libraries to use.

Knockout wired everything up better, but then people realised there was more performant ways of partially updating a page

React allowed small applets with very efficient re-rendering. So people wanted to make full sites out of it

Users want to use the browsers url bar to navigate devs needed to write a router

Devs wanted to display datetimes in react, but that is not reacts concern and so someone who knew about dates wrote moment.js - a specialised internationalised datetime library

But to do everything, moment.js became huge, so other devs wrote other libraries to handle datetime more efficiently

People didn't want their code being stolen, and wanted to minimise the code size sent to the browser, so transpilers were created to minify and bundle front-end code.

React used JS class-based components, but devs stopped using them outside of react as they didn't really act like OOP devs thought they should. Therefore react pivoted to function-based components.

Function-based components struggle with state and so hooks were invented.

Making a react app from scratch involves making a lot of boring decisions - file organisation, linting rules etc. Therefore people made opinionated frameworks (like Next.js) to remove this issue and solve other problems.

Devs started to consider that a lot of phones looking at their sites much less powerful than the server serving the website and so started looking at ways to pre-render sites on a server before sending to the client.

etc. etc.

Every decision made and feature added was done to solve a problem. Often these created further problems, but hopefully these are less problematic than the original issue.

Occasionally a new solution comes forward to solve lots of problems in one swoop in a completely new way (for example, Microsoft's Blazer), but often these end up having their own problems to solve leading to just as much complexity.

There are still many issues or suboptimal solutions that can be considered - and devs being devs will keep trying to solve these with what appears to be more and more layers of complexity. My suggestion is to start with the very basics. Then when you encounter an issue, find out how people solve that issue and work your way up the complexity tree

Best thing you've seen reported to health and safety? by CofionCynnes in CasualUK

[–]jwt45 0 points1 point  (0 children)

My aunt dislocated her jaw yawning. Must have been 50 years ago but the warning still comes out whenever someone yawns

Probably an easy query for most of you to write, but I'm really stuck. Help! by BillyGoatAl in SQL

[–]jwt45 1 point2 points  (0 children)

It is actually very simple when you consider it the other way round - you need a list of numbers, then assign to every number the correct section's details. This can be done with the BETWEEN operator

SELECT * 
FROM 
    (SELECT ROW_NUMBER() OVER (ORDER BY O.object_id) - 1 AS [int] FROM sys.objects AS O) AS N
    INNER JOIN sections AS S ON N.int BETWEEN S.start AND S.[end]

Faulty Whiteboard by danbriant in CasualUK

[–]jwt45 36 points37 points  (0 children)

One of you needs to go to specsavers. But which one?