Jump to content

renatov

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by renatov

  1. Thanks for your terrific explanation! I understand now the importance of abstract class with non abstract method, but when would an abstract method be better then an interface? I read that an interface acts pretty much like a bunch of abstract methods: you just define the signature and the implementing class will handle its implementation. A great example from the php manual comments is a "Database" interface. You define a necessary list of methods to handle database manipulation (listOrders(), addOrder(), removeOrder() etc) and then you tell a class to implement this interface, for example: class MySqlDatabase implements Database { function listOrders() {... etc } $database = new MySqlDatabase(); foreach ($database->listOrders() as $order) { ... Then, if you ever need to change your database, all you have to do is to implement another class with this interface and change the instantiation of $database, all the rest of the code could remain the same. This strategy seems a very good idea to me and maybe it could be done with abstract methods too, but would it be as practical as using interfaces? Abstract methods seems to me as if they were incomplete classes to be inherited for further development. When should abstract methods be used and when should we use infercaces?
  2. Hi guys, I'm studying PHP by myself (mainly using PHP manual, which lacks real world examples) and I have a question. As far as I understood, abstract classes can't be instantiated and the methods you specify as abstract must be defined by classes that extends the abstract class. Is that correct? If it is, I can't see the use of it. Are abstract classes important? What is it commonly used for in real world situations? ps: is this subforum the right place to post questions like this?
  3. Although the code is open, the support service and the warrant can be charged, and that's an option when using Ubuntu and other distros like Red Hat, Mandriva, Suse... it's a good idea, depending on the server needs.
  4. PSR says that PHP should use a mixed coding style with braces. The example one (no line break) should be used with control structures and the example two (line break) should be used with function, method and class definitions. PSR offers this example: <?php namespace Vendor\Package; use FooInterface; use BarClass as Bar; use OtherVendor\OtherPackage\BazClass; class Foo extends Bar implements FooInterface { public function sampleFunction($a, $b = null) { if ($a === $b) { bar(); } elseif ($a > $b) { $foo->bar($arg1); } else { BazClass::bar($arg2, $arg3); } } final public static function bar() { // method body } }
  5. Thanks, guys! I wasn't aware of PSR standards, I'll read it carefully. And yes, consistency is the best standard above all, I'll keep that in mind
  6. The problem with Ubuntu is not its version, is its company. Canonical has a fast paced release schedule for Ubuntu, package versions are too freshy, unstested and potentially unstable. Furthermore, Canonical's disrespect for open source principles is more than enough reason to not use its OS. The only good reason for using Ubuntu, in my opinion, is the same reason that someone would use Windows: support and warrant. If you pay these companies, when your server is screwed you can sue them and receive a payout, so instability isn't too much a problem. But even then, there would be better options, like Red Hat, which can give you support, warrant and a better product.
  7. http://en.wikipedia.org/wiki/Asperger_syndrome
  8. I'm sorry to disagree with you, but Ubuntu is very different than Debian. First of all, Ubuntu and Debian are two distinct distros and although Ubuntu uses .deb packages, the two distros are not compatible. Instructions that work on one distro might not work on the other, .deb files from one distro should never be installed on the other and so on, because configuration files are different, package versions are different, filesystem is different and many other standards are different. Furthermore, Debian servers usually runs Debian Stable (currently Debian Wheezy), which is extensively tested for years before the official release. Ubuntu, on the other hand, is based on Debian Unstable (aka Debian Sid), which is, as its name suggests, very unstable and has the least tested package versions. Ubuntu has a crazy fast paced releasing schedule, which inevitably leads to instability. For a desktop user, there might be no problem on using Ubuntu, since a crash, a security bug or a malfunction once in a while won't be too harmful. But Servers need stability. A single crash or security bug could cost a lot of money, lead to client loss etc... Ubuntu should never be used as a server. Beyond that, in my opinion, and in the opinion of many important open source developers, Ubuntu should never be used at all. It has been poorly developed and it was recently involved in serious controversies concerning open source principles. Richard Stalman himself advised all open source community to not use Ubuntu in any circunstance. You can check it here: https://www.youtube.com/watch?v=gZakKwQ-gFM http://www.fsf.org/blogs/rms/ubuntu-spyware-what-to-do
  9. Thanks for the explanation, guys! This is my 10th post, so I guess I'll try to conker the world now lol
  10. Yes, that is a great advice, thanks! PHP manual itself isn't consistent about this and it makes me confuse...
  11. Sorry, I can't program in javascript yet, I'm still learning. Could you tell me what happens, please?
  12. Hello, I would like to use an avatar image, but whenever I try to upload it, it says member_profile_disabled. Is it an error or is it meant to be this way since I'm a newbie here? Thanks for your attention.
  13. I know there is no official suggestion about how curly braces should be coded, but in your oppinion what style is a better coding practice in a professional environment? code #1 <?php function hello_world(){ echo 'Hello nurse!'; } ?> code #2 <?php function hello_world() { echo 'Hello nurse!'; } ?>
  14. possien is absolutely right! There might be nonprofit organizations and even comercial companies that support Asperger. If you built a couple of free very good looking professional sites for them, it would be a great way of appreciating their support AND an excelent way of promoting your work, becoming visible to the market.
  15. I see, thanks for your explanation, it clarifies some things to me!
  16. If you do some free works for charity, or if you work on personal projects, you could build a portifolio. You would have to find some other income source meanwhile, though.
  17. Debian is by far the best Linux distribution for servers. Ubuntu is too bugged to be used as a server (and even as a desktop, imho). Additionally, it has been poorly developed and strongly displeasing Linux and Open Source community in general. Richard Stalman officially repudiated and discouraged people from using Ubuntu, due to their recently privacy break issues and default installation of spywares.
  18. Why isn't there multiple inheritance in PHP? Is there any particular reason?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.