Why learn and use Windows Powershell

Windows Powershell is great task automation and configuration framework for Microsoft Windows platform. As for software development, it is perfect for implementing deployment processes, like continuous integration or delivery. Moreover, it can be used in many more scenarios (backups, manage file system sources, configuration). For software developer, to learn and use Powershell is, no doubt, valuable skill to acquire.

Here are some framework capabilities:

  • Manage file system resources;
  • Manage Internet Information Services (IIS);
  • Manage Microsoft SQL Server;
  • Manage Microsoft Windows, SharePoint, Exchange servers;
  • Manage Windows Active Directory Services;
  • Manage Windows Azure;
  • Connect, manage and execute remote resources;
  • Even extend functionality with .NET Framework programming languages.

For more in depth information here are some books on the topic:

More and more Microsoft software solutions can be configured and managed with Powershell. It can be wise decision to learn framework concept, features and usage scenarios.

Windows Remote Desktop Connection (RDC) save credentials not working

It is common on Windows platform connect remote servers with Windows Remote Desktop Connection (RDC) solution. It is useful and productive to create shortcut to particular connection with saved credentials and double click to connect remote server. In Windows 7, 8, 10 be default connection credentials cannot be saved. Use Local Computer Policy Editor to solve it.

rdc

Firstly, do this and then do this. Hope it helps!

Use code snippets for productivity gains in Visual Studio

One great quality to posses  as a developer is productivity. Sometimes it is about typing code as fast as possible. If you are using Visual Studio IDE, you can use code snippets. In simple words, it is keyboard commands for code generation. You can generate properties, class constructors and so forth. You can find examples here and full list of code snippets are here. How to create custom snippet check here.

code snippet

Happy coding!

What are and why use aliases for types in C#

In C# there is number of type aliases. Is is C# programming language type names for Common Language Runtime types. I know two reasons why use them. First, type names like string and bool are common programming languages types that understand and are familiar with most developers. Secondly, it is just shorten names to type and remember. Simplicity and productivity are important qualities.

For using guidelines, usually aliases like string are used when referring to an object like string name = “Saulius”;. When referring to class use static class name String like String.Format(“Is is string.”);.

Hope it helps!

Resources

What’s the difference between String and string?

Difference between “String” and “string” in .NET and which is best?

 

Why use constant literal “” instead of string.Empty in C#

There is only subtle differences between “” and string.Empty, but indeed they are:

  1. string.Empty cannot be used in switch control statements;
  2. string.Empty cannot be used as default parameter in method;
  3. string.Empty cannot be used in attribute arguments;
  4. string.Empty cannot be used in all cases, it means lost naming consistency in project or solution;
  5. “” performance is much better in conditional statements, see resources below;
  6. always prefer compile time check instead of runtime check – “” literal is resolved on compile-time, when string.Empty literal is resolved on runtime to “”;
  7. “” takes less space, easier to write;
  8. “” is more commonly used between different programming languages.

Resources

C# string.Empty Example – Dot Net Perls

What is the difference between String.Empty and “” (empty string)?

Where possible use string object method IsNullOrWhiteSpace() instead of IsNullOrEmpty() in C#

Typical situation for bug is when developer processes string input and not check for possible whitespaces value. Where possible use method IsNullOrWhiteSpace() instead of IsNullOrEmpty(). This method additonaly checks if string contains only whitespaces. Often it is not desirable value for string.

Resources

String.IsNullOrWhiteSpace Method (String) (System) – MSDN

C# string.IsNullOrWhiteSpace Method – Dot Net Perls

First things first – learning software design and development fundamental principles

Many software developers has this conception of rapid change of what is happening nowadays in software development world. Software languages, technologies, frameworks are changing so fast and you cannot cope with it. You can not be on the wave with it. Sounds familiar? I feel your pain, my friend.

What is underneath this permanent changes? Underneath every software development language, technology, framework implementation is fundamental software design and development principles. Many times, fundamental principles are here for decades. Many times, so called new things have very much old and only little, if at all, new in them.

For example, MVC architectural pattern is implemented in many software frameworks which are used extensively nowadays. For surprise or not, Trygve Reenskaug introduced MVC into Smalltalk-76 in the 1970s. So, firstly it was implemented 45 years ago. Up to day, all pattern implementations share same fundamental principles defined by Trygve Reenskaug.

Another example, relational databases are still widely used in enterprise software applications. Edgar F. Codd defined fundamental principles of relational databases in 1970s, 45 years ago. All the implementations (Mircosoft SQL Server, Oracle, MySQL)  in its core  implement almost the design principles defined by Edgar F. Codd. Different implementations, yet same fundamental principles.

When I’m learning new software development language, technology or framework I begin with looking for fundamental principles behind its implementation. Why I do it? Many of them share same fundamental implementation principles, when you learning principles, you learn them all at once.

Top experts in any software development field knows its interest area fundamental principles, this means, they not only know how it is working, but why it was design the way it is. What core solution provided for recurring situation. Again, they learn fundamental principles. Also, this explains why they are experts on the first hand.

With practise you can also adapt thinking through fundamental principles view. Nice part of it, learning this way can benefit you not only in software development area, it can benefit any area in your life where you apply this thinking.

Firstly, look for finding and learning fundamental principles in anything you want to learn and when learn thing itself. This is how you understand more, learn more, become expert.

How to know which .NET Framework version is on server or PC and why upgrade to newer?

From time to time I’ve a task to upgrade .NET projects to newer .NET Framework version. What are the benefits of raising project to a newer version?

  • Improve libraries or applications overall perfomance;
  • Probablly less virtual memory consumption;
  • Probablly less CPU consumption;
  • Latest known bugs fixes;
  • Greater stability, reliability, security;
  • Support newer tools and the .NET community projects in general;
  • Support newer .NET framework features;
  • Support higher C# version;
  • Keeping projects attractive for developers.

In MSDN you can find very useful article how to determine which .NET Framework versions is installed on server or PC. In many cases, upgrade is not painful for project which is left behind only for 1 version back. Keep in mind, that .NET Framework breaking changes are published openly, you can google for them easilly. In my experience, most of the time, updates are not painful and if you need any help I’m willing to help you or your company. I personally recommend to upgrade to a newer major .NET release only after 3-6 months and to a minor release as soon as possible. Let’s be ahead of Microsoft .NET technology together.

Further reading