Visual Studio Code for C# developers

I am getting really obsessed with Visual Studio Code. Either on Mac or PC, I find this powerful text editor to be my go to place for anything that has to do with a simple text editing or bug repair in C#. Of course, it is not a complete replacement for Visual Studio, but since it is a lightweight tool I have it up and running all the time.
Since Visual Studio Code is open source, a lot of talented people have created awesome extensions. I have the following collection of extensions installed.

 

Scripting with C#

There are many times that you want to try a piece of logic or simply write some code that all of it would fit on one page. Well, if you are a C# developer like myself and you love the language, you can use Visual Studio Code and Scriptcs to make scripts in C# and run them conveniently on both Mac OSX and Windows.

To start on Mac OSX, I assume that you have already installed.Net Core on your system. If you don’t know how to do this, you can go through the steps here. Also, have the latest version of Mono installed on your Mac as well. Ideally, you have installed Visual Studio for Mac as well. Assuming that you have installed all of these tools and frameworks on your Mac, we can go to the next step to get Scriptcs installed and getting it to work.

Detail steps of getting Scriptcs for Mac and Linux are listed here. I personally went through some trouble to get the code built and installed on my Mac, so I will share with you what I did.

Building the source code can be tricky. Make sure that you have the latest version of Mono installed and you have set the correct permissions for the folders, so the build process can create the necessary folders such as bin and create the .dll files.
After building the code successfully, you need to add the path to your profile. To do so, in your terminal, go to the following directory in your scriptcs solution code:

~/scriptcs/src/ScriptCs/bin/Release

make sure that file scriptcs.exe exists. Create an alias for the path to this file in your bash profile. I named the alias scriptcs.

alias scriptcs = "mono {path to scriptcs.exe}"

To make sure that everything is done right, we can execute a small script from the terminal window.

In your terminal command line type:

scriptcs or whatever alias name that you chose to point to the scriptcs.exe file. You must see the following response:

scriptcs
scriptcs (ctrl-c to exit or :help for help)
>

We are ready to type some C# command. Type:

> Console.WriteLine("Hello ScriptCS")

and you must see the following output:
Hello ScriptCS

Success! Scriptcs is working. We can press ctrl+c to exit the environment.

I use Visual Studio Code to write longer and more complicated C# scripts. In your desired destination create a folder. I have created such folder and named it Scripts under the Documents. Create a new file and name it project.json inside the Scripts folder. Open up the file by whatever text editor tool that you like, and leave empty brackets in the file {}. That is it. You will appreciate this momentarily. Save and close the file. Create another file in the same Scripts folder and name it whatever you like, but save it as .csx file.
Return to Visual Studio code and open the Scriptcs folder. It is very important to open the folder and not .csx file. Now that the folder is open, you have visibility to both project.json file and your .csx file. We will do our scripting code in the .csx file. So, the reason that we created the project.json file is that Omni Sharp is going to be triggered by this file and activate C# IntelliSense in Visual Studio Code. IntelliSense makes the coding for C# much more convenient.
Here I have written a simple code in Visual Studio Code:

Screen Shot 2017-05-21 at 7.24.20 PM

As you can see, the whole process is quite simple and the combination of Visual Studio Code and ScriptCs gives you access to C# scripting like never before.

Experiencing Visual Studio 2017

I have been toying with Visual Studio 2017 Community Edition for the past 48 hours, and unfortunately I have to say that my experience is mostly negative. Be aware if you are going to do any .Net Core project as some technologies are not ready yet and seems to be quite buggy. I also noticed that many tutorials about ASP.Net Core development that have been compiled in the past one or two years are essentially outdated. So, prepared to discover and be surprised. One thing that frustrated me for hours is the problem with ASPNetCore Web Tooling. This is a CLI tool that can generate controller and view through command line and Visual Studio relies on it to generate the controller and views. Unfortunately, Nuget package manager is not able to install it for my ASP.Net Core project without providing me with a details reason for why it doesn’t install. As a result, I can’t generate controller or views as I used to generate for other .Net frameworks. Also, as far as I am considered, ASP.Net Core project is essentially a Console app. The developer will add the middleware and other structures for a web application. Visual Studio 2017 is not able to assist you properly to convert a Console app to a Web app. If you have created a Console app then the IDE doesn’t provide you the necessary scaffolding that you need to generate other pieces of a web app. So far Visual Studio 2017 has been more problematic than helpful for me. As a professional, this is a show stopper in a production project. Stay away from it for now till Update 1 perhaps.

