Welcome Guest, Not a member yet? Register   Sign In
Declare Members at top of Class or Just Before Use?
#13

[eluser]OliverHR[/eluser]
[quote author="n0xie" date="1286831764"]What use would declaring a variable have in a dynamic weak typed language?[/quote] Man I never say that, you Do
[quote author="n0xie" date="1286547958"]If you declare them at the top, you get the added bonus that your IDE will pick them up and will help you when using them.[/quote]

Even I think it is the right way no matter if php, vb6 an so... let to put variables in any place. what I say its if a variable its only used inside a method whay "Declare" it as a class property.

[quote author="n0xie" date="1286831764"]You use comments to declare class properties?[/quote]You are confused.

Anwser: No, I not, comment everything, but beacuse I forget to do.

But in my work I always must comment everything.(If I miss to comment my code, I could get fired)
Code:
...

/**
* example of documenting a variable's type
* @var string
*/
var $variable;
...
/**
* Bla, bla...
* @param  datatype  $paramname  description
* return  ...
*/
function do_some($paramname)
{
// some info that help
$othervar

return ...
}

???

As I say It is my point of view, I am not forcing you to do things like me.


Messages In This Thread
Declare Members at top of Class or Just Before Use? - by El Forum - 10-07-2010, 07:06 PM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-07-2010, 07:26 PM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-07-2010, 07:51 PM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-08-2010, 03:25 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-08-2010, 08:36 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-08-2010, 09:41 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-08-2010, 09:55 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-09-2010, 12:29 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-09-2010, 11:34 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-09-2010, 08:45 PM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-11-2010, 09:14 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-11-2010, 10:16 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-11-2010, 11:18 AM
Declare Members at top of Class or Just Before Use? - by El Forum - 10-11-2010, 11:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB