Basics of Cloud Computing

cloud-computing-3385323_640

 

What is Cloud Computing:

Cloud computing is a technology where data is stored on the remote server on the internet.

Different operations can be done using cloud computing:

  • Store, back up or recover data on the internet.
  • Host websites or blogs.
  • Use services provided.
  • Use software provided on cloud.

Example: AWS, Azure, Google Cloud

Why Cloud Computing?

  •  Servers are required in all software companies.
  • Database server, mail servers, networking, firewalls, routers,  modem, high speed broadband internet and many maintenance engineers are required in server room.
  • Need to spend lots of money to establish and maintain the servers.
  • To overcome all these problems and IT infrastructure cost we need cloud computing.

Advantage of Cloud computing:

1. Cost Savings: Cloud computing saves cost because you don’t have to invest on physical hardware. Also no need of trained employee to maintain hardware servers. Maintenance is done by cloud service provider. You have to pay as you use the cloud services.

2. Availability: Cloud computing service providers are reliable in providing their services. These services are available 24*7. They are providing SLA of 99.9%.

3. Unlimited Storage capacity: You can choose your storage as per your business need like 2000 to 3000 GB. There is no limitations.

4. Fast Deployment: You can deploy any web sites or blog in single click.

5. Back-up and restore data: Cloud computing provider provide facility to take back and restore data automatically.

6. Easily Accessible(Mobility): Cloud computing servers and hardwares are available over internet, hence you can access servers from any where just you need internet.

7. Auto scaling: Cloud computing provides auto scaling. Hardwares like RAM, processors will be added based on user traffic for running application.

8. High speed computing power: You can select high speed hardware for your business need.

9. Low Cost Software: Cloud computing provides software to install on cloud VM. No need to buy software licenses.

10. Auto Software Updates: Software updates are handle cloud service provider and they updates software and security patches timely so no need to worried about any software updates.

 

Disadvantage of Cloud computing:

  •  Internet Connectivity: High speed internet is required for cloud computing. You can not access cloud without internet.
  • Downtime: There is chances that cloud computing provider can face power loss, internet connectivity or service maintenance issue.
  • Security: Company sensitive information’s are not secure on cloud as they claim to be. Some cloud hacking cases happen recently.
  • Technical Issue: Customers are dependent on cloud service providers for any kind of technical support for help. You can not fix technical problems by your self.

Types of Clouds(Deployement Models):

  • Public Cloud: Public cloud is accessible to every one. It is less secure.
  • Private Cloud: It is accessible within an organization. It is more secure because it is available inside the organization.
  • Hybrid Cloud: It combination of both public and private cloud. Some critical activities are performed using private cloud and other non-critical activity are performed using public cloud.
  • Community Cloud: It is for some group of organizations.

 

Cloud Services Model:

The three major Cloud Computing Offerings are:

  • Software as a Service (SaaS): This is called “On-demand software ”. You don’t have to install, setup and run the application. Service provider will do that for you. Ex: Salesforce, Dropbox, MailChimp, Microsoft Office 365
  • Platform as a Service (PaaS): You can install operating system, programming language, database and web server etc. Ex: Window Azure, Salesforce.com
  • Infrastructure as a Service (IaaS): All types of hardware’s like virtual machines, disk image library, block and file-based storage, firewalls, load balancers, IP addresses, virtual local area networks etc are provided.

Ex: Amazon EC2, Windows Azure, Rackspace, Google Compute Engine.

Why you should use C# Null Coalescing and Null Conditional Operators?

Null Coalescing operator:

Null coalescing operator is new features of C# 6.0. It uses double question mark (??). It is shorthand of “If” condition and ternary operator. It is used for null check. There are different ways to check null in C# application.

  • Null check using if else: This is traditional method to check null.
string name = Console.ReadLine();
//Null check using if else condition.
if (!string.IsNullOrEmpty(name))
{
Console.WriteLine("If Condition:" + name);
}
else
{
Console.WriteLine("Else condition: Default value");
}

Input: name=”Ram”;
Output: "If Condition:" Ram
Input: name=null;
Output: "Else condition: Default value"

Null check using ternary operator

//Null check using ternary operator
string value2 = name != null ? name : "Default";
Console.WriteLine("Ternary operator:" + value2);
Input: name= Ram;
Output: Ternary operator: Ram
Input: name=null;
Output: Ternary operator: Default

Null check using Null Coalescing

//Null check using Null coalescing operator
string value1 = name ?? "Default";
Console.WriteLine("Null Coalescing:" + value1);
Input: name= Ram;
Output: Null Coalescing: Ram
Input: name=null;
Output: Null Coalescing: Default
//Employee class
public class Employee
{
public string EmpName {get; set;}
public decimal Salary {get; set;}
}

//Nested Null coalescing operator
string val1 = null;
string val2 = null;
string val3 = null;
string val4 = null;

var nestedNullVal = val1??val2??val3??val4??"Undefine";

Output: Undefine

Console.WriteLine("Nested Value: " + nestedNullVal);

Employee employee = new Employee();

Null Conditional Operator ?. and ?[]

It is available in C# 6.0 and later, it is applicable to member access (?.) and element access (?[]). It checks for null value.

I. Member access: ?.

It is used for null check of entity when we access property inside it.

//Null conditional operator

var val = employee?.EmpName;

//Nested null conditional operator

var nullCond = employee?.EmpName?.Length;

Here we are accessing EmpName property of Employee Class. We are also finding length of EmpName property in next line.

II. Element access: ?[]

Null check of Array or list element can be done using element access.

List<Employee> employeeList = new List<Employee> { 
new Employee
{
EmpName="rajesh",Salary=10000
}
};

var emp = employeeList?[0].EmpName;
Console.WriteLine(emp);

Here employeeList is not null then access EmpName of first element of list.

Output: emp = Rajesh

employeeList = Null;

If employeeList is null then

Output: emp=null

Conclusion:

  • Null Coalescing is used to check null of object.
  • Null Coalescing can be nested.
  • Null Conditional Operators is used to check null of object when we access member or element of it.  
  • Null Conditional Operators also can be nested.
  • Both reduces line of codes.