Finding the Maximum Sum Path in a Binary Tree

Programming Problems & Solutions: “Finding the Maximum Sum Path in a Binary Tree” is the first in this series. The introduction to this series is here and includes all links to every post in the series. If you’d like to watch the video (see just below this), or the AI code up (it’s at the bottom of the post) they’re available! But if you just want to work through the problem keep reading, I cover most of what is in the video plus a slightly different path down below.

Scroll to the bottom to see the AI work through of the code base.

Doing a little dive into the world of binary trees. If you’re in college, just got out, or having flashbacks to algorithms and data structures classes, this will be familiar territory. It’s been a hot minute since I’ve toiled through these, so figured it’d be fun to dive in again for some more modern purpose. I’m going to – over the course of the next few weeks – work through a number of algorithm and data structures problems, puzzles, katas, or what have you – and then once complete work through them with various AI tools. I’ll measure the results in whatever ways seem to bring good defining characteristics of the system and post the results. So join me, on this journey into algorithms, data structures, and a dose of AI (actually LLMs and ML but…) systems and services.

Continue reading “Finding the Maximum Sum Path in a Binary Tree”

Coding with AI: A Comparative Series

Hello fellow coders, AI nerdists (ok, IYKYK, “machine learning LLMs nerdists), and language enthusiasts! Adron here, ready to dive into an exciting new series that’s all about pushing the boundaries of our programming prowess. If you’ve followed my work, you know I’m often delving into exploring the depths of code (or systems in general), optimizing it, and sharing those insights with all of you. This time, we’re taking things up a notch by blending the art of manual code slinging and then shifting over and giving the power of artificial intelligence (AI) a try. Ok, my nitpick has already struck. This isn’t really AI but is really just the power of LLMs and machine learning, the ole’ Chat GPT and CoPilot and Claude and whatever else, that I’ll be diving into. Let’s go and put em’ to the test.

The Journey

Our journey starts with tackling programming problems the old-fashioned way: rolling up our sleeves and solving them manually. This is where we lay the groundwork, understand the problem’s intricacies, and come up with a solution that, while not perfect, gets the job done. Then, we refactor our code, streamlining and optimizing it to make it more efficient and elegant.

Enter the AI

Once we’ve got a solid foundation, it’s time to bring in the big guns – artificial intelligence. We’ll explore various AI tools, from ChatGPT-4 to Claude and beyond, to see how they tackle the same problems. Each AI brings its unique approach and strengths to the table, and we’ll break down their solutions, comparing them to our manual efforts.

Why This Matters

In today’s fast-paced tech world, understanding how to leverage AI in our coding practices is crucial. This series isn’t just about showcasing cool AI tools; it’s about understanding their capabilities, limitations, and how they can augment our problem-solving skills. By the end of this journey, you’ll have a deeper appreciation for both human ingenuity and AI’s potential.

What to Expect

In each post, you’ll find:

  • The Hand Crafted Solution: A detailed walkthrough of solving the problem by hand.
  • Refactoring: Steps to optimize and clean up the manual solution.
  • AI Solution: A deep dive into how different AI tools approach the problem.
  • Comparative Analysis: A side-by-side comparison of manual and AI-generated solutions, highlighting strengths, weaknesses, and key takeaways.
  • The links to the code repository and respective before and after of each code base commits.
  • A video walk through of the code and process I went through to get to the solution presented in each video & blog post.
  • A ordered list of the posts as I complete them at the bottom of this post. For starters, as this post has gone live the first post of the series is also live now.

So, get those keyboards and processors ready, grab your favorite code editor, overclock your proc, and join me on this ride through the world of coding with AI. Let’s push the boundaries of what’s possible, one problem at a time.

Stay tuned and happy thrashing coding!

The Ordered List of Coding with AI: A Comparative Series Posts

  1. Finding the Maximum Sum Path in a Binary Tree in C#
  2. C# Array to Phone Number String Conversion & Testing with NUnit
  3. Converting Numbers into Roman Numerals with C#: A Classical Coding Exercise
  4. Simplifying Time: Humanizing Duration in Programming in C#
  5. Conquering the Top Words Challenge in C#: A Tale of Regular Expression and LINQ Magic
  6. How to Convert an IPv4 Address to a 32-bit Integer in C#: A Step-by-Step Guide
  7. Converting 2D Arrays to CSV in Go: Problem-Solving and Testing
  8. Calculating IP Address Ranges in Go: Learn IPv4 Range Between Addresses

