Want to make a career out of programming in 30 days?

Want to make a career out of programming in 30 days? Here are the things you need to know and the path you need to follow.

What are Computer Programming Languages?

Programming languages are just like human based languages, they are a set of languages that humans can use to communicate to computers, the portion of the language that computer understands is called a binary when the commands given to computer is translated to binary is called compiling, every language that exists taking the example of python to C have their own unique features although some times there are things that are in common.

These languages that are a piece of machine intelligence allows computers to process large and complex bulk of information in no time for example, if a person is given a list of random human names and is asked to place them in alphabetical order, chances are that it will take a good amount of time and will include number of errors.

MAKING A CAREER OUT OF PROGRAMMING LANGUAGES:

Programmers are a type of architects, digital architects you can say to be precise who give their time and effort to create new and amazing technologies and it is a fantastic profession, and you have probably found yourself thinking, sitting on your couch, wondering how to become a programmer.

Take a deep breath and give it a thought about all the online things you have done today like all tech-savvy people out there, you have probably checked your emails, scrolled through your social media and browsed through your favorite websites, but have you ever imagined that the virtual world that you visit every day and go by in seconds is the result of hours long full of fatigue programming work.

Programming is a fantastic career path with great potential for growth, especially since so much of our lives are now lived online and here are some statistics to prove you that

The Bureau of Labor Statistics reports that the profession will grow by a full 13 percent between 2018 and 2028 twice the average rate of growth expected for all other occupations. 

According to PayScale, the majority of programmers feel happy about their success, confident in their skills, and secure about their financial futures; the profession enjoys a 4.5 ranking (out of 5) for satisfaction.

Perhaps you also wish to be a part of this community. If yes, here are the 5 steps you can follow in becoming a successful programmer:

  1. Decide Which Industry You are Interested In
  2. Identify the Languages You Need to Learn
  3. Start Learning Independently
  4. Start Your Own Projects
  5. Begin Looking for Jobs

Top 10 programming languages:

1. Python

 Python is greatly regarded as a programming language that is easy to learn, due to its simple syntax, and a toolkit, in fact, it’s the first language that many students learn in the field of programming.

2. JavaScript

JavaScript is the most popular programming language for building interactive websites.

3. Java

Java is the programming language most commonly linked with the development of client-server applications, which are used by large businesses with masses of data around the world.

4. C#

 Microsoft developed C# as a faster and more secure variant of C. It is fully combined with Microsoft’s .NET software framework, which supports the development of applications for Windows, browser plug-ins, and mobile devices.

5. C

 Along with Python and Java, C forms a “good foundation” for learning how to program, As one of the first programming languages ever developed, C has served as the foundation for writing more modern languages such as Python, Ruby, and PHP.

6. C++

 C++ is an extension of C that works well for programming the systems that run applications, as opposed to the applications themselves. C++ also works well for multi-device and multi-platform systems. Over time, programmers have written a large set of libraries and compilers for C++.

7. Go

Also referred to as Golang, Go was developed by Google to be an efficient, readable, and secure language for system-level programming. It works well for distributed systems, in which systems are located on different networks and need to communicate by sending messages to each other. While it is a relatively new language, Go has a large standards library and is taking over the market rapidly.

8. R

R is heavily used in statistical analytics and machine learning applications. The language is extensible and runs on many operating systems. Many large companies have adopted R in order to analyze their massive data sets, so programmers who know R are in great demand. 

9. Swift

Swift is Apple’s language for developing applications for Mac computers and Apple’s mobile devices, including the iPhone, iPad, and Apple Watch. Like many modern programming languages, Swift has a highly readable syntax, runs code quickly.

10. PHPs

PHP is widely used for server-side web development, when a website frequently requests information from a server.

Why database should be taught before programming in universities?

Database Programming
Learn Database before Coding

Often students from the initial semester ask me how do we store our data in our programming projects? When students join university to learn about computer science and technology they are usually taught programming first in courses like introduction to programming. As part of the coursework, students are required to work on a project. The majority of the projects, in fact almost all projects involve data handling and that data needs to be stored somewhere, usually in databases.

Problems Students Face

