Mensajes recientes

Páginas: [1] 2 3 ... 10
1
Discusión General / Re:Dsipuesto a Dar Curso PHP en Puerto la Cruz-Barceona-Lecheria
« Último mensaje por jmarquett 21 de mayo de 2012, 02:24:30 pm »
que tal hermano estoy interesado en el curso
2
Cursos y Certificaciones PHP / Quiero aprender php
« Último mensaje por jmarquett 21 de mayo de 2012, 01:00:48 pm »
Me gustaria aprender a realizar web dinamicas, vivo en puerto la cruz estado anzoategui por favor urgente
3
Discusión General / Personas de Maracaibo
« Último mensaje por uokesita 20 de mayo de 2012, 02:16:35 am »
Hay al gun hilo en este foro donde pueda saber de donde son los participantes de esta comunidad?
Me gustaria saber quienes son de Maracaibo especificamente.
Para planear reuniones periodicas, user groups, charlas, etc.
4
Bases de Datos / Re:html y phpmyadmin
« Último mensaje por José Daniel 19 de mayo de 2012, 01:23:19 pm »
Hola alcedowpa,

Pásate por este enlace

http://www.webexperto.com/articulos/art/194/instalacion-de-phpmyadmin/

Y allí verás de manera clara y ejemplificada su uso.

Saludos,
5
Bases de Datos / html y phpmyadmin
« Último mensaje por alcedowpa 18 de mayo de 2012, 08:57:05 pm »
Buenas tardes, estoy diseñando un sistema informatico, tengo varias tablas y deseo llevar esos datos a mi gestor phpmyadmin. quisiera saber el codogo necesario para esto...gracias
6
Discusión General / Re:Estándares de Codificación PHP
« Último mensaje por Alexander Garzon 18 de mayo de 2012, 06:40:04 pm »
7
Ofertas de Empleo / Re:Quien consigue bases de datos?
« Último mensaje por José Daniel 18 de mayo de 2012, 02:35:42 pm »
ashrey imagino que de tipo cantv, movilnet, movistar, cicpc, etc.
8
Discusión General / Re:Estándares de Codificación PHP
« Último mensaje por José Daniel 18 de mayo de 2012, 02:34:34 pm »
Gracias Eduardo por compartir,

Un poco extensa la respuesta, quizás vendría bien un archivo adjunto o un enlace para descargar el documento ;) y así no hacer tanto scroll en el foro.
9
Ofertas de Empleo / Re:Quien consigue bases de datos?
« Último mensaje por ashrey 17 de mayo de 2012, 07:40:34 pm »
Exactamente a que te refieres?
10
Discusión General / Re:Estándares de Codificación PHP
« Último mensaje por erha 17 de mayo de 2012, 05:40:24 pm »
Amigo estos son algunos de los estándares que utilizo con codeigniter:

Encoding: UTF-8
Files
Headers
Databases (utf8_unicode_ci)


Text Files (js, php, css, etc..)
Line Jumps Unix Style (\n)
Indentation with Tabs (configurable at each IDE)


Shorts tags

INCORRECT:
<?= $var ?>

CORRECT:
<?php echo $var; ?>


PHP closing tag
End of file never include “?>”


Variable Names
Lower case separate by an underscore

INCORRECT:
$j = 'foo';
$String
$bufferedText
$groupid
$name_of_last_city_used   // too long

CORRECT:
$buffer
$group_id
$last_city


Databases
Uppercase for MySQL reserved words. Ex. SELECT FROM WHERE
Lowercase for field names using a 3 letter prefix followed by underscore ( _ ). Ex. usr_name
Plural for table names, singular for field names
Use id prefix for foreign keys only. Ex. usr_id_address
Use INNODB


Comments
Use double slash (//) for single comments
Use slash plus double asterisk (/**) just for documentation (phpDocs)


Closing Comments for control structures
Use inline comment for control structure closing brace when there’s long chunck of code between, and always in view files.

INCORRECT:
if( $foo == FALSE)
{
foreach($collection AS $item)
{
/**
*
* Big Chunk of code
*
*
*
*
*/
}
}
<?php if ($this) { ?>
   <h1>On Templates</h1>
<?php } ?>