The Future Did Indeed Just Happen

In his insightful article, titled perfectly “The future just happened: Developer Experience and AI are now inextricably linked.“, James Governor writes about the profound ways in which artificial intelligence (AI) has become intertwined with the developer experience (DX), fundamentally altering the landscape of software development. He highlights how tools like GitHub Copilot, powered by OpenAI’s Codex, have revolutionized coding by providing real-time code suggestions and automating mundane tasks. This advancement has not only boosted productivity but also enhanced the learning curve for new developers, making complex coding tasks more accessible and manageable.

It’s a solid read, so go read it now. Then swing back and continue, as I’ve got a thing or three to tell you about AI and where development is going.

The Future Happened, So What About Tomorrow?

The integration of artificial intelligence (AI) into software development is already transforming the way developers write and manage code. Tools like GitHub Copilot, powered by OpenAI’s Codex, offer real-time code suggestions and automation for repetitive tasks. This has not only increased productivity but also democratized coding, allowing less experienced developers to tackle complex problems more efficiently.

Impact on Developer Roles

AI’s influence has shifted the dynamics between junior, senior, and principal developer roles. Junior developers now have access to sophisticated tools that help them write better code faster, reducing the gap between them and their more experienced counterparts. As AI handles more routine tasks, senior developers can focus on high-level problem-solving, architectural decisions, and mentoring juniors. Principal developers are now more involved in overseeing the integration of AI tools and ensuring they align with the company’s strategic goals.

In many ways however, this can also be seen as an increasing risk for junior developers and a growing – not a reduction in the – gap between them and senior developers. As seniors can make even more effective use of AI tooling based on their experience with pre-existing tools while junior developers don’t always know where to start or refine their query with AI tooling. Dare I say, that prompt engineering can be a real beast.

The Immediate Future

In the next 1-2 years, AI is expected to further revolutionize software development. Predictive coding, where AI anticipates and suggests entire code blocks based on previous patterns, will become more prevalent. This will speed up the development process and reduce errors. Additionally, AI-driven testing and debugging tools will enhance code quality and security by identifying vulnerabilities and performance bottlenecks more efficiently than traditional methods.

All that said, it could also lead to greater errors that are unrecoverable. It could lead to all sorts of problems we’ve yet to see. So buckle up Bucky, things could get bumpy!

Ethical and Practical Considerations

As AI becomes more ingrained in development workflows, ethical and practical considerations will arise. The potential for job displacement, the need for ongoing AI training, and the importance of maintaining a human touch in coding decisions will be critical discussion points. Companies will need to balance the benefits of AI with these challenges, ensuring that developers remain central to the development process.

The future of software development is undeniably intertwined with AI. As these technologies evolve, they will continue to redefine the roles and responsibilities within development teams, driving innovation and efficiency in unprecedented ways. If you’re not using AI tooling for your software development today you’re likely, and irreparably falling behind.

In the coming weeks, I’ll have some very thorough programming reviews around the AI tools on the market right now. So be sure to subscribe and stay tuned! Cheers, and happy thrashing code!

An Engineering Manager Challenge

This post came to mind while reading this post on LinkedIn, which is a share of this post by Kelvin Mai, and the follow up post Ted Neward made here. Read up on those for more insights into this topic.

Before diving into the details, it’s important to note that the criteria outlined here leave several questions unanswered, which could significantly impact the final decision. Factors like the specific nature of the projects, team dynamics, and long-term strategic goals are crucial and could sway the decision in different directions. That said, let’s break down the options.

Bringing on Two Junior Developers

Pros:

  1. Boosted Bandwidth: Two fresh faces mean more hands on deck to share the workload, increasing overall throughput.
  2. New Blood, New Ideas: Junior hires come with fresh perspectives and a ton of enthusiasm that can rejuvenate the team.
  3. Long-term Investment: Junior devs are like seedlings; with the right nurturing, they grow into valuable assets, contributing more as they develop.
  4. Flexibility: Juniors can be shaped to fit the team’s needs and culture, making them adaptable assets.

