which language is best for socket programming

It really depends on what you mean by network programming. So I’ll run through a couple possibilities. Commentators: Don’t fret if I forgot “your language.” The question is so open-ended. It’s like asking ‘What kinds of vehicles are good for getting me from New York City to Boston?’

  • You want to write a program that participates in XML-RPC or similar.
    • C# or Java
  • You are network programming in the context of a web page
    • JavaScript
  • You need some machines to talk to each other in some other existing protocol, and you need it done quickly.
    • Python or Perl
  • You need to write a distributed program that needs to be up and running all the time, not even resting for upgrades
    • Erlang
  • You need to write a distributed program that is very fast and does a bunch of things at once
  • You need to write a new network driver, for a new network protocol you thought up yourself
    • C, C++
  • You just want to network some TCP sockets together

5 Best Programming Languages to Learn for Cyber Security

1. C and C++

C and C++ are critical low-level programming languages that you need to know as a cyber security professional.

These languages provide access to low-level IT infrastructure such as RAM and system processes, which if not well protected, hackers can easily exploit.

The C programming language is the backbone of most operating systems. It is a lean, flexible, and efficient language that can be used to complete a wide range of tasks such as cryptography, image processing, and socket networking.

Essentially, C++ is usually regarded as C’s big brother — which has been concocted with crack, meth, and steroids and mixed without any favors. C++ is a fantastic language that is largely based on C’s source code.

There are several cyber security programs created using C++. For example, Nmap, the network mapper tool, is created using C++.

Here is a marvelous quote from Bjarne Stroustrup, the creator of C++:

“C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows your whole leg off.”

As a cyber security expert, if you are experienced at using C/C++ programming languages, you’ll know how to respond to attacks targeting lower level operations within your computing environment.

2. Python

Python is a high-level programming language that is increasingly becoming popular among cyber experts.

It’s gaining traction mainly because of its adherence to code readability, clear and simple syntax, and availability of an extensive number of libraries.

So, whatever task you want to do, you can always complete it easily with Python.

For example, you can use the language to send TCP-packets to machines, perform malware analysis, and create intrusion detection systems with minimal reliance on third-party tools.

However, unlike C/C++, Python is not low-level; therefore, it may not provide enough visibility to hardware resources.

Learning Python for cyber security will give you an edge in your career. You’ll be equipped with programming skills that can assist you to identify vulnerabilities and discover how to fix them.

No programming knowledge required

3. JavaScript

JavaScript is a high-level programming language, which is often referred as the “lingua franca” of the web.

JavaScript is a core technology that powers the Internet. Primarily, it’s the language that adds interactivity to web pages.

Although JavaScript was initially implemented only on the client-side in web browsers, it’s now possible to use the language in other types of host infrastructure, such as server-side in databases and offline applications like PDF programs.

Therefore, because of its extensive usage, learning JavaScript can make you go one step ahead of the hackers.

You’ll understand the concepts of how websites and other applications work and the best designs to employ to ward off malicious users.

For example, cross-site scripting is a JavaScript-based attack that involves an attacker implanting malicious code in a web application.

If you are experienced in using the JavaScript programming language, you can prevent such types of attacks from occurring.

4. PHP

PHP is a server-side programming language for developing websites. Because most websites are created using PHP, learning the language will enable you to know how to fend off intruders.

For example, DDoS (Denial-of-service) attacks usually attempt to make web applications unavailable to intended users.

With PHP programming knowledge, coupled with skills in other technologies like JavaScript, you can implement robust solutions to secure web applications.

5. SQL

SQL (Structured Query Language) is mostly used in managing data stored in databases.

Because of the current explosion of data storage systems, SQL is widely used for maintaining and retrieving data.

Similarly, hackers are increasingly orchestrating the language for damaging or exfiltrating the stored data.

For example, SQL injection attacks involve exploiting SQL vulnerabilities to steal or modify data kept in databases.

Therefore, having a good understanding of the SQL language is critical in your cyber security career.

The difference between DV and OV certificates

We know that the SSL-certificates can be divided into three types: DV, OV and EV. In this article, we will focus on the first two types of certificates, DV and OV. We will explain how they differ and when you should choose DV over OV.

