Content that is all about programming and coding! Find examples of code often written in C# along with tutorials.
You're an intermediate dotnet programmer and you mostly know your way around using Tasks. You sprinkle async and await through your code, and everything is working just as expected. You've heard time and time again that you always want the return types of your asynchronous methods to be a Task (or Task<T>) and that async void is essentially the root of all evil. No sweat. One day you go to wire up an event handler using the syntax myObject.SomeEvent += SomeEventHandler, and your event handler needs to await some asynchronous code. You take all of the right steps and change your method signature to get that beautiful async Task added in, replacing void. But suddenly you get a compile error about your event handler not being compatible. You feel trapped. You're scared. And then you do the unspeakable... You change…
As a C# developer, understanding the different simple data types in C# and when to use them is crucial for writing efficient and maintainable code. I've been trying to spend more time this year putting together some content aimed at really introductory level programming. There's plenty of resources available online, but I want to do my part to ensure I can help break down some of the barriers for people getting started on their programming journey. In this beginner's guide, we will look at the basics of the most commonly used simple data types in C#, including int, float, double, byte, char, bool, and string. We will also look at how these data types differ from each other and when to use them in your C# programming! Integer Data Types The most commonly used integer data types in C# are…
(This article is intended to be a spiritual successor to this previous entry, and now includes Tasks!) Even if you're new to C#, you've probably come across at least one of Tasks, Threads, or BackgroundWorkers. With a bit of additional time, it's likely you've seen all three in your journey. They're all ways to run concurrent code in C# and each has its own set of pros and cons. In this article, we will explore how each one operates at a high level. It's worth noting that in most modern .NET applications and libraries you'll see things converging to Tasks. The Approach I've gone ahead and created a test application that you can find here. Because this is in source control, it's possible/likely that it will diverge from what we see in this article, so I just wanted to offer…
Python is a powerful and versatile programming language that has become increasingly popular. For many, it's one of the very first programming languages they pick up when getting started. Some of the highest traffic posts on my blog many years after they were written look at using C# and Python together. Today we're going to explore how you can use Python from inside a C# .NET Core application with much more modern approaches than my original articles. Enter Pythonnet! Pythonnet Package & Getting Started We're going to be looking at Python for .NET in order to accomplish this goal. This library allows you to take advantage of Python installed on the running machine from within your .NET Core applications. You must configure it to point at the corresponding Python DLL that you'd like to use, and after a couple of…
If you have an internet connection then you have probably heard of ChatGPT from OpenAI by now. Odds are you might have even given it a whirl to see what it's all about. Personally, I know that I was quite skeptical at first but I've been blown away at how well it's able to converse about topics I ask it. I've even asked it to generate various scenarios for me and it will conclude by explaining why the different facets it chose were good choices. Incredible stuff. I'll be using this to help chip away at content for my role playing game. When it comes to using OpenAI effectively, I have a great deal to learn. It's all very new to me, especially with respect to how to structure prompts and get the most out of the interactions with such…
If you're building a 2D game in Unity3D, odds are you've come across the TileMap component. The TileMap is a powerful tool that allows you to create a grid of tiles that you can render your tiles with instead of hand-placing individual game objects with sprites. It has a host of built in functionality that you might otherwise find yourself manually writing, like mapping coordinates to particular cells on a map. And what's even cooler about using a TileMap? You don't need to handroll your own editor to paint tiles! I think I'd pass on having to do that. But have you found yourself in a situation where you want to get all of the painted tiles on a TileMap? You may have found it's not quite as obvious as you'd have hoped! What We Have To Work With On…
Here's a super quick peek into unit tests compared to functional tests. And full disclaimer here is that depending on your circle of influence, these might be given slightly different names. Try not to dwell on that but instead the comparison and contrast presented! Unit Tests Coded tests that take a white-box visibility approach to exercising and asserting that written code, generally a specific function/method, works as it was designed. Pros: Generally very programmer-focused Very granular coverage (breaks can identify exact lines where an issue occurs) (Should) run extremely quickly Have very little test setup in ideal cases Provide full control (generally via ‘mocking’ dependencies) to exercise very specific logical paths Cons: Generally more challenging to convey coverage to other stakeholders By nature these are brittle and break with refactoring Require sets of design patterns to help ensure tests are…
As I've been trying to get more YouTube content put together more steadily, one of the themes I'm interested in is doing some behind-the-scenes of the role playing game (RPG) I'm making with some friends in Unity3D. I've found that being able to work on an RPG outside of my regular day job is a really awesome way for me to keep up on my technical skills. I love coding, and the further along I move in my career as an engineering manager, the less time I actually spend writing code myself. I pride myself in being a technical engineering manager, so for me working on this RPG is a great outlet for creativity and practice. I mentioned this in my LinkedIn post here: Persisting Game Objects Across Maps In this video, I focus on one of the challenges the…
If you're like me, trying to create user interfaces in general is a challenge. So when it comes to working in tools that you're less familiar with, that challenge basically grows to a level where it's a roadblock. For me, trying to create user interfaces in Unity3D is basically the perfect example of hitting this roadblock! That's not to say the UI tools that are available in Unity3D are bad, but my skill level is essentially reset to zero when working with these tools. Fortunately I came across this little gem called Noesis GUI that enables WPF inside of Unity3D! I plan to do a few updates on this either via YouTube or short blog posts, but NoesisGUI has essentially unlocked my ability to create user interfaces inside of Unity3D. You can find my intro video here, or watch it…
I asked on LinkedIn about whether or not people would be interested in a video stream that focused on programming, and I had some positive feedback. In order to test the waters, I decided I'd start with some system-design stuff given that I'm going through a bunch of practice with distributed systems. This is a bit of a change up from distributed systems in that this is interactions between co-located systems in a game framework I'm creating. Here's the video! https://www.youtube.com/watch?v=04rFmvFEeDw&ab_channel=DevLeader In the video stream, what I'm trying to accomplish is finding a way to share information from particular domains to be used in another domain. Domain in this sense is a functional area of the code base in question. I mean, that's the gist of it :) The complicated parts are: How do I keep domain information from leaking…