As a novice students don’t know how to store data. One option is to store data in plain text files if filing is taught to them but in that case, their project becomes too complex for them. In my opinion, file format is an advanced topic for students that have just started learning how to program. So, students get stuck on where and how to store data. They create variables and arrays to store data in memory but that is not very useful until they have the option to store their data somewhere permanently that they can retrieve later. Otherwise, every time they run their project they have to feed data from the beginning.

Teach Database Before Programming

If universities modify their courses and add database in the first semester and replace programming courses with it then it would be easier for students to get started in computer science degree. Introduction to databases is a relatively easier course than programming and students will know what a database is, how to store data in the database, and how to retrieve it later using SQL. Then in the next semester if they do a programming course then it will require only one lecture to teach them how to access a database from your code and how to store and retrieve data. That will make their projects more valuable and make more sense to them and they can take it to an advanced level in forthcoming courses.

Your Take?

What is your opinion? Please, let me know in the comments.

Click here to read more about Databases.

Visual Studio 2017 is coming in March

Microsoft has announced that Visual Studio 2017 will be available for download on Tuesday, March 7, 2017. Microsoft is also celebrating a launch event. You can join at 8:00 AM PST on March 7th and 8th for a two-day online event celebrating the launch of Visual Studio 2017 and the 20-year anniversary of Visual Studio.

Let’s see what comes with a newer version of Visual Studio 2017.

Deploy your first ASP.Net MVC App to AppHarbor

If you’ve been developing ASP.Net MVC apps lately you might be thinking of some online or cloud-based app hosting platform available as PaaS for Microsoft technologies especially for hosting ASP.Net MVC apps just like OpenShift, Heroku and other platforms are available for technologies like Ruby, Python, PHP, Node.js and even supporting CMS like WordPress. The good news for ASP.Net developers is that there is a PaaS platform available that you might already know. The platform is AppHarbor. AppHarbor runs over Amazon AWS and has some nice features that I won’t go into the details of. If you are interested in knowing how AppHarbor works you can see their page here.

Regardless of whether AppHarbor provides a decent service, new developers might still face some difficulty in deploying their applications to AppHarbor. Especially, if you are developing apps based on new Visual Studio 2015 templates like MVC. There are different ways to deploy but I would follow the below approach which in my opinion is good and provide auto deployment or in other words Continuous Integration (CI).

What do you need?

We will be using the following tools and accounts.

  • Visual Studio 2015 (any edition, I used the Professional version)
  • ASP.Net MVC app created from VS2015 MVC template
  • GitHub repo for the app/project
  • Local git repo for the app with remote repo set as your GitHub app repo
  • AppHarbor app

What’s not covered?

Our focus today is the deployment of our ASP.Net MVC app to AppHarbor. Therefore, we won’t be going into the details of how the application is created or its architecture, what’s new in Visual Studio 2015, what is MVC, what is Git and GitHub, and how to connect your GitHub repo to AppHarbor etc. We will assume that you already have all the prerequisites and we will just focus on what problems can we come across during deployment and how to fix them.

Deployment Steps

  1. Initialize a Git repo and connect it with your GitHub repo.
  2. Create the AppHarbor app from your GitHub repo. Whenever we commit/push our changes to our GitHub repo AppHarbor will automatically fetch the latest push and build it. Upon successful build it will deploy the app on its server otherwise it will keep the last successful build. This makes things very easy.
  3. Create an ASP.Net MVC application using the Visual Studio 2015 MVC template.
  4. Add the packages folder to .gitignore
  5. Enable NuGet Package Restore. In VS2015 click Tools>Options and then select NuGet Package Manager and make sure both checkboxes are checked in this section.
  6. In VS2015 right click on the project and click properties, then go to the Build Events tab. In the Post-build event command line text area paste the following command.
    1. if not exist “$(WebProjectOutputDir)\bin\Roslyn” md “$(WebProjectOutputDir)\bin\Roslyn”
      start /MIN xcopy /s /y /R “$(OutDir)roslyn\*.*” “$(WebProjectOutputDir)\bin\Roslyn”
  7. Now commit and push your changes to GitHub.
  8. That’s it! AppHarbor will automatically fetch the latest version changes and build it and you can check your AppHarbor application on its URL.

What’s Next?

There are a few things that you need to take care of specially related to security. This MVC app uses SQL Server Compact which isn’t a good option for production-level apps. Secondly, your connection string or password to the database must not be committed to a public GitHub repo.

This post will just give you a smooth start without any difficulties which I faced among other people that you can see in the resources section below.

