Passing Arguments to a Console App using C#

In this post, we will create a console app that accepts arguments or switches. In Visual Studio, create a new console app: The args parameter gives us what the user has entered, e.g: sampleapp.exe -something /i dosomething Add some code to print the arguments the user has provided. We will print the first 2 arguments: Now, run the app and provide 2 arguments. We can see when we provide SampleArg1 … Continue reading Passing Arguments to a Console App using C#

JavaScript Error Handling

JavaScript contains different ways to handle errors. One way is using try/catch/finally. In the example below, variable y does not exist. try { var x = 1 + y; console.log(t); } catch(e) { console.log(“Error: ” + e); } finally { console.log(“Run finally”); } Running this produces: Note you can also use name, message and stack to get error information: try { var x = 1 + y; console.log(t); } catch(e) … Continue reading JavaScript Error Handling

Debugging TypeScript with Google Chrome and Node

To debug TypeScript using Visual Studio Code, install the Debugger for Chrome, located at: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome: You will see the message: The debugger will now be installed: Let’s say in our environment we have: A folder called TS with TypeScript files A TS file called HelloWorld.ts Like below: [sourcecode language=”javascript”] class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } let … Continue reading Debugging TypeScript with Google Chrome and Node

Installing TypeScript for Visual Studio Code

Visual Studio Code has support for the TypeScript language. To use it, create a new file with TypeScript code in Visual Studio Code: And save the file, we will see TypeScript as an option: We can see Visual Studio Code has TypeScript Intellisense: Visual Studio Code does not include the TypeScript Compiler (tsc). To install it using the Visual Studio Code terminal, type: npm install -g typescript You will see … Continue reading Installing TypeScript for Visual Studio Code

Scrum Daily Standup

The Scrum daily standup is a meeting that takes place each day of a sprint. The meeting is attended by the Scrum Master, Product Owner, and all team members. Other non-team members can attend the meeting in order to listen. The idea of standing up during the meeting is to ensure people don’t get too comfortable, which would lead to meeting inefficiencies such as one person dominating the meeting and … Continue reading Scrum Daily Standup

Installing TypeScript on Node

To install TypeScript on Node, run the command: npm install -g typescript Now let’s create a new TypeScript file. First create a directory for our TypeScript project called TS, and create a new file HelloWorld.ts: Run the TypeScript compiler command: tsc HelloWorld.ts This will create a new js file: With JavaScript code:  

Introduction to TypeScript

TypeScript is a superset of JavaScript developed by Microsoft that supports classes, modules and interfaces, along with several other features. It is a static type language, meaning it will validate code at development time. JavaScipt is a dynamic language, which does not validate code at development time. Having a static type language is very useful for building robust code. To try out TypeScript online, go to www.typescriptlang.org and select Playground: You will … Continue reading Introduction to TypeScript

JavaScript setTimeout and setInterval

In JavaScript, we can use setTimeout() to call a function after waiting for a specified number of milliseconds. We can provide a callback function to as well as the timeout as parameters. For example, let’s say we want to print to the console “Hello World” after waiting 2 seconds. To do this: setTimeout(function(){ console.log(“Hello World”); }, 2000); This will wait for 2 seconds before printing to the console: If we … Continue reading JavaScript setTimeout and setInterval

Dependency Inversion Principle

Dependency Inversion Principle (DIP) is a software development principle that reduces coupling between code. Robert C Martin explains DIP: High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions. Consider if you have an object that calls another object. The higher level object is dependent on the lower level object; making changes to the lower level object … Continue reading Dependency Inversion Principle

Don’t Repeat Yourself

Don’t Repeat Yourself (DRY) is a software development principle that prevents waste through the repetition of code. When code is designed and developed, it should be abstract. As a result of abstraction, the code is easier to maintain and extend. Smarter code leads to less code waste, which leads to better software. Imagine if you find a bug in one part of your code, and the bug is repeated in … Continue reading Don’t Repeat Yourself