Mostrando entradas con la etiqueta PHP. Mostrar todas las entradas
Mostrando entradas con la etiqueta PHP. Mostrar todas las entradas

lunes, 4 de julio de 2011

API PROGRAMMING INTERFACE(FACEBOOK, TWITTER, PAYPAL AND OTHERS).

Nowadays we listen to talk frequently about APIs, API of Facebook, Twitter, and PayPal.

In order to understand in a right way what is an API, API are the letters for “Application Programming Interface”. An interface is “is a tool and concept that refers to a point of interaction between components, and is applicable at the level of both hardware and software”

In a very simple way is a set of structured code that permits the interaction with the properties and elements in the other side (equipment, a website, an application). In this sense we have the API for Facebook and others.

This is very important understand it because the programmer have to write code considering the different types of APIs. The APIs also has been adequated to the different languages that we use to program. On this way there are APIs of Facebook for PHP, ASP Classic, for ASP.NET, etc.

This type of code can be modified for us in order to adequate it to our needs of interaction. Is important to observer that APIs are channels to technologies and that the technologies has modifications all the time. For this reason our preferred API can suffer modifications in order to be operative.

Could be write a book for every type of API, in the next article about APIs I begin to talk about API of PHP but before this would be necessary to talk more about classes.

See you soon.

sábado, 25 de junio de 2011

Classes in PHP and Ruby

Hello guys in this opportunity I would like to share this with you.


Ruby and PHP are two languages that have many issues in common. One of theses issues are the classes:


The structure of a class in PHP is the next:


Class classname{


}


And the structure of a class in Ruby is the next:


Class classname


End


In PHP we initialize variables in this way:



Class classname {


Public $var;


}


And the methods are functions of the type:


function myfunction()


The structure of a class for PHP or Ruby has the next parts in according to its depth:


Class name


Definition of Variable (if required)


Functions (in order to establish methods)


Example in PHP:


Class Greetingseverybody {


Function writemytitle()


{


echo "Hello Guys";


}


In Ruby on Rails the class structure in on this way:


Class name


initializacion of variables(if required)


methods (with the structure Def....End)


Example in Ruby:

Class Greetingseverybody Controller

mytitle="The title I want"

def writemytitle

puts mytitle

end

This in general the structure of a class in PHP and in Ruby on Rails. In next articles I will write more in depth about classes in PHP and classes in Ruby. Also about the tools to use in order to write better code PHP and Ruby on Rails.

See you soon...