Yes, now let’s dive a little into the subject. You know, there’s this thing called freelance work. I have gone through these paths, and I can honestly say I still am. You sit for hours coding, pushing your brain to solve a problem, and when you finally succeed, it gives you a unique sense of joy, ya know? I’m talking about those days. When I first started, everything was much different, I think. As technology advanced and needs increased, we also had to improve ourselves. Living in a beautiful city like Bursa, I was trying to establish my place in the coding world at the same time.
Technical topics can sometimes be hard to explain, I know. But I will try to simplify it as much as I can. Working with databases like C#, PostgreSQL, MySQL, dealing with PHP’s old yet still functional structure, and even using modern UI technologies like Vue… All of these became experiences for me. Especially developing REST API with C# and using ORM tools like Dapper really makes a difference in performance. Isn’t that nice?
Let’s talk a bit about this API thing. Imagine, a website or mobile app back end communicating with your code, exchanging data. One of the most common ways of this communication is through REST APIs. The C# and .NET ecosystem is very powerful here. Dapper, on the other hand, is a Micro ORM that prioritizes performance. It allows direct operations without unnecessary bulk, which is really effective in applications with high data traffic.
For example, think of a scenario: an e-commerce website. Users list products, add to cart, place orders. These all communicate through an API you wrote in the background, talking to the database. The faster and more efficiently you make this communication with tools like Dapper, the better the user experience.
Of course, there’s the technical side of it. Like mountaineering or camping, I love being in nature; it gives me a different perspective. Spending time with my wife and child is my biggest motivation. Sometimes walking through Bursa streets or discovering new places relaxes my soul. But, I have to admit, I don’t get much time to code during family moments. Still, during those times, I keep thinking of new ideas.
These ideas sometimes involve improving a piece of code, or they trigger entirely new projects. I remember once working on a project when I encountered an absurd error. The error message was so strange, it felt like it came from another universe. I spent hours on it, checked forums, and finally realized it was just a simple typo. My program failed that day 🙂 But I learned something from that mistake as well.
Now, let’s see a code example. After all this talk, it’s impossible without showing something. Imagine you want to save user information. Let’s look at a simple way to do that.
First, let’s show a wrong approach, so you can understand the mistake better. This approach isn’t very efficient in terms of performance.
// WRONG APPROACH: Might do unnecessary processing. public class WrongUserService { public void SaveUser(User user) { // Open database connection // Create SQL query // Add user info to SQL query // Execute query // Close database connection // Maybe do some logging } }
Now, the more correct, performance-efficient way with Dapper. This code directly uses database commands. It’s around 10-15 lines, I think.
// RIGHT APPROACH: Using Dapper for better performance. using Dapper; using System.Data;public class CorrectUserService { private readonly IDbConnection _dbConnection;
public CorrectUserService(IDbConnection dbConnection) { _dbConnection = dbConnection; }
public async Task SaveUserAsync(User user) { var sql = "INSERT INTO Users (FirstName, LastName, Email) VALUES (@FirstName, @LastName, @Email)"; await _dbConnection.ExecuteAsync(sql, user); } }
In this code, you see, Dapper runs SQL directly. The `ExecuteAsync` method handles the process asynchronously. Passing the user object directly as a parameter allows Dapper to match the fields automatically. Isn’t that great? Also, managing your database connection via Dependency Injection (DI) is the best approach. Instead of opening and closing the connection each time, using a single connection instance is more efficient.
Ultimately, freelancing always requires you to find the best solution. Sometimes you apply a quick fix; other times, you create a meticulously optimized structure. I think both have their place. The important thing is choosing what’s best based on project needs.
If you want to learn more, you can check out Dapper’s official site. Many examples are available on GitHub as well. For those curious:
Or, to learn more about API development with .NET, try this Google search.
Talking about these topics really adds something to a person. Sharing my experiences keeps me fresh, and I hope it can be useful to someone else too. Sometimes my mind drifts to other things, like the best coffee shop in Bursa, which I’ve recently learned about from a friend. I remember a few good places. Okay, back to our main topic now.
In conclusion, freelancing means both freedom and responsibility. Managing your own schedule, building good client relationships… all of these form a whole. Technical knowledge and experiences during this process help you grow further. It’s like… well, you get the idea 🙂
I hope what I shared gave you some ideas. Sometimes I tend to ramble a bit explaining technical stuff, but I believe you understand what I mean overall.
Yes, that’s it. I’ll keep sharing what I learn along my journey. Take care!