If you think this was helpful or if I have missed anything please do let me know in the comments below.

Happy coding!

Resources

  1. https://blog.appharbor.com/2012/02/06/use-nuget-package-restore-to-avoid-pushing-packages-to-appharbor
  2. https://support.appharbor.com/discussions/problems/79727-error-msb3202-when-building
  3. https://support.appharbor.com/discussions/problems/78633-cant-build-aspnet-mvc-project-generated-from-vstudio-2015-enterprise#comment_37577678

One reason why you should refactor your code often

Once upon a time, a consultant made a visit to a development project. The consultant looked at some of the code that had been written; there was a class hierarchy at the center of the system. As he wandered through the hierarchy, the consultant saw that it was rather messy. The higher level classes made certain assumptions about how the classes would work, assumptions that were embodied in inherited code. That code didn’t suit all the subclasses, however, and was overridden quite heavily. If the superclass had been modified a little, then much less overriding would have been necessary. In other places, some of the intentions of the superclass had not been properly understood, and the behaviour present in the superclass was duplicated. In yet other places several subclasses did the same thing with code that could clearly be moved up the hierarchy.

The consultant recommended to the project management that the code be looked at and cleaned up, but the project management didn’t seem enthusiastic. The code seemed to work and there were considerable schedule pressures. The managers said they would get around to it at some later point.

The consultant had also shown the programmers who had worked on the hierarchy what was
going on. The programmers were keen and saw the problem. They knew that it wasn’t really their fault; sometimes a new pair of eyes is needed to spot the problem. So the programmers spent a day or two cleaning up the hierarchy. When they were finished, the programmers removed half the code in the hierarchy without reducing its functionality. They were pleased with the result and found that it became quicker and easier both to add new classes to the hierarchy and to use the classes in the rest of the system.

The project management was not pleased. Schedules were tight and there was a lot of work to
do. These two programmers had spent two days doing work that had done nothing to add the
many features the system had to deliver in a few months’ time. The old code had worked just fine. So the design was a bit more “pure” and a bit more “clean.” The project had to ship code that worked, not code that would please an academic. The consultant suggested that this cleaning up be done on other central parts of the system. Such an activity might halt the project for a week or two. All this activity was devoted to making the code look better, not to make it do anything that it didn’t already do.

How do you feel about this story? Do you think the consultant was right to suggest further clean-up? Or do you follow that old engineering adage, “if it works, don’t fix it”?

Six months later the project failed, in large part because the code was too complex to debug or to tune to acceptable performance. The consultant was brought in to restart the project, an exercise that involved rewriting almost the whole system from scratch. He did several things differently, but one of the most important was to insist on continuous cleaning up of the code using refactoring.

This is an excerpt from the book preface “Refactoring – by Martin Fowler”.

Xdebug in WebMatrix

Xdebug is a very popular PHP extension that helps with debugging and profiling of PHP scripts by providing a lot of valuable debug information. Microsoft WebMatrix is a development tool for building web applications. When WebMatrix is used to build or modify a PHP-based web application the debugging tasks can be greatly simplified if Xdebug extension is used. This post explains how to install and use Xdebug extension with WebMatrix.

Step 1: Enable PHP in WebMatrix from the site “Settings” page:

Note that if you installed any of the PHP applications from the Application Gallery then PHP will be automatically enabled.

Step 2: Download the appropriate build of Xdebug extension from downloads page. If your site uses PHP 5.2 then download “5.2 VC6 Non-thread safe (32 bit)”. If your site uses PHP 5.3 then download “5.3 VC9 Non-thread safe (32 bit)”. Use 32 bit build even if your Windows OS is 64 bit.

Step 3: Install the extension by copying the downloaded file to the following locations:

  • For PHP 5.2 on Windows 64 bit:
    C:\Program Files (x86)\IIS Express\PHP\v5.2\ext\
  • For PHP 5.2 on Windows 32 bit:
    C:\Program Files\IIS Express\PHP\v5.2\ext\
  • For PHP 5.3 on Windows 64 bit:
    C:\Program Files (x86)\IIS Express\PHP\v5.3\ext\
  • For PHP 5.3 on Windows 32 bit:
    C:\Program Files\IIS Express\PHP\v5.3\ext\

