Monday, January 30, 2017

D Programming - Quick Guide

D Programming - Overview

D programming language is an object oriented multi-paradigm system programming language developed by Walter Bright of Digital Mars. It's development started in 1999 and was first released in 2001. The major version of D(1.0) was released in 2007. Currently, we have D2 version of D.

D is language with syntax being C style and uses static typing. There are many features of C and C++ in D but also there are some features from these language not included part of D. Some of the notable additions to D includes,
  • Unit testing
  • True modules
  • Garbage collection
  • First class arrays
  • Free and open
  • Associative arrays
  • Dynamic arrays
  • Inner classes
  • Closures
  • Anonymous functions
  • Lazy evaluation
  • Closures

Multiple Paradigms

D is a multiple paradigm programming language. The multiple paradigms includes,
  • Imperative
  • Object Oriented
  • Meta programming
  • Functional
  • Concurrent

Example Code

import std.stdio;

void main(string[] args)
{
   writeln("Hello World!");
}

Learning D

The most important thing to do when learning D is to focus on concepts and not get lost in language technical details.
The purpose of learning a programming language is to become a better programmer; that is, to become more effective at designing and implementing new systems and at maintaining old ones.

Scope of D

D programming has some interesting features and the official D programming site claims that D is convinient, powerful and efficient. D programming adds many features in the core language which C language has provided in the form of Standard libraries such as resizable array and string function. D makes an excellent second language for intermediate to advanced programmers. D is better in handling memory and managing the pointers that often causes trouble in C++.
D programming is intended mainly on new programs that conversion of existing programs. It provides built in testing and verification an ideal for large new project that will be written with millions of lines of code by large teams.

D - Environment

Try it Option Online

You really do not need to set up your own environment to start learning D programming language. Reason is very simple, we already have set up D Programming environment online, so that you can build and execute all the available examples online at the same time when you are doing your theory work. This gives you confidence in what you are reading and to check the result with different options. Feel free to modify any example and execute it online.
Try following example using Try it option available at the top right corner of the below sample code box:
import std.stdio;

void main(string[] args)
{
   writeln("Hello World!");
}
For most of the examples given in this tutorial, you will find Try it option, so just make use of it and enjoy your learning.

Local Environment Setup

If you are still willing to set up your environment for D programming language, you need the following two softwares available on your computer, (a) Text Editor,(b)D Compiler.

Text Editor

This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi.
Name and version of text editor can vary on different operating systems. For example, Notepad will be used on Windows, and vim or vi can be used on windows as well as Linux or UNIX.
The files you create with your editor are called source files and contain program source code. The source files for D programs are named with the extension ".d".
Before starting your programming, make sure you have one text editor in place and you have enough experience to write a computer program, save it in a file, build it and finally execute it.

No comments:

Post a Comment