was successfully added to your cart.

Category Archives: Ask Tim

Where Should I Validate Data in my Application?

By | Ask Tim | 2 Comments

Which Layer is the Right Layer?   When you are writing an application that has many layers, the question often comes up as to where do you validate. I have heard a number of answers on this but I think there is, in general, one right (or at least best practice) answer: everywhere. Let’s think about a web application I built for my company. It has a JavaScript user interface, a C# WebAPI middle layer, and a SQL Server database (very simplified version of our application). Now we can talk through the layers in my application and you can apply…

Read More

Should I say “I Don’t Know” to an Interviewer?

By | Ask Tim | 3 Comments

Acting Confident vs. Being Truthful I could give you the easy answer (tell the truth) and it would be true up to a certain point but there is much more to this situation. Let’s start with a hypothetical question: “How would you fix the hyperdrive on the Millennium Falcon?” Obviously a nonsensical question but it gives us somewhere to start from. The truth is that I have no idea how to accomplish this task. Now that we have question we don’t know the answer to, let’s look at what we can do. Step 1 – State the Truth Be very…

Read More

Which Certifications Should I Get as a C# Developer?

By | Ask Tim | No Comments

Showing Off Your C# Skills Let’s start off by saying that getting a certification is not typically the best way to show a potential employer that you are a good candidate. There are a lot of better ways to do that. The problem with certifications is that people study for the test instead of actually learning how to do the work. Microsoft has worked to make the tests more real-world focused, which does make them better but nothing replaces experience. With that being said, being certified does differentiate you from your peers so if you have the money and the…

Read More

I’m Getting a “Cannot insert the value NULL into column ‘id'” Message in SQL

By | Ask Tim | One Comment

SQL Insert Error Message This is a fairly common issue. You go to insert data into SQL, either directly or through C# or another programming language only to get the error “Cannot insert the value NULL into column ‘id’”. It probably continues by saying “column does not allow nulls. INSERT fails.” Something like this: You look at your SQL statement first, to see if that is the issue. Here is what mine looks like: Pretty simple, right? Now if you look at the table, you see the following: OK, so there is the Id column that it says is the…

Read More

Is WinForms Dead?

By | Ask Tim | 2 Comments

Looking at the Established Choice vs. the New UIs Windows Forms or WinForms has been around since the beginning of .NET (and before that with VB6) so the question makes sense. We have WPF and UWP now so why would we ever create a WinForm project? It seems like WinForms is only for legacy support. That all sounds logical, however, it is just not true. Microsoft has maintained and improved WinForms (and there are some cool new features coming down the road). Their commitment to WinForms has remained steady. The reason for this is because WinForms fills a need that…

Read More

When Do I Use NVarChar vs. VarChar in SQL?

By | Ask Tim | One Comment

Using or Omitting the N Really Does Matter When it comes to storing text data in SQL, there are a couple of main options: varchar and nvarchar. So the question comes up: which one do I use? The answer really depends on how well you can see into the future and use of your column. VarChar is used to store ASCII characters whereas NVarChar stores Unicode characters. That means NVarChar supports characters found outside the standard English alphabet (really important when it comes to supporting an audience of any size even in the US). The downside of NVarChar, though, is…

Read More

Why Don’t You Use Entity Framework?

By | Ask Tim | 19 Comments

The Case for Speed, Simplicity and Ease of Maintenance Microsoft’s data access method of choice is Entity Framework. I disagree with that choice. Obviously there are a ton of really smart people who design and build Entity Framework. There are also fellow Microsoft MVPs who I realy respect like Julie Lerman who spend a ton of time evangelizing Entity Framework. So it does seem odd that I would disagree with all of them. Let me lay out for you the reasons why and I will let you decide which way to go. The goal of Entity Framework (EF) was to…

Read More

Do you have an example of WPF / MVC / WinForms with full CRUD?

By | Ask Tim | 2 Comments

Data Access in the User Interface I get this question a lot. I definitely understand the need that drives it as well. You are just learning a new user interface and you want to see how it would work in a real world environment. Real world environments are almost always about data so seeing how to perform CRUD operations (Create, Read, Update, and Delete) seems like a good idea. Here is the problem with this mindset: user interfaces should not be directly doing CRUD operations. Instead, they should be talking to class libraries that handle the CRUD operations. I won’t…

Read More

What Does Full Stack Developer Mean?

By | Ask Tim | No Comments

Identifying Developer Types When you work in an industry for a while, insider terms start to become commonplace. The problem is that it makes the barrier to entry higher for those coming in fresh. The phrase full-stack developer is one of those insider terms. It makes more sense, though, when  you see it in comparison to the other developer phrases: front-end developer and back-end developer. So let’s look at all three. A front-end developer is a person who specializes in developing user interfaces. They may be more design-oriented or they might not. A developer who takes a design from a…

Read More

Why do you teach Console Applications instead of Drag and Drop in WinForms?

By | Ask Tim | 4 Comments

Teaching C# vs. Teaching Magic If you have watched any “Getting Started” C# tutorials, you have probably seen the drag and drop Hello World example. You have never seen Visual Studio or C# before, so the presenter shows you Windows Forms and shows how easy it is to drag and drop controls onto a form, then you double click a button, add a bit of code and bingo, you have a working application. Seems simple, right? Unfortunately, this has become the default way of teaching new C# developers. In fact, I teach C# at a local college. The book I…

Read More