Cons:

  1. Boosted Bandwidth: Emphasis here though is on “throughput” above in the pros and not on committable, usable, and well written code you want and can use in the project. Increased throughput can be a negative, and IYKYK and can think of this as “induced demand” but for code.
  2. Training Time Sink: Juniors need a lot of guidance, which can be a major time drain for the senior members.
  3. Ramp-up Period: They won’t hit the ground running. Expect a learning curve before they start delivering at full capacity.
  4. Management Load: More people means more management. Even if they’re juniors, it adds to the admin overhead.

Hiring One Senior Developer

Pros:

  1. Expertise on Tap: A senior dev brings a treasure trove of knowledge and experience, perfect for tackling complex challenges and making strategic moves.
  2. Mentorship: They can mentor junior team members, leveling up the entire team’s skill set.
  3. Quick Impact: Seniors can dive in and start contributing much faster than juniors, thanks to their experience.

Cons:

  1. Higher Price Tag: Senior talent doesn’t come cheap. They’ll command a higher salary, impacting the budget more significantly.
  2. Cultural Fit Risks: There’s always the gamble that a senior hire might not mesh well with the existing team dynamics.
  3. Single Point of Failure: Relying on one senior dev for critical tasks can create dependencies, potentially leading to bottlenecks.

The “Do Nothing” Route

Pros:

  1. Save the Budget: Not hiring anyone saves money, which could be redirected elsewhere.
  2. Focus on Current Team: No new hires mean you can double down on developing and optimizing the current team.

Cons:

  1. Opportunity Cost: Leaving budget on the table means missing out on potential gains in capacity and productivity.
  2. Burnout Risk: Your current team might end up overworked, risking burnout and decreased morale.
  3. Stagnation: Without fresh talent, innovation can stagnate, and the team might struggle to keep up with growing demands.

The Decision

Let’s get real: not hiring anyone is likely the worst choice here. I know some would disagree in some situations, but if you’ve got budget allocated for new talent, use it! Even if the ROI isn’t immediate, it’s about positioning the team for long-term success. Hiring is an investment in the future—whether it’s two eager juniors ready to grow or a seasoned senior ready to lead and mentor. In this scenario, hiring one senior developer is the strategic move. You’ll get immediate expertise, mentorship for the juniors, and a stronger foundation for future growth. Let’s make that budget work for us and set the team up for success!

Addendum

This post attributed to leading me down the path to elaborate on staff and hiring details, including The Toxic Truth About Coding Challenges in Technical Interviews and then the elaboration on that post with The Reality of “Code Challenge” Culture Outcomes Among Large & Small Organizations.

What’s The Practice with Rider & .NET Solutions/Projects? How to resolve IDE errors?

Alright, I’ve fought with these kinds of things since the inception of .NET, the key difference now is that there are the variances in .NET versions and also IDEs. The question is, how should I setup my solution and respective projects?

First – .NET Solution

Usually what I do is create an empty solution. Name it, check the options accordingly to create a directory and make it a Git repository.

Then, as a kind of general practice I create a class library to build out logic and what not, and add a test project and then whatever the interface is going to be. That might be a web app, a GUI, or console as I’ve got selected here. Sometimes, if useful I go ahead and create a Dockerfile.

At this point, there are a few key problems I always bump into. Obviously, since I have a repo I need a .gitignore file, preferably a README.md, and maybe even a license file right? How does one add, so that the IDE is aware of them, any extra files at the solution level? What I usually do here, is use the terminal to just build out the solution level files, but then the IDE doesn’t know about them. Similar problems come up in the other .NET IDEs like Visual Studio and such.

Second – Open a Folder Solution

The second type of solution I find myself creating is started by opening a repo folder.

Empty, with nothing else that looks like this.

Creating a .gitignore and other respective files is easy at this point. As a right click will allow me to do just that. I’ve also added some projects.

At this point everything works great. As you can see below the runner is wired up, the IDE is aware of the tests, and runners are available for that.

One problem I’ve run into however with this technique, is sometimes I close this type of project – one started by merely opening the folder – and all this awareness just disappears. On the same machine, same folder, no deletion of the .idea folder or anything like that. It just loses all the awareness.

So my question is, which method do you use to start a project and how to do you, fellow .NET coders, work around these types of issues?