Re: Re: My thoughts on Xaraya

"Michael Quinn" <michael-/[email protected]>
Newsgroups gmane.comp.cms.xaraya.user
Message-ID <001101c6ddbf$fa33f940$160afea9@fibonacci>
Hi Marcel,

I have to disagree with you on code "being a universal language" as
different languages have different semantics, syntax, constructs etc.. Also
different people have very different coding styles and in most languages
there are a multitude of ways to solve a given problem.

Rather than show you an example of how I code maybe I can show you some code
in Xaraya which is poor (or does not conform to best practice), improve upon
it and thus illustrate better what I was talking about in my initial post.

1. /themes/xarclass/xarcss.class.php
Class names should begin with first letter uppercase and subsequent words
should follow suit.  note: abbreviations such as HTML or XML should be named
as follows Html, Xml.  Example class name below.

class MyXmlClass

2. /modules/articles/xaruser/display.php
  39      // Defaults
  40      if (!isset($page)) {
  41          $page = 1;
  42      }

What is 1?  This does not make sense to a developer, numeric hard coding is
bad.  A constant could be defined which could accurately describe what 1 is.
At least a comment should exist.

3. /modules/articles/xaruser/display.php
if ($preview)
This is fine, however, directly below another conditional is opened except
now it is if(!$preview)

Usage of else conditinal would have sufficed here and reduced code.

4. /modules/articles/xaruser/display.php
$ptid and $pubetypeid defined as the same thing

I need not say anything on this one.

5. /modules/articles/xaruser/display.php
Mixed case convention e.g. $pagerinfo, $themeName.

I agree with the camelCasing convention for variables passed to functions
(just to differentiate) but stick with one / two / three conventions for
variables and their differing uses in scripts and don't deviate.

6. /modules/articles/xaruser/display.php
To many blocks of and nested if statements.  90% of the time heavy functions
like this could be broken up into simpler more manageable chunks of code.

7. Many of the .php files in the system
// comment 1
// comment 2
// comment 3
Multiline comment blocks should be used where appropriate.

I don't claim to be an amazing programmer, as they are few and far between,
but I do approach problems from a pragmatic perspective and solve them step
by step with my fellow programmer in mind when doing so.  PHP is a good
scripting language but allows developers to easily develop sloppy and bad
code (no namespace, shizophrenic naming conventions, no common framework,
easy point of entry - the list goes on).  This can also be said of other
languages and I have seen some really crap VB, Delphi, SQL, HTML - you name
it, it doesn't have to be a full fledged language for a programmer to create
horrid scripts which are difficult to read / maintain.  Some coding
standards and guidelines are always a good start, good QC and a bit of
refactoring can do wonders for a system and a developers sanity ;).

The above is bread and butter stuff for programmers and the sooner SOME
products in the Open Source community adhere to these standards, the sooner
they can compete with their counterparts in the commercial arena.  Also the
developers can easily talk down assholes like me who lambast their good work
;p.

What I have listed above is just the tip of the iceberg in relation to some
of the things I have taken issue with regarding Xaraya, it's architecture
and development.  Hope this helps.

Rgds,

Michael Quinn

----- Original Message -----
From: "Marcel van der Boom" <[email protected]>
Newsgroups: xaraya.user
To: <[email protected]>
Sent: Thursday, September 21, 2006 5:06 PM
Subject: [Xaraya_user] Re: My thoughts on Xaraya


> michael wrote:
> > Do you require code that does anything in particular?
> That would be even better :-)  Code to support what's written in
> tests/xml/schemas/ddl/*  in the 2.x repository would be great :-)
>
>   Or do you just
> > wish to see if I am a good developer or not?
> > If you have a need for a class / function that does something in
> > particular I can help you out but I do not send my code to persons for
> > review.  I am happy for a peer review in a group development environment
> > where this is actually warranted and a healthy thing.
> Just curious really. Code is a universal language which doesnt leave
> room for misinterpretation, like what went on in the current thread.
> It would help clarifying your points to me. It doesnt have to be php,
> i do like 20 programming languages, so any example which clearly shows
> how you think it should be done interests me.
>
> marcel
> _______________________________________________
> Xaraya_user mailing list
> [email protected]
> http://xaraya.com/mailman/listinfo/xaraya_user
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.