Despite its inadvisability, using PHP's shell commands to interact with non-php system commands remains a common way of quickly achieving certain results in web applications.
Has anyone abstracted out the common use cases into a class library (something in Zend maybe?) that offers a more sane/common way of handling this? Every time I en...
I've always been taught that if you are doing something to an object, that should be an external thing, so one would Save(Class) rather than having the object save itself: Class.Save().
I've noticed that in the .Net libraries, it is common to have a class modify itself as with String.Format() or sort itself as with List.Sort().
My qu...
So, I'm curious as to how Ruby is a fully object oriented language. I stumble over one problem that isn't really clear to me.
If I define a function as follows
def foo(text)
print text
end
and I define the function outside of a class, how is this function an object? I realize that I can call
foo.class
And I get NilClass. Does t...
Either in C# or Java or in any other language which follows oops concepts generally has 'Object' as super class for it by default. Why do we need to have Object as base class for all the classes we create?
When multiple inheritance is not possible in a language such as C# or Java how can we derive our class from another class when it i...
I'm developing a text comparator that supports rich text editing. Could anyone suggest me how the structure or object hierarchy of a rich text editor build with Java or other OO languages looks like?
...
Our domain model is very tightly coupled and some classes that are mapped with hibernate are 6 collections deep. Currently we don't use lazy loading for these since the business layer passes some of the higher level classes around and retrieves some of their lower level children at which time the session will have been closed. Retrieving...
I am looking for a really good learning resource for OOP if anyone can tell me please? I have found several on JAVA but I am not learning Java, I just want the fundamentals of OOP so that it gives me a good base to work from for any other language.
Any recommendations?
Thanks!
...
DISCLAIMER: I'm almost sure that I've seen the same question before but I can't find it now. If someone finds that question, please, give a link.
I heard at least two opinions on the best name for classes which implements CRUD operations: someone says that DAO is a classical name and everyone knows what it means, but others say that Man...
A side effect of this question is that I was lead to this post, which states:
Whenever isinstance is used, control flow forks; one type of object goes down one code path, and other types of object go down the other --- even if they implement the same interface!
and suggests that this is a bad thing.
However, I've used code like th...
Alonzo Church's lambda calculus is the mathematical theory behind functional languages. Has object oriented programming some formal theory ?
...
I've starting using Codeigniter for a project recently (few months ago) but its getting a little out of hand with a bunch of models that need to interact with each other and I was wondering if I should be creating a library instead?
In my case, I have a user action that happens when you win a game and it would get logged in my user_mod...
In the course of asking about catching 'divide by 0' exception, I found that with C++, we can't do that. I mean, divide by 0 doesn't throw an std::exception.
Some of the hints that I found were I have to check the value, and throw the exception by self.
I say it's confusing, as I've thought that C++ adopted the exception idea in order...
I'm wondering what more experienced developers think about how to handle almost identical processes, such as a user creating a profile and a user editing their profile. At the moment I have a single controller method and single view which handle the distinction between a new user and existing/editing user, just by passing around an $edit...
I have noticed that most PHP-based libraries or frameworks have classes that don't explicitly return the keywords TRUE and FALSE, instead:
if(condition)
{
$this->boolean_property = FALSE;
return $this->boolean_property
}
does this mean anything or is it just another "purist" move which does not present any advantage over the other...
I'm reading about constructors,
When an object is instantiated for a class, c'tors (if explicitly written or a default one) are the starting points for execution. My doubts are
is a c'tor more like the main() in
C
Yes i understand the point that you
can set all the default values using
c'tor. I can also emulate the behavior
by writ...
I am new to PHP and am trying to write a very simple class:
<?php
class Course {
private $credits;
public function getCredits() {
return $this->credits;
}
}
?>
the problem is when I load this in a browser, I see:
credits; } } ?>
so it looks like the browser is echoing all that follows "thi...
Hi everyone. I'm trying to learn object oriented programming more clearer by creating a database class in PHP.
This is what i have right now. I'm getting an error about $mysqli being an undefined variable when i try to call it using $db->query();
Please explain how to make the variable $mysqli defined.
<?php
class phpDatabaseClass ...
I'm working on a tiny web library and wonder wheter I should call the HTTP handler methods for GET, POST, PUT etc. reflectivly or not.
Fixed Methods
First the variant with an if else ... block calling methods given in the base class where they have a default implementation returning an error to the client. Since a request to an unsuppo...
Hello everybody, here's my problem:
$Me[1] = new User(1);
$Me[2] = new User(2);
$Me[3] = new User(19);
$Me[4] = new User(75);
$Me[5] = new User(100);
foreach ($Me as $k) echo $k->getId();
I'm trying to create 5 users with, of course, different ID. The problem is that the User with ID 2 'overwrite' the User with ID 1, the User with ID ...
I've got a JS object I've made, with a few prototypal functions, and calling them from within the constructor is fine, using this.[function]
But in a later event handler function, this refers to the element, and not the object, and I'm not sure how to resolve this:
It goes through the AddListener fine, the mouse down event triggers, ca...