DV-certificates (Domain Validation). This is the most basic level of SSL validation. The Certification Authority (CA) only ensure that you are the owner of a specific domain using the information contained in the WHOIS. Naturally, this type of certificate enables secure data encryption on your site, but it does not verify that you are the owner of a legitimate business. It is legitimate, and, most importantly, it is a very quick solution to protect your site using HTTPS. Customers seeing the padlock in your browser will have more trust in your site than before, because the padlock is a recognised sign of legitimacy.

Example of a DV certificate:

A DV certificate is fine where security is not a concern: however, attackers can also use DV-certificates on phishing sites. Unsuspecting users see the trusted pad lock and enter their personal data on the site which can then fall into the hands of fraudsters. The fact that the data channel is secured does not necessarily mean that the data will go to the right people. A user needs to be sure that the site belongs to a legitimate company if they are to make a purchase or input important information. 

For this reason, if security is a necessity for your site, we recommend an OV-certificate.

OV-certificates (Organisation Validation) are required for companies and organisations where users must enter sensitive information (credit card numbers, contact information, etc.).In particular, they are useful for e-commerce sites or online sales. An OV-certificate authenticates the owner of the site and requires legitimate business information for that company. The validation process for these certificates is longer and more detailed. The Certification Authority not only verifies the fact that you own the domain, but also the fact that you are the owner of the company. The company must be in a business registry database and in a trusted online directory (for example, dnb.com). Fraudsters cannot get an OV certificate because their organisation cannot be validated. The main advantage of getting an OV-certificate is that your company will be listed on the certificate.

Example of an OV-certificate:

  • You need to protect sensitive user data
  • You want to display your company name on a certificate (provides more trust amongst users)
  • You are planning to expand the business and grow it to a new level
  • You want people to know that the site is a legitimate organisation, and not a phishing site

You should think about switching from a DV-certificate to an OV-certificate, if:

If you want to switch from a DV-certificate to an OV-certificate, be sure to contact our experts at LeaderTelecom. Our knowledge, experience and streamlined process for dealing with the CAs will make issuing an OV-certificate easy and convenient.

Latest Version of Ionic Provides Universal Design System for Enterprises

Ionic Framework 4.0, rebuilt using open web standards, brings universal compatibility across platforms, devices, and developer frameworks—helping enterprises deliver consistent brand experiences at scale

MADISON, Wis., Jan. 23, 2019 GLOBE NEWSWIRE — Ionic, the most widely used platform for building mobile and desktop apps using web technology, has launched version 4.0 of the open source Ionic Framework. The highly-anticipated release provides a complete cross-platform UI library built on Web Components, compatible with any front-end framework. Through the use of open web standards, Ionic 4.0 helps enterprises address the growing need to adopt design systems: A centralized library of components that can be shared across teams and projects to simplify design and development while ensuring consistent brand experiences, at scale.

More than five million developers worldwide use Ionic Framework to tackle development of consumer-facing and internal enterprise applications—using one shared codebase across platforms. This level of efficiency is especially critical for companies today given the increasing demand from consumers to build connected digital experiences. Previous versions of Ionic Framework were based on Angular components and only worked with the Angular front-end framework. With the 4.0 release, Ionic has rebuilt its entire UI library using Web Components, a set of standardized APIs that make it possible to build fast, feature-rich apps that are natively supported in any modern browser on all major platforms, and are compatible with any front-end framework.

Ionic 4.0’s foundation in Web Components makes it possible for developers to build for any platform or device, no matter the tooling or front-end technologies involved. The benefits of this for individuals and enterprises, alike, include:

  1. A customizable component library that works across teams and projects: Of all cross-platform approaches, only Ionic 4.0 provides UI components that are truly customizable, reusable, and shareable across all types of applications, including iOS, Android, Desktop (Electron), and the Web (Progressive Web Apps, etc.).
  2. Faster load times and smaller sizes: The shift to Web Components means that apps built with Ionic will load significantly faster and work better in low-bandwidth environments. On top of that, the 4.0 version adds smart defaults to improve load times. Put together, these improvements have helped Ionic achieve a 100/100 in Google’s Lighthouse score for application speed and performance.
  3. Technical agility to close the talent gap: Due to the flexibility of open web standards, Ionic now give developers and teams the freedom to build with the current and emerging tools they love, including Angular, React, and Vue; thus insulating enterprises from “framework churn” and making it easier to hire and retain developer talent.

