Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.

I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code small data store architecture code that may help you.

From a look at your code, I am a bit confused by the naming connect and connection and the latter stores $connect in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).

  • Why are you unsetting $connect?

  • The names such as $LNK_ID are cryptic for reader.

  • I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.

OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.

I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code that may help you.

From a look at your code, I am a bit confused by the naming connect and connection and the latter stores $connect in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).

  • Why are you unsetting $connect?

  • The names such as $LNK_ID are cryptic for reader.

  • I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.

OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.

I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code that may help you.

From a look at your code, I am a bit confused by the naming connect and connection and the latter stores $connect in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).

  • Why are you unsetting $connect?

  • The names such as $LNK_ID are cryptic for reader.

  • I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.

Source Link
Dmitri Zaitsev
  • 1.3k
  • 1
  • 10
  • 26

OOP is definitely the way to go. The best advise I can offer is to read the book "Clean Code" by Uncle Bob. The code there is in Java but all principles apply equally to any other language.

I would definitely abstract the DB interface so I can use for any other database, even if you don't plan it in the next future. I have posted small data store architecture code that may help you.

From a look at your code, I am a bit confused by the naming connect and connection and the latter stores $connect in the constructor. Maybe give a more descriptive names (one of the top recommendations in the mentioned book).

  • Why are you unsetting $connect?

  • The names such as $LNK_ID are cryptic for reader.

  • I would reserve a separate class dealing with the database via thin interface (see my post) and let other classes only talk to that class instead of DB directly.

lang-php

AltStyle によって変換されたページ (->オリジナル) /