Step 4: Open the php.ini file located in the PHP installation folder, e.g.
C:\Program Files\IIS Express\PHP\v5.2\php.ini and append the following at the end (make sure that the absolute path is correct for your version of PHP and Windows.):

[xdebug]
zend_extension = C:\Program Files\iis express\PHP\v5.2\ext\php_xdebug-2.1.0-5.2-vc6-nts.dll

Step 5: Configure PHP to display errors by changing these PHP settings in php.ini file:

display_errors = On
error_reporting = E_ALL & ~E_NOTICE

Step 6: Test that extension is enabled and works by either calling a phpinfo() function from a script or by running a buggy script:

The Xdebug extension provides a lot of useful features that help with debugging of PHP applications. You can learn more about them from the Xdebug documentation. For example you can use it to profile a PHP application. Just change the php.ini file as shown below and then make a request to a PHP script:

[xdebug]
zend_extension = C:\Program Files\iis express\PHP\v5.2\ext\php_xdebug-2.1.0-5.2-vc6-nts.dll
xdebug.profiler_enable = On
xdebug.profiler_output_dir = C:\Windows\temp

The profile log will be saved into the specified directory and will have a name cachegrind.out.* Use WinCacheGrind to open and analyze it:

How to kill your time by hardcoding?

My colleague asked me to help him solve an issue he was facing. I sat with him and after spending more than half an hour I realized that someone has hardcoded the server name :@ while we were assuming that we have already moved to another server.

The main thing to realize here is that if we have spent few more minutes in making the server name configurable at first place then we could have saved hours that we spent later just to find out that server name was hard-coded. Not doing this results in frustration, waste of time, de-motivation, brings down the moral of the team, and finally kills productivity and you lose credibility.

Common coding pitfalls developers should avoid

This article highlights some common coding pitfalls that developers make. I’ll elaborate on it with a simple example.

$obj2->FuncOne( $obj1->GetData() );
$obj2->FuncTwo( $obj1->GetData() );

The result of GetData is passed to FuncOne and FuncTwo in two subsequent calls. What is the benefit of this approach? A simple answer is to save memory, by not using any variable to save the result. This argument was very strong until there were memories with very less capacity. But now even home user has a system with memory in GBs. So this practice is not good in today’s world.

So, what’s the drawback of this approach? Performance degradation. But how can it degrade the performance? Let me explain a bit. Consider a situation where GetData runs a query on database to fetch some data from multiple tables by joining them. Joins themselves are heavy by nature. So when GetData is called twice it will run query twice, and suppose that this code snippet is a part of a heavy process that can be called by multiple users on the web or in an enterprise application, just imagine what will happen to the database and application itself. The performance of the application will be degraded. Users of your application will get frustrated and at the end you will lose business.

Now let’s look at it from another perspective. This approach will also increase the CPU workload. When GetData will be called it will jump from one branch instruction to another and before that, it has to save the current address to the stack so it can pop it back when it returns back to the caller function. This has to be done every time when function is called. And when function performs heavy computation it needs more memory and processing power, increasing the footprint of your application and execution time. So you’re wasting your servant’s (CPU) time and energy by assigning it the same task twice.

Other drawbacks can be that code is more error-prone and is difficult to debug and troubleshoot, and code maintenance is high, especially when you have to modify the code to meet new requirements.

You can make your application and code much better and more efficient by adhering to a few simple best practices. In this case, the rule is that

“If result of a function is needed more than once then don’t call that function multiple times. Save the result of that function in a variable and use that variable instead. “

In view of this, the above code could be written like this.

my $result = $obj1->GetData();
$obj2->FuncOne( $result );
$obj2->FuncTwo( $result );

There is one extra line of code in the above example but is more efficient and much more readable than the previous one.

Let’s see another example.

my $result = $obj1->GetData();
$result = { %$result, %$someData };
$obj2->FuncOne( $result );
$obj2->FuncTwo( $obj1->GetData() );

In this example, the developer fetches the result, appends another previously obtained data, and passes it to FuncOne. Then he needs the same result, so he called GetData one more time. Now again, we can write this code in a much more efficient manner.

my $result = $obj1->GetData();
my $result2 = $result;

$result = { %$result, %$someData };

$obj2->FuncOne( $result );
$obj2->FuncTwo( $result2 );

Here we have saved another call to GetData, which might be performing some heavy computation or running a heavy query with joining multiple tables in it.