“When we look at what’s happening in the world of front-end development, we see two major industry shifts,” said Max Lynch, co-founder and CEO of Ionic. “First, there’s a recognition that the proliferation of proprietary components has slowed down development and created design inconsistencies that hurt users and brands alike. More and more enterprises are recognizing the need to adopt a design system: a single design spec, or library of reusable components, that can be shared across a team or company. Second, with the constantly evolving development ecosystem, we recognized the need to make Ionic compatible with whatever framework developers wanted to use—now and in the future. Rebuilding our Framework on Web Components was a way to address both of these challenges and future-proof our technology in a truly unique way.”

Along with the Framework, Ionic offers a powerful set of tools and services to help enterprise teams address the need for digital experiences, from Studio, its localized development environment, to Appflow, a mobile DevOps solution, and Enterprise Engine, a fully-supported version of the Ionic development ecosystem.

Ionic Framework 4.0 is now available to use with Google’s Angular web application framework, including support for Angular tooling, such as the Angular CLI and Router. Versions of Ionic with Vue and React are currently in alpha.

About Ionic

Ionic is an open source UI toolkit and developer platform that makes it simple to build, test, and deploy stunning, high-performance apps for any platform or device—all using a single codebase. Since its inception in 2013, Ionic Framework has become the #1 adopted cross-platform hybrid development framework in the world, serving a vibrant community of more than 5 million developers in over 200 countries. Ionic’s open source Framework is best known for its developer-friendly tools and services, which have helped build and power notable cross-platform apps for consumer brands like Sworkit, Shipt, and MarketWatch as well as mission-critical apps for companies like NASA and Nationwide. For more information about Ionic and its suite of tools, visit ionicframework.com.

How to Install the Ionic

Install Ionic

npm install -g ionic

First, install Node.js. Then, install the latest Ionic command-line tools in your terminal. Follow the Android and iOS platform guides to install required tools for development.

Start an app

ionic start myApp tabs

Create an Ionic App using one of our ready-made app templates, or a blank one to start fresh. Check out the Market for more designs.

For v1 projects, use the --type ionic1 flag.
  1. $ ionic start myApp blank
  2. $ ionic start myApp tabs
  3. $ ionic start myApp sidemenu

Run your app

cd myApp ionic serve

Much of your app can be built right in the browser with ionic serve. We recommend starting with this workflow.

When you're ready to deploy your app to a real device, check out our Deploying guide.

what is amazon elastic compute cloud

What Is Amazon EC2?

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

Features of Amazon EC2

Amazon EC2 provides the following features:

  • Virtual computing environments, known as instances
  • Preconfigured templates for your instances, known as Amazon Machine Images (AMIs), that package the bits you need for your server (including the operating system and additional software)
  • Various configurations of CPU, memory, storage, and networking capacity for your instances, known as instance types
  • Secure login information for your instances using key pairs (AWS stores the public key, and you store the private key in a secure place)
  • Storage volumes for temporary data that’s deleted when you stop or terminate your instance, known as instance store volumes
  • Persistent storage volumes for your data using Amazon Elastic Block Store (Amazon EBS), known as Amazon EBS volumes
  • Multiple physical locations for your resources, such as instances and Amazon EBS volumes, known as Regions and Availability Zones
  • A firewall that enables you to specify the protocols, ports, and source IP ranges that can reach your instances using security groups
  • Static IPv4 addresses for dynamic cloud computing, known as Elastic IP addresses
  • Metadata, known as tags, that you can create and assign to your Amazon EC2 resources
  • Virtual networks you can create that are logically isolated from the rest of the AWS cloud, and that you can optionally connect to your own network, known as virtual private clouds(VPCs)

7 Popular Java Frameworks for 2019

List of 7 Popular Java Frameworks for 2019

Although the list begins with the most popular one but is not an indicator of the best fit for your project. So, let’s begin without further ado.

1. Spring Framework

Any Java developer would vouch for its capability to create complex, high-performance web applications.

With simple components and configurations, this modular framework enables you to develop enterprise-level Java applications with much ease. Its DI-dependency injection feature and compatibility with other frameworks such as Kotlin and Groovy make it Java developers’ favorite.

Spring Framework utilizes inversion of control (IoC) design principle and so for developers, it is easier to focus a module on the task and free the modules from the assumptions and make programs extensible.

It has a number of modules to achieve different functionality in an application such as Spring core (Base module), Spring AOP (for cross-context logic), Spring Transaction (For transaction support), Spring MVC (Web aspect), and more.Used For

  • Enterprise Java (JEE)
  • Web application development
  • Distributed application
  • Core features can be used for creating any Java applications
  • All layer implementations of a real-time application

Advantages

  • All-inclusive programming and configuration model
  • Support traditional database RDBMS as well as new NoSQL
  • Provide backward compatibility and testability of code
  • Loose coupling can be achieved using IoC
  • Supports Aspect Oriented Programming and enables cohesive development
  • JBDC abstraction layer for exceptional hierarchy

Limitations

  • Steep learning curve, most developers struggle with IoC and Dependency Injection
  • Configurations keep on changing so developers have to keep themselves updated with the latest change.
  • Although Dependency Injection is one of its strengths, it makes the project dependent on Spring framework

2. Grails

Grails is a dynamic framework, anchored by the Groovy JVM programming language. It works with Java technologies, including Java EE containers, Spring, SiteMesh, Quartz, and Hibernate.

This open source web development framework is widely popular among Java developers for Enterprise Java Beans or EJB support. Because of this, it does not need to configure the XML and so developers can quickly start the development process of creating a robust and scalable application.Used for Building

  • Content management systems
  • e-Commerce sites
  • RESTful web services

Advantages

  • Easy to use object mapping library
  • Simple GORM
  • A controller layer built on Spring Boot
  • Flexible profiles
  • Embedded Tomcat container for on the fly reloading
  • Advanced plugin system featuring hundreds of plugins
  • A responsive and supportive communit

Limitations

  • Runtime language and so error-prone
  • Not the best choice for multi-threaded app
  • Need to purchase IntelliJ Idea, do not support any other IDE
  • Must learn Groovy language
  • Complex integration process

3. Blade

This 2015 born framework is so simple and lightweight that any developer from project’s perspective can understand it in a single day.

Based on Java 8, Blade, a lightweight MVC Framework provides a RESTful-style routing interface, making the web API cleaner and much easier to understand and synchronizing data with the website.Used For

  • Full-stack web framework for creating web applications rapidly

Advantages

  • Simple, small (smaller than 500KB) and clear coding structure
  • Multiple components to choose from
  • Multiple configuration files support
  • CSRF (Cross-Site Request Forgery) and XSS (Cross-site scripting) defense support
  • Support plug-in extensions and webjar resources
  • Embedded jetty server and template engine support

Limitations

  • Complex dependency engine
  • Lack mobile-app richness
  • Heavy documentation

4. Google Web Toolkit

GWT is a completely free, open-source framework that enables the developers to write client-side Java code and deploy it as JavaScript. Many Google products have been written using GWT such as AdSense, AdWords, Google Wallet, and Blogger.

Using this framework, developers can easily write complex browser applications rapidly. GWT allows developers to develop and debug Ajax applications in the Java language.

During deployment, its cross-compilers translate the Java Applications to standalone JavaScript files. It comes with many features such as cross-browser portability, internationalization, bookmarking, and history and management.Used For

  • Building progressive web apps
  • Creating and maintaining complex JavaScript front-end applications

Advantages

  • Supports reusable approach for common web development tasks
  • Support for full-featured Java debugging
  • Developer-friendly RPC mechanism
  • HTML Canvas support provided
  • Google APIs can be used in GWT applications
  • Developers can design applications in a pure object-oriented manner

Limitations

  • Java to JavaScript compilation is slow
  • Proprietary methods for defining the structure
  • Need to write more code even for simple things
  • Best suitable only for Java developers

5. JavaServer Faces (JSF)

