Profile Picture

Sirwan Afifi

Stories from a web developer.

© 2018. Sirwan Afifi All rights reserved.

Working remotely

It has been 8 months and so that I have been working remotely for a startup out there. It’s been my pleasure to work with a team of great and talented members. over the past few months, I have learned a lot both in terms of technical stuff and working as a team member.

For some, this might not seem a big deal. But for me, it’s a pretty big one. So I thought it would be great to share my experiences so far.

New technology, new tools

For this project we are using .NET core and ASP.NET MVC core on top of it. The main benefit of using cutting edge technologies is that you always keep yourself updated, but you might argue that working with new and shiny things is overwhelming because the product is not mature enough to work with. But I believe that’s also another great benefit because when you encounter a bug you easily open a GitHub issue and report it. So I think it’s best of both worlds.

Estimation

At first, I couldn’t deal with an accurate estimation, after a while I figured out that the problem was the task itself, not me, if a task is a big one then estimation most likely will be accurate, so the solution of having an accurate estimation is to break the task into smaller ones.

Documentation

A key point to have a good documentation is that, it needs to be updated after the requirement is changed. In our case, there are too many changes in requirements, this makes new team members confused. In my opinion, there must be a section called changelog in the documentation so that it will be really easy to know what was the previous changes at first place. you might say it’s better to use git log but I think sometimes you don’t need to go through several file changes in git history in order to understand a small change. Another good thing for new members is having mockups. I have been always a big fan of this type development, because as you know a picture worth a thousand words.

Working in different time zones

From my point of view working in different time zones makes remote working a little bit difficult, suppose you are given a task, now you have some questions and no one is online, so in this case, you have to leave your messages on Slack or Jira in order to get your questions answered. this is really big deal for small teams.

Collaboration

Another key point in agile development is collaboration. Working in a team is not just about delivering your product as soon as possible in some sprints. the best part of an agile team is having daily/weekly standup with other members. By other members I mean Mobile developers, Backend developers, Database developers, … I think the standup shouldn’t be held separately. As a web developer, I need to know what’s going on in other parts of the application, because I think it gives developers a really good big picture.

Conclusion

All in all, it has been a great journey for me so far. because working remotely not only improves your technical ability but gives you a cultural perspective.

My first experiences with Linux

Running Window 98 on my PC was my first experience with Windows. in fact, for the last 11 years or so, Windows has been the dominant operating system that I’ve been using. So, up until now, I have been an avid fan of Windows.

Disclaimer: I’m not going to say that I’m not interested in Windows anymore, I just want to explain my experience with Ubuntu

Windows just works fine for the most part. But, as a developer, I have always felt something is missing. For solving this problem, Microsoft has tried its best bringing in tools like PowerShell and Bash to Windows. But again, with all these great features and tools, as a developer, you think something is missing.

Two weeks ago, I decided to give Linux a try, So I chose Ubuntu because it’s user-friendly and its community is huge. Actually, my goal was to do some experiments with new version of .NET called .NET Core. The experience was great. First, I created a very simple console application on Windows and deployed it as a SCD (Self-Contained Deployment):

Then, I copied the publish folder on my USB stick and finally, I could run my .NET Core application without installing the .NET runtime on the target machine:

As a .NET developer I have been waiting voraciously for such opportunity. So, I think it’s the best time to migrate to Linux.

Actually, I was amazed at the first impression because Linux has everything a developer needs out of the box. Python is already installed on the OS. This is great because there are times you want to write simple scripts, scrap a page or something like that.

Other cool features of Linux are commands like sed and grep. These tools are great whether you are a developer or a network administrator. for example, suppose that you have following content within a file named test.json:

{
   "AppName": "Simple App",
   "Website": "sirwan.info",
   "UseSqlite": false,
}

Now you want to replace all occurrence of "UseSqlite": false, to "UseSqlite": true, you can do that simply by typing this command:

cat text.json | sed 's/"UseSqlite": false,/"UseSqlite": true,/'

You can definitely do wide varaity of things using these tools, I just wanted to tell you how much I am excited about these cool stuff.

Development on Ubuntu

The good news is that .NET Core runs on Windows, Mac and Linux. In order to install .NET Core on Ubuntu you just simply need to navigate to dot.net site and download the appropriate version. after installing .NET Core, it gives you a CLI called dotnet so you can simply create, build and publish your applications using this command, for example:

dotnet new
dotnet restore
dotnet run

You can also use the editor of your choice for developing .NET Core application, personally I prefer to use Visual Studio Code or VSCode for short. because it has all great features you need:

VSCode is great, But I think using an IDE like Visual Studio gives you the power you need when are developing applications, Unfortunately, there’s no official version of Visual Studio for Linux at this time. I hope Microsoft release it for Linux users The only reason that I can’t abandon Windows is the lack of Visual Studio So I have to keep using Windows on my main machine.

Conclusion

As I mentioned Visual Studio is the only reason to not completely abandon Windows, But I will use Ubuntu for sure. This was my first attempt to use Ubuntu and I am very happy about the experience, I would like to hear your ideas about your journey.

Happy Coding :))

Environments in ASP.NET Core

In ASP.NET Core we can have different hosting environments, this is supported by an environment variable called ASPNETCORE_ENVIRONMENT. You can see this value is already set to Development:

This value is active as long as you run your application inside Visual Studio, So when you deploy your application you must change this value. Actually, this value comes from a file called launchSettings.json:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:13880/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "ProjectName": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

You can determine what the environment is by using IHostingEnvironment:

public void Configure(IApplicationBuilder app, 
	IHostingEnvironment env, ILoggerFactory loggerFactory)
{
	loggerFactory.AddConsole();

	if (env.IsDevelopment())
	{
		app.UseDeveloperExceptionPage();
	}
	else
	{
		app.UseExceptionHandler(new ExceptionHandlerOptions
		{
			ExceptionHandler = context => context.Response.WriteAsync("Opps!")
		});
	}

	// other configurations
}

This object also has a method called IsEnvironment for using custom environment:

if (env.IsEnvironment("envName"))
{
    // some config
}

One interesting thing is that the Startup class itself supports different environments, it means that for each environment you can have both Configure and ConfigureServices:

public void ConfigureDevelopment(IApplicationBuilder app, .....
public void ConfigureServicesDevelopment(IServiceCollection services)

public void ConfigureStaging(IApplicationBuilder app, .....
public void ConfigureServicesStaging(IServiceCollection services)

public void ConfigureProduction(IApplicationBuilder app, .....
public void ConfigureServicesProduction(IServiceCollection services)

Now you might ask how we can set this environment variable, well there are several ways that you can use, this great post explains them in details.