Time

Imagine there is a bank which credits your account each morning with $86,400. It carries over no balance from day to day, allows you to keep no cash balance, and every evening cancels whatever part of the amount you had failed to use during the day. What would you do? Draw out every penny, of course? Well, everyone has such a bank. Its name is time. Every morning, it credits you with 86,400 seconds. Every night it writes off, as lost, whatever of this you have failed to invest to good purpose. It carries over no balance. It allows no overdraft. Each day it opens a new account for you. Each night it burns the remains of the day. If you fail to use the day’s deposits, the loss is yours. There is no going back. There is no drawing against the “tomorrow”. You must live in the present on today’s deposits. Invest it so as to get from it the utmost in health, happiness and success. The clock is running. Make the most of today.

What’s happening in the Silicon Valley ?

This morning I was checking my likes on Facebook, which are mostly topics related to innovation and start up culture. I came across some disappointing articles back to back by big names such as Sean Parker ( the Justin Timberlake guy in the Social Network movie). In a Cnet article, Parker talks about the bubble that is growing in the valley and the consequences of such bubble. One part of the article grabbed my attention however. Parker talks about the team structure to make a successful company and the mismatch of talent in the start up community at the moment. Situations in which an engineer should be doing engineering work and not product management and situations in which talented people who have worked for big names in the valley quit their jobs to start a company. 

If you are in to the technology development business, you know that how hard it is to find talented people. And the talent is not all you need, but a combination of talent and personality character that starting a business demands. In some cases it is close to impossible to find the perfect talent for your needs. As a result forming a perfect team to build up a start up idea becomes impossible. So, what does an entrepreneur do? Is he going to give up because all the perfect elements are not there? 

My answer is : No, a real entrepreneur starts with what is available. You make a move, you solve one problem a day, make improvement everyday. If you don’t have the best programmer in the world, make the best out of the programmer that you have. If you don’t have the latest Macbook pro, work with the used one that you have. Use whatever that you have access to, to keep the momentum and build up. 

I wasn’t a web developer, I have become one, my used Macbook pro has crashed twice now, so I started using my Ubuntu system to keep moving the coding forward. I don’t have the best programmer in the world with me, but I get help from a professional software developer on part time bases to debug my code and solve more complex problems for me. I utilize the expertise of my friends in sales, marketing and business to take care of other aspect of building up my business. 

I have to agree with Sean Parker on one topic however. There are many start ups and people out there who got funding and they should have never been funded at first place. People with shallow ideas, people with ideas that are just copied from another business eg, daily deal sites Ughh ! and above all people who don’t have the talent and personality to take care of what it takes to start a business. The sad thing is that these people have been funded and since they are not going to deliver, it will hurt the ecosystem of start up community. Meanwhile, I keep developing my platform that I have been working on for the past couple of months.

The Golden Circle

I watched this video recently about the reasons that some brands, people and teams are more successful than others. Simon Sinek describes the pattern by 3 circles that he calls it golden circles. Then he describes that how successful brands think and act according to these circles, which is just a codified thinking process and philosophy.

Jeff Bezos and two types of companies

Jeff Bezos is at it again. A while a go, he talked about two ways of building a company and now again by introducing Kindle Fire he has mentioned two other type of companies.
He says:
“There are two types of companies: those that work hard to charge customers more, and those that work hard to charge customers less. Both approaches can work. We are firmly in the second camp.” Of course by the first one he means Apple.