JavaServer Faces makes web application development much easier leveraging on existing, standard UI and web-tier concepts. Developed by Oracle, it has a set of APIs for representing and managing UI components and custom tag library for expressing a JSF interface.

JSF is based on MVC software design pattern and has an architecture that clearly defines a distinction between application logic and representation.Used For

  • Building native applications
  • Web applications
  • Enterprise applications

Advantages

  • Create custom tags to a particular client device
  • Connect the presentation layer to the application code easily
  • Build user interfaces of reusable components
  • Use XML instead of Java for view handling

Limitations

  • Incompatibility with standard Java technologies
  • Complex to perform simple tasks
  • Lack of flexibility
  • Minimum Ajax support
  • Steep learning curve

6. Play

Its popularity can be estimated by the fact that it is widely used by top companies such as Samsung, LinkedIn, Verizon, The Guardian, and more. Since it uses an asynchronous model that allows statelessness principle, play framework offers speed, performance, and scalability.

Built upon Akka Toolkit, Play framework abridge the creation of concurrent and distributed applications on the Java Virtual Machine. Its user interface is simple and intuitive and so developers can easily understand its basic features to begin the development project quickly.Used For

  • Web applications that demand consistent content creation
  • Building Java and Scala applications for desktop and mobile interfaces

Advantages

  • Hot reload for all Java code, configurations, and templates
  • Supports non-blocking I/O which is crucial for high-performance apps
  • Open source with a large community to contribute
  • Commercial support is also available
  • Compile and runtime error can be handled well

Limitations

  • Steep learning curve, extensive documentation
  • Acts volatile sometimes

7. Struts

Here’s another enterprise-level framework maintained by Apache Software Foundation. This full-featured Java Web Application Framework allows the developers to create easy-to-maintain enterprise-level Java application.

One of the most noted features of Struts is its plugins which are basically JAR packages. Means they are portable and can be added in the classpath of the app.

For object-relational mapping, you can use the Hibernate plugin and for dependency injection, you can rely on the Spring plugin.Used For

  • Enterprise application development

Advantages

  • Well-organized JSP, Java, and Action classes that reduce development time
  • Centralized configuration, as most of the Struts values are represented in property files or XML
  • Custom JSP tags available to output the properties of JavaBeans components
  • In-built capabilities for checking form values

Limitations

  • Single ActionServlet available, which causes scalability issues
  • Lack of backward flow
  • Less transparent
  • Non-XML compliance of JSP syntax

Conclusion

When it comes to Java frameworks, keep an open mind and research which one is best for you. There are so many frameworks that will suit your project but pick the one that requires less code to write your application and is easy to manage.

Object Oriented Programming | CPP | JAVA | C# | PHP

We can imagine our universe made of different objects like sun, earth, moon etc. Similarly we can imagine our car made of different objects like wheel, steering, gear etc. Same way there is object oriented programming concepts which assume everything as an object and implement a software using different objects.

Object Oriented Concepts

Before we go in detail, lets define important terms related to Object Oriented Programming.

  • Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object.
  • Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance.
  • Member Variable − These are the variables defined inside a class. This data will be invisible to the outside of the class and can be accessed via member functions. These variables are called attribute of the object once an object is created.
  • Member function − These are the function defined inside a class and are used to access object data.
  • Inheritance − When a class is defined by inheriting existing function of a parent class then it is called inheritance. Here child class will inherit all or few member functions and variables of a parent class.
  • Parent class − A class that is inherited from by another class. This is also called a base class or super class.
  • Child Class − A class that inherits from another class. This is also called a subclass or derived class.
  • Polymorphism − This is an object oriented concept where same function can be used for different purposes. For example function name will remain same but it take different number of arguments and can do different task.
  • Overloading − a type of polymorphism in which some or all of operators have different implementations depending on the types of their arguments. Similarly functions can also be overloaded with different implementation.
  • Data Abstraction − Any representation of data in which the implementation details are hidden (abstracted).
  • Encapsulation − refers to a concept where we encapsulate all the data and member functions together to form an object.
  • Constructor − refers to a special type of function which will be called automatically whenever there is an object formation from a class.
  • Destructor − refers to a special type of function which will be called automatically whenever an object is deleted or goes out of scope.

Defining PHP Classes

The general form for defining a new class in PHP is as follows −

<?php
   class phpClass {
      var $var1;
      var $var2 = "constant string";
      
      function myfunc ($arg1, $arg2) {
         [..]
      }
      [..]
   }
?>

Here is the description of each line −

  • The special form class, followed by the name of the class that you want to define.
  • A set of braces enclosing any number of variable declarations and function definitions.
  • Variable declarations start with the special form var, which is followed by a conventional $ variable name; they may also have an initial assignment to a constant value.
  • Function definitions look much like standalone PHP functions but are local to the class and will be used to set and access object data.

Example

Here is an example which defines a class of Books type −

<?php
   class Books {
      /* Member variables */
      var $price;
      var $title;
      
      /* Member functions */
      function setPrice($par){
         $this->price = $par;
      }
      
      function getPrice(){
         echo $this->price ."<br/>";
      }
      
      function setTitle($par){
         $this->title = $par;
      }
      
      function getTitle(){
         echo $this->title ." <br/>";
      }
   }
?>

The variable $this is a special variable and it refers to the same object ie. itself.

Creating Objects in PHP

Once you defined your class, then you can create as many objects as you like of that class type. Following is an example of how to create object using newoperator.

$physics = new Books;
$maths = new Books;
$chemistry = new Books;

Here we have created three objects and these objects are independent of each other and they will have their existence separately. Next we will see how to access member function and process member variables.

Calling Member Functions

After creating your objects, you will be able to call member functions related to that object. One member function will be able to process member variable of related object only.

Following example shows how to set title and prices for the three books by calling member functions.

$physics->setTitle( "Physics for High School" );
$chemistry->setTitle( "Advanced Chemistry" );
$maths->setTitle( "Algebra" );

$physics->setPrice( 10 );
$chemistry->setPrice( 15 );
$maths->setPrice( 7 );

Now you call another member functions to get the values set by in above example −

$physics->getTitle();
$chemistry->getTitle();
$maths->getTitle();
$physics->getPrice();
$chemistry->getPrice();
$maths->getPrice();

This will produce the following result −

Physics for High School
Advanced Chemistry
Algebra
10
15
7

Constructor Functions

Constructor Functions are special type of functions which are called automatically whenever an object is created. So we take full advantage of this behaviour, by initializing many things through constructor functions.

PHP provides a special function called __construct() to define a constructor. You can pass as many as arguments you like into the constructor function.

Following example will create one constructor for Books class and it will initialize price and title for the book at the time of object creation.

function __construct( $par1, $par2 ) {
   $this->title = $par1;
   $this->price = $par2;
}

Now we don’t need to call set function separately to set price and title. We can initialize these two member variables at the time of object creation only. Check following example below −

$physics = new Books( "Physics for High School", 10 );
$maths = new Books ( "Advanced Chemistry", 15 );
$chemistry = new Books ("Algebra", 7 );

/* Get those set values */
$physics->getTitle();
$chemistry->getTitle();
$maths->getTitle();

$physics->getPrice();
$chemistry->getPrice();
$maths->getPrice();

This will produce the following result −

  Physics for High School
  Advanced Chemistry
  Algebra
  10
  15
  7

Destructor

Like a constructor function you can define a destructor function using function __destruct(). You can release all the resources with-in a destructor.

Inheritance

PHP class definitions can optionally inherit from a parent class definition by using the extends clause. The syntax is as follows −

class Child extends Parent {
   <definition body>
}

The effect of inheritance is that the child class (or subclass or derived class) has the following characteristics −

  • Automatically has all the member variable declarations of the parent class.
  • Automatically has all the same member functions as the parent, which (by default) will work the same way as those functions do in the parent.

Following example inherit Books class and adds more functionality based on the requirement.

class Novel extends Books {
   var $publisher;
   
   function setPublisher($par){
      $this->publisher = $par;
   }
   
   function getPublisher(){
      echo $this->publisher. "<br />";
   }
}

Now apart from inherited functions, class Novel keeps two additional member functions.

Function Overriding

