What’s In This Issue: Applying Growth Mindset to Learning Rust
- Applying Growth Mindset to Learning Rust
- dotUltimate Winner
- Weekly Recap
- It's EASY – Check Type Data with Reflection in C#
- Power That No C# Dev Should Have – The Dark Side of Reflection
- See It In Action! C# Reflection for Beginners
- Using Autofac in C# – 3 Simple Tips for Beginners
- Reflection in C#: 4 Simple But Powerful Code Examples
- async await in C#: 3 Beginner Tips You Need to Know
- Activator.CreateInstance in C# – A Quick Rundown
- Refactoring C# Code – 4 Essential Techniques Simplified
- Scrutor in C# – 3 Simple Tips to Level Up Dependency Injection
I’ve revamped my paid offerings and wanted to take a quick moment to reshare them:
- Access my newsletter archive and have an ad-free experience on my website by getting a paid subscription. To sweeten the deal, I have this special March Madness offer where you can get 40% off a year off a 12-month subscription!
- My private Discord community is live. This is subscription-based with a free week trial, so there’s nothing to lose!
- All of my weekly vlogs are now on YouTube which are accessible via membership!
- My “Getting Started: C#” course on Dometrain has launched, and the follow-up will be available VERY soon!
Applying Growth Mindset to Learning Rust
That’s probably a bit of a surprising title, right? Dev Leader is a C# guy! He’s a principal engineering manager at Microsoft! They are the ones that MAKE C#!
All of those things are true! And I promise the C# content isn’t going anywhere. I’m trying to commit to a C# article every single day of the week (including the newsletter) by including some shorter articles.
So what’s the deal with Rust? Some may have seen a couple of headlines about “Microsoft abandoning C# for Rust” or “Microsoft is rewriting their services in Rust”. This blew up a little bit thanks to a job posting and people on Reddit.
I recently switched to managing a new team at Microsoft, within Substrate, and this is very relevant to me. You can watch my video response to some of the discussion on Reddit but in the next section, I’ll elaborate on what *I’m* specifically doing.
Technical Engineering Managers
The Rust conversations are all relevant to me because I have part of my team working on technology that will be built in Rust. And no, it’s not because we decided to abandon C# — These are performance-critical parts of Substrate where managing resources will be critical to ensuring we can be successful. We’re talking about services serving planetary-scale traffic across the entire globe.
I was managing teams early in my professional career, but I spent the first 8 years managing AND coding alongside my team. I am a firm believer that management is a people-first role but one thing that helped me be a successful manager is being able to lean on my technical skills. This is because I can be very relatable to the team I’m working with. I can build trust with them by demonstrating my technical knowledge. I can build better relationships with them by debugging things alongside them. I can help coach and mentor them better by assisting with the technical aspects too.
The team I manage now primarily works across two and soon-to-be three languages. We love our C#, but we also have C++ code. And as Rust comes into the picture, that’ll be the third one on the menu.
C# I feel extremely comfortable in. C++ feels pretty rough, but I could at least navigate it for the most part. Rust? Not a chance.
At least not yet.
Growth Mindset
I’ve said this in public forums before, but I am generally very hesitant to jump into new things. It scares the crap out of me. I dislike feeling uncomfortable. I don’t want to be a complete newbie at something and lose my “expert” status. But every single time in my career that I’ve had to do this, I grow into whatever I’m doing and feel awesome afterward. I think my learning curve in most things feels flatter for longer than I’m happy with, but then it does a pretty good job taking off later.
I think I owe it to myself to start adopting a Growth Mindset, because I have proven to myself time and time again that this is how it works. And what exactly is a Growth Mindset? From Western Governor’s University:
A growth mindset means that you thrive on challenge, and don’t see failure as a way to describe yourself but as a springboard for growth and developing your abilities. Your intelligence and talents are all susceptible to growth.
Western Governor’s University
So I’m going to learn Rust. I’m not going to say “Man, that looks challenging… I guess I’m not smart enough”. Instead, I’m going to buckle up and jump right into it because I *know* it’s going to be hard. Of course it is — it’s a completely different language with completely different memory management, syntax, etc… It’s going to be rough.
I remind myself that once upon a time I didn’t know anything about digital forensics — but I was one of the original engineers that helped this digital forensics company get a ~$2b purchase price. There’s only one guarantee here, and it’s that I will come out of it having learned a lot.
What I Learned With Rust Today
The culture at Microsoft is great in that it encourages a Growth Mindset — it’s talked about all of the time through different levels of leadership. And I’m fortunate to have a manager who takes it seriously as well, providing us with opportunities to learn. Today was one of those days!
I spent a bit of time today trying to learn some of the syntax of Rust so that I could work with some of the very basics. These are baby steps, and it feels uncomfortably slow. While I only carved out a bit of time today, it still felt like I was coding for the very first time. Here’s as far as I got:
fn main() {
let point = IntPoint2D::new(123, 456);
println!("Point: ({0}, {1})", point.x, point.y);
let rect = IntRect::new(10, 20, 30, 40);
println!("Rect: ({0}, {1}, {2}, {3})", rect.x1, rect.y1, rect.x2, rect.y2);
println!("Rect Width: {0}", rect.width());
}
struct IntPoint2D {
x: i32,
y: i32,
}
impl IntPoint2D {
pub fn new(x: i32, y: i32) -> Self {
Self { x, y }
}
}
struct IntRect {
x1: i32,
y1: i32,
x2: i32,
y2: i32,
}
impl IntRect {
pub fn new(x1: i32, y1: i32, x2: i32, y2: i32) -> Self {
Self { x1, y1, x2, y2 }
}
pub fn width(&self) -> i32 {
if self.x2 >= self.x1 {
return self.x2 - self.x1;
}
return self.x1 - self.x2;
}
}
This is an example of creating a 2D point and rectangle with integer values. The syntax to instantiate things is a bit funky, but not too difficult to grasp. But the strangest things for me were:
- Separating out the struct definition from the implementation of methods. When I was trying to read through some example code, I couldn’t understand why things were being “declared twice”… But the reality is one defines the structure (since memory management is a key thing in Rust) and the other is the logic we want to slap onto it.
- The constructor syntax feels completely silly to me. The whole Self -> Self thing… I don’t really know what’s up with that yet (or if I even needed to do it?), but this is what I saw in some examples of things I was reading through
I’d like to try writing some logic next and not just defining structures. I think that will start to help things make more sense!
What’s Next With Rust
As I mentioned, I’m absolutely not planning on abandoning C# in any way. C# is my go-to for a lot of things, and I’m very happy to be able to create content about it and share it online.
As my team is picking up Rust, I want to take the opportunity to learn alongside them. I continue to stand behind the fact that the best way to learn programming is by building software, so I’m hoping to come up with more complex examples that I can walk through. Simple programs in Rust are on the way!
But the other thing that’s a very helpful tool for learning is… teaching. I’ll be looking into ways to share my learning journey so at a minimum I can see how well I understand the concepts. I’ll try to find ways to share those learning experiences with you as well: “How to try and learn Rust coming from C#” or something like that 🙂
To close on this, I hope you all consider a Growth Mindset. Work through the challenges of being uncomfortable learning new things. You put in the effort, you get the results.
dotUltimate Winner
Big thanks to everyone that participated in the dotUltimate giveaway! I’m happy to announce that Felipe Andrade is the winner this month! Felipe was quick to respond to claim his prize — which is awesome, because I don’t have to risk a re-draw 🙂 Felipe is just getting into C# and it sounds like this is perfect timing for him to be able to get a JetBrains license!
Stay tuned for more JetBrains giveaways!
Weekly Recap
It’s EASY – Check Type Data with Reflection in C#
If you’re just starting out programming in C#, you may not have even come across reflection yet! Reflection is a powerful tool that we have access to in C# which allows us to inspect type information dynamically at runtime. This opens many possibilities for us when we have information at runtime that otherwise couldn’t be used to do these checks at compile time. Check out this beginner’s guide to get started with reflection in C#!
Power That No C# Dev Should Have – The Dark Side of Reflection
Reflection is a powerful tool that we have access to in C#. And you know what they say: with great power comes great responsibility. And that couldn’t be more true with reflection. In this video, we’ll check out the dark side of reflection in C#. We’ll see how we can break all of the rules and do some… Unspeakable things.
See It In Action! C# Reflection for Beginners
You’ve heard about reflection in C#, but in what situations are we expected to be using dotnet reflection over just… using types as we might expect to? Well, the C# typing system allows us to have a lot of information up-front at compile time, but there are circumstances where at runtime we have more information or want to find/understand our types.
Check out this video for a tutorial on a simple use case for reflection in csharp!
Using Autofac in C# – 3 Simple Tips for Beginners
Learn how to use Autofac in C# for dependency injection! Check out these three code examples to help you get started with dependency injection in C#.
Reflection in C#: 4 Simple But Powerful Code Examples
Reflection in C# is powerful, but with great power comes great responsibility. Check out these 4 quick examples of reflection in C# to see it in action!
async await in C#: 3 Beginner Tips You Need to Know
Dive into async await in C# with these 3 beginner tips. Learn how to write async await code, handle multiple exceptions, and avoid dreaded deadlocks!
Activator.CreateInstance in C# – A Quick Rundown
Leverage Activator.CreateInstance in C#, part of reflection in C#, to create object instances! This beginner’s guide walks you through simple C# code examples.
Refactoring C# Code – 4 Essential Techniques Simplified
Learn about efficiently refactoring C# code with these 4 simple techniques! Follow along with code examples that show you how to approach refactoring.
Scrutor in C# – 3 Simple Tips to Level Up Dependency Injection
Learn how to use Scrutor in C# for dependency injection with these 3 simple tips. Try out Scrutor in your next C# application and simplify your registrations!
As always, thanks so much for your support! I hope you enjoyed this issue, and I’ll see you next week.
Nick “Dev Leader” Cosentino
[email protected]
Socials:
– Blog
– Dev Leader YouTube
– Follow on LinkedIn
– Dev Leader Instagram
P.S. If you enjoyed this newsletter, consider sharing it with your fellow developers. Let’s grow our community together!