3 Tips & tricks for Kickass Developers in 2019

0

Hi,

For those looking for new ways to kick off 2019 with a bang with your .NET skills, keep on reading 🙂

1. Leverage more LINQ in your C# code

Lately, functional programming has been a really hot and trending topic. C# is becoming more of a functional programming language to stay on par with the industry trends and one of the feature that it provides to developers since .NET 3.5 (2007). It’s been then for over a decade and truly makes your code more readable.

With LINQ, you can express directly your intent when iterating through your collection instead of using a looping construct. When looking at a Where statement, immediately developers will understand that your statement is meant to filter data as opposed to writing the equivalent code in a loop, you need to look inside the loop to understand what’s going on.

2. Document your code as you type it

Something I’ve witness so much in 2018 was the lack of documentation in code. And let me tell you, 3 to 6 months after writing your own code, if you don’t maintain it for a while and it is poorly documented or even, not documented at all because you think you will remember, that’s wrong.

Writing documentation for your code shows deep understanding of your product and respect for next people in charge of maintaining the code and adding more features to it. When you need to do a knowledge transfer, it’ll be a breeze because the documentation is already there to back everything you have built from the ground up. More to the fact, if only you touch that code, you will be thankful for helpful documentation whenever a bug hits the system and you’re responsible to go through those lines and figure out where that nasty logical bug is hiding and finding a way to get rid of it.

3. Write your methods side-effects free when possible

Your code should not have the need to create side-effect. From a certain point of view, your code should strive to always generate the same output with the same input. What does that mean? It means that let’s say you create a method to increment a counter every time you click on a button in a user interface, you have in fact a mutable state that’s based on user input. So from the first time I click on button to the 100th time I click on it, I shall never have the same output since the state keeps being updated.

I’m not saying to never write mutable code. That’s not what I’m trying to share as a tip. Mutability is unavoidable, but it can be contained and isolated. Most of your code can be pure, as in stateless. You can make sure to have readonly fields and properties. You can also provide APIs that give you solely readonly collections that you can’t update. Instead of updating a meaningless field in your class that’s used only in a single method of said class, simply make it a local variable of a method and update it there. From the client’s perspective, if your method has within itself mutability, but the same input generates the same output, you’re golden 🙂

 

Kevin out.

Advertisements

FastOrder: real-time pizza order placement – Part 0

0

Hi,

I’m picking web and mobile development lately as they are super trendy at the moment. But it’s more than that. I’m a firm believer that in this profession, software development, we can’t keep still. We ought to ourselves to move way outside our comfort bubbles and try new things even if it’s a small proof of concept. We usually get to pick up more more insight on our own to approach problems and trying new techs might force us to follow the mindset of it. Doing so, we can see things in a whole new light. More than simply seeing things in a new light, we are in a profession where can do so much with just a computer, it’d be sad to keep doing the exact same thing over and over again. This brings us then to FastOrder.

C# 7.0 came out, ASP.NET Core looks hot for server development and I find that React looks a great tool for front-end development because I’m fond of functional programming. I was also thinking of mobile development and last year at a conference called “DevTeach” I was introduced to a programming language called NativeScript. This language enables programmers to do cross-platform development for both Android & iOS. Being that NativeScript uses Angular, I’ll get to work on both React and Angular and figure out what approach I prefer for front-end development.
FastOrder is an idea that came up to me. I didn’t want the usual slideshow web app or e-commerce thing that can usually find for introductory project for web development. I was gazing at my pizza one day and the idea popped in my head. What I’d like would be to showcase my own approach to design a pizza shop where clients would be notify right when cooking procedures are being completed and know where the delivery guy/girl is with their order. Being real-time, the information would always be present for the client as they request it.  This initial post is me introducing the idea on my blog. The next step will be to do the initial setup for the server and the mobile app that managers, clients and delivery people will use. I plan to use my DevSharper functional library so definitely be on the look up for progress on that project as well.

A fun thing I thought that could be done, even though it may not be realistic,  was to deploy a system where users could bet on long it would actually for the delivery. If the delivery people couldn’t manage to beat that time, that amount off the usual time needed to delivered the pizza would be deduced from the bill. Otherwise, the client would have to pay that extra 5% for instance. More than this, we can use data science on the data collected from the platform to see which pizza is the most popular or verify whenever people order pizza the most.

We’ll see what we can get out of FastOrder,

Kevin