Function definitions in child classes override definitions with the same name in parent classes. In a child class, we can modify the definition of a function inherited from parent class.

In the following example getPrice and getTitle functions are overridden to return some values.

function getPrice() {
   echo $this->price . "<br/>";
   return $this->price;
}
   
function getTitle(){
   echo $this->title . "<br/>";
   return $this->title;
}

Public Members

Unless you specify otherwise, properties and methods of a class are public. That is to say, they may be accessed in three possible situations −

  • From outside the class in which it is declared
  • From within the class in which it is declared
  • From within another class that implements the class in which it is declared

Till now we have seen all members as public members. If you wish to limit the accessibility of the members of a class then you define class members as private or protected.

Private members

By designating a member private, you limit its accessibility to the class in which it is declared. The private member cannot be referred to from classes that inherit the class in which it is declared and cannot be accessed from outside the class.

A class member can be made private by using private keyword infront of the member.

class MyClass {
   private $car = "skoda";
   $driver = "SRK";
   
   function __construct($par) {
      // Statements here run every time
      // an instance of the class
      // is created.
   }
   
   function myPublicFunction() {
      return("I'm visible!");
   }
   
   private function myPrivateFunction() {
      return("I'm  not visible outside!");
   }
}

When MyClass class is inherited by another class using extends, myPublicFunction() will be visible, as will $driver. The extending class will not have any awareness of or access to myPrivateFunction and $car, because they are declared private.

Protected members

A protected property or method is accessible in the class in which it is declared, as well as in classes that extend that class. Protected members are not available outside of those two kinds of classes. A class member can be made protected by using protected keyword in front of the member.

Here is different version of MyClass −

class MyClass {
   protected $car = "skoda";
   $driver = "SRK";

   function __construct($par) {
      // Statements here run every time
      // an instance of the class
      // is created.
   }
   
   function myPublicFunction() {
      return("I'm visible!");
   }
   
   protected function myPrivateFunction() {
      return("I'm  visible in child class!");
   }
}

Interfaces

Interfaces are defined to provide a common function names to the implementers. Different implementors can implement those interfaces according to their requirements. You can say, interfaces are skeletons which are implemented by developers.

As of PHP5, it is possible to define an interface, like this −

interface Mail {
   public function sendMail();
}

Then, if another class implemented that interface, like this −

class Report implements Mail {
   // sendMail() Definition goes here
}

Constants

A constant is somewhat like a variable, in that it holds a value, but is really more like a function because a constant is immutable. Once you declare a constant, it does not change.

Declaring one constant is easy, as is done in this version of MyClass −

class MyClass {
   const requiredMargin = 1.7;
   
   function __construct($incomingValue) {
      // Statements here run every time
      // an instance of the class
      // is created.
   }
}

In this class, requiredMargin is a constant. It is declared with the keyword const, and under no circumstances can it be changed to anything other than 1.7. Note that the constant’s name does not have a leading $, as variable names do.

Abstract Classes

An abstract class is one that cannot be instantiated, only inherited. You declare an abstract class with the keyword abstract, like this −

When inheriting from an abstract class, all methods marked abstract in the parent’s class declaration must be defined by the child; additionally, these methods must be defined with the same visibility.

abstract class MyAbstractClass {
   abstract function myAbstractFunction() {
   }
}

Note that function definitions inside an abstract class must also be preceded by the keyword abstract. It is not legal to have abstract function definitions inside a non-abstract class.

Static Keyword

Declaring class members or methods as static makes them accessible without needing an instantiation of the class. A member declared as static can not be accessed with an instantiated class object (though a static method can).

Try out following example −

<?php
   class Foo {
      public static $my_static = 'foo';
      
      public function staticValue() {
         return self::$my_static;
      }
   }
	
   print Foo::$my_static . "\n";
   $foo = new Foo();
   
   print $foo->staticValue() . "\n";
?>	

Final Keyword

PHP 5 introduces the final keyword, which prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.

Following example results in Fatal error: Cannot override final method BaseClass::moreTesting()

<?php

   class BaseClass {
      public function test() {
         echo "BaseClass::test() called<br>";
      }
      
      final public function moreTesting() {
         echo "BaseClass::moreTesting() called<br>";
      }
   }
   
   class ChildClass extends BaseClass {
      public function moreTesting() {
         echo "ChildClass::moreTesting() called<br>";
      }
   }