CORRECT:
if( $foo == FALSE) {
foreach($collection AS $item) {
/**
*
* Big Chunk of code
*
*
*
*
*/
} // end foreach
} // end if
<?php if ($this) { ?>
   <h1>On Templates</h1>
<?php } // end if ?>


Functions / Methods
Use camelCase

INCORRECT:
   newclient
   Newclient
   NewClient
   new_client

CORRECT:
   newClient


Class Names
Uppercase first letter and use underscore ( _ ) bettwen words.

INCORRECT:
paidclient
Paid_client
paidClient

CORRECT:
Paid_Client


Error validation
Validate known failure conditionals first.

EXAMPLE
function foo(string $bar)
{
   if(‘’ == $bar)
{
      continue; // failure condition not met
}

// code when validation has been passed
}


Constants
Upercase always, only as long as necesary for be descriptive, no single letters. Use underscore ( _ ) between words.

INCORRECT:
myConstant   
N      // no single-letter constants
S_C_VER   // not descriptive
constants

CORRECT:
MY_CONSTANT
NEWLINE
SUPER_CLASS_VERSION


FALSE, TRUE and NULL
Upercase always.


Logical Operators
Always use && for “AND” and || for “OR”


Spacing
Always use spaces when using operators or concatenation.

INCORRECT:
if($str, 'foo')==FALSE)
$welcome_message=”Welcome ”.$name.”!”;
$sum=1+2;
for($j=0;$j<10;$j++)

CORRECT:
if ($str, 'foo') == FALSE)
$welcome_message = ”Welcome ” . $name . ”!”;
$sum = 1 + 2;
for ($j = 0; $j < 10; $j++)


Comparing Return Values and Typecasting
Always compare with “===” to check the type of var.

INCORRECT:
if (strpos($str, 'foo') == FALSE)

CORRECT:
if (FALSE === strpos($str, 'foo'))


Conditionals
Always use open and close brackets, even in one line conditions

INCORRECT:
if (FALSE === strpos($str, 'foo'));
//Do some stuff

CORRECT:
if (FALSE === strpos($str, 'foo'))
{
   //Do some stuff
}


Ternary Conditionals
Use them where possible to clarify.

INCORRECT:
$x = $parameter;
if( empty($parameter) )
{
   $x = ‘default’;
}

if ( $is_correct )
{
   doSomeStuff();
}

$value == ‘something’ && doThatStuff(); //To many operators

CORRECT:
$x = (empty($parameter)) ? ’default’ : $parameter;

$is_correct && doSomeStuff();


Code Indentation and opening braces
Use of line break mefore opening brace both for functions / methods and control structures.

INCORRECT:
function foo($bar) {
   // ...
}

foreach ($arr as $key => $val) {
   // ...
}

CORRECT:
function foo($bar)
{
   // ...
}

foreach ($arr as $key => $val)
{
   // ...
}


Strings
Use single quotes, double quotes used only when scaping variables and SQL queries. Scaped variables always between curly braces ( {$variable} ).

INCORRECT:
"My String"   
"My string $foo"
'SELECT foo FROM bar WHERE baz = \'bag\''

CORRECT:
'My simple String'
"My escaping string {$foo}"
"SELECT foo FROM bar WHERE foo = {$foo} AND bar =  'bar'"


Documentation
Following phoDoc standards, use always at Class and Function level, otherwise only if necessary.
/**
* Use phpDoc Sintax
*/

At the top of the file we have to describe the goal for the current file, the date when it was created and the author.
/**
* Use class description, use author tag for class developer,
* todo tag when not completed or for future implementations and other tags as needed
*
*  @author Developer Name <username@domain.tld>
*  @todo Something that cannot be implemented at the moment.
*/

For each function we must document it following the same structure with the following data:
/**
* Use function description followed by author tag, acces level,
* params if any, return
*
*  @author Developer Name <username@domain.tld>
*  @todo Something that cannot be implemented at the moment.
*  @access private
*  @param bool $baz
*  @return string the name of something
*/

// TODO use inline todo’s when for future refactoring
// FIXME use fixme when patching code

Saludos, espero te sirvan

Eduardo R. Hernández Arenas
PHP 5 POO y MySQL Developer 5
Páginas: [1] 2 3 ... 10
PHP de Venezuela on Facebook