?>

Calling parent constructors

Instead of writing an entirely new constructor for the subclass, let’s write it by calling the parent’s constructor explicitly and then doing whatever is necessary in addition for instantiation of the subclass. Here’s a simple example −

class Name {
   var $_firstName;
   var $_lastName;
   
   function Name($first_name, $last_name) {
      $this->_firstName = $first_name;
      $this->_lastName = $last_name;
   }
   
   function toString() {
      return($this->_lastName .", " .$this->_firstName);
   }
}
class NameSub1 extends Name {
   var $_middleInitial;
   
   function NameSub1($first_name, $middle_initial, $last_name) {
      Name::Name($first_name, $last_name);
      $this->_middleInitial = $middle_initial;
   }
   
   function toString() {
      return(Name::toString() . " " . $this->_middleInitial);
   }
}

In this example, we have a parent class (Name), which has a two-argument constructor, and a subclass (NameSub1), which has a three-argument constructor. The constructor of NameSub1 functions by calling its parent constructor explicitly using the :: syntax (passing two of its arguments along) and then setting an additional field. Similarly, NameSub1 defines its non constructor toString() function in terms of the parent function that it overrides.

NOTE − A constructor can be defined with the same name as the name of a class. It is defined in above example.

Below are Top 10 Key Features of Laravel Framework, that made it distant from others.

1. It’s Modularity

In Software Industry, Modularity refers to a degree in which a large system or application components/modules may be divided into smaller components and recombined.In Modularity, you can split your business logic into different parts which belong to single Entity.Laravel provides modular development approach in form of Packages that are pluggable.

2. Authentication

Authentication is one of the most important part of any web application, developers spent enormous time writing the authentication code again & again.Laravel 5 provide simple inbuilt authentication that can be easily integrated with your Laravel application by running few artisan commands.

3. Application Logic

In Laravel Application logic is written in Controllers or directly in routes.

4. Caching

Caching is used for storage of data on a temporary basis for a while and can be retrieved quickly.Using caching can reduce the load on the database server.Laravel provides an expressive, unified API to interact with the various caching backends.Laravel supports caching backends like Memcached and Redis that are easily configured with Laravel.

5. Method or Dependency Injection

Laravel’s service container is a powerful tool for managing class dependencies and performing dependency injection in the application. Dependency injection is a fancy phrase that essentially means this: class dependencies are “injected” into the class via the constructor or, in some cases, “setter” methods.(source https://laravel.com/docs/5.5/container)

6.Routing

In Laravel Routing is used for attaching Application URLs to a specific controller action or view.In Laravel 5.4 all routes are defined in your route files under routes folder. A basic route in Laravel takes an URL and a Closure function.you can read more about routing from https://laravel.com/docs/5.5/routing.

7.Automatic Pagination

Laravel has inbuilt paginations, that elimate the headache of writting code for paginating records

8.Template Engine

Blade is a simple, yet powerful templating engine provided with Laravel. Unlike other popular PHP templating engines, Blade does not restrict you from using plain PHP code in your views. All Blade templates files should use the .blade.php extension.

9.Database Query Builder

Laravel’s database query builder provides a convenient, fluent interface to creating and running database queries. It can be used to perform most database operations in your application and works on all supported database systems. The Laravel query builder uses PDO parameter binding to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings.

10.Eloquent ORM

In Laravel Eloquent is ORM that implements Active Records.Active Record Implementation is an architectural pattern found in software engineering that stores in-memory object data in relational databases.

What is C Programming Language?

C is a procedural programming language. It was initially developed by Dennis Ritchie between 1969 and 1973. It was mainly developed as a system programming language to write operating system. The main features of C language include low-level access to memory, simple set of keywords, and clean style, these features make C language suitable for system programming like operating system or compiler development.
Many later languages have borrowed syntax/features directly or indirectly from C language. Like syntax of Java, PHP, JavaScript and many other languages is mainly based on C language. C++ is nearly a superset of C language (There are few programs that may compile in C, but not in C++).