It appears that most of our SAP programmers are using the old version of ABAP, the one before object-oriented stuff. I also noticed that the language is much cleaner and more modern with OO (they apparently took the opportunity to get rid of deprecated things).
As the system is not rolled out yet, the time to make any redesign is now r...
In PHP, (unlike what i originally thought) there an overhead of calling static methods vs simple functions.
On a very simple bench, this overhead is over 30% of the calling time
(the method just returns the parameter):
// bench static method
$starttime = microtime(true);
for ($i = 0; $i< 10*1000*1000; $i++)
SomeClass::doTest($i);
ech...
I have a session class that basicly just sets and retrieves session variables,
the reason I made it was so I could easily change it to use sessions or something
like memcache to set the items and have them accessible on multiple pages without hitting the database
I then have this user class which uses the session object to get session v...
Is there any way I can persist objects in PHP?
I am creating some objects in a script, but I have to create them everytime the script is run (losing their state unless I save it to DB).
I know variables can be persisted with $_SESSION global, but should I save objects in it?
If object persistance is not possible, what's the use of OOP ...
I'd like to add additional behavior to a class derives from NSManagedObject and there are 4 distinct (for now) groups of behaviors. I don't need my decorator class to be persisted with CoreData -- it's purely for adding run-time behavior.
However, if I try to apply the standard Decorator pattern, I can't call '[super init]', which make...
Hi all,
I am tired of tutorials that just enumerate the concepts with examples. How about some tutorials that show the wrong way of doing and then the correct way of doing things? It would be great to learn things like interfaces, delegates, abstract classes, singleton ...etc that way.
It would be great to read some clean code online ...
I'm looking at OCaml's functors. It looks to me pretty identical to the so called generic objects in C++/C#/Java. If you ignore Java's type erasion for now, and ignore the implementation details for C++ templates (I'm interested with the language feature), functors are quite indentical to generics.
If I understand it correctly, functor g...
Given a fairly complex object with lots of state, is there a pattern for exposing different functionality depending on that state?
For a concrete example, imagine a Printer object.
Initially, the object's interface lets you query the printer's capabilities, change settings like paper orientation, and start a print job.
Once you start ...
Hello,
I'm creating this (big?) project in high school where I'm programming the game Shithead (card game) (so that two people can play against eachother). I'll use mostly PHP, MySQL, JavaScript and Ajax.
But I have never made a project like this before. I have only made like CMS-systems and so on. Do you guys have any tips on how I sh...
I want to store data on various engines in a MySQL database, which includes both piston and rotary engines.
In OO languages, I can create and extend an Engine superclass to obtain PistonEngine and RotaryEngine subclasses.
The PistonEngine subclass would contain properties such as CylinderNo, PistonBore and PistonStroke.
The RotaryEn...
Suppose I have a table in my database that is made up of the following columns, 3 of which uniquely identify the row:
CREATE TABLE [dbo].[Lines]
(
[Attr1] [nvarchar](10) NOT NULL,
[Attr2] [nvarchar](10) NOT NULL,
[Attr3] [nvarchar](10) NOT NULL,
PRIMARY KEY (Attr1, Attr2, Attr3)
)
Now, I have an object in my applicatio...
I know some higher level languages, all web based (PHP, javascript, some python). I've finally decided to learn a lower level language, and I've decided to go with C. The problem is that all the languages I use are based heavily on OOP. Seeing as (based on the research I did) C doesn't have classes or inheritance. As a result, I ask y...
Hello there
I am using an objected oriented MVC framework in PHP (Kohana) and have kind of mashed together a few techniques to get stuff done. Problem is I am not sure how to keep things clean without calling lots and lots of queries per page.
To illustrate my example, I'll imagine I am designing a stack overflow like site:
I have ...
I am reading a code. There is a class in which __del__ method is defined. I figured out that this method is used to destroy an instance of the class. However, I cannot find a place where this method is used. The main reason for that is that I do not know how this method is used, probably not like that: obj1.del(). So, my questions is how...
My question pertains to windows forms
Let's say I have a combobox for customer and orders, and depending on the selection made on those comboboxes I populate a datagrid for all the Order details.
I am interested in a double click event within the datagrid row.
Upon the event 2 things can happen:
the record was deleted.
one or both ...
Have a question about how to better optimize or speed things up. Currently my code seems to be running a bit slow...
I have the following classes
public class DataFoo : IFoo { }
public class Foo
{
internal IFoo UnderlyingDataObject{get;set;}
public Foo(IFoo f)
{
UnderlyingDataObject = f;
}
}
Now, in ma...
I choose to use tie and find this:
package Galaxy::IO::INI;
sub new {
my $invocant = shift;
my $class = ref($invocant) || $invocant;
my $self = {']' => []}; # ini section can never be ']'
tie %{$self},'INIHash';
return bless $self, $class;
}
package INIHash;
use Carp;
require Tie::Hash;
@INIHash::ISA = qw(Tie::StdH...
I am a CS 3rd year Student, I'm working on a project for designing a Distributed stock management system that deals with the assembly of computers. I need help, I'm having problems with designing a collaboration diagram.
...
Hello,
I have a working solution in java using a classic state design pattern and facing some difficulties translating it to ruby. I am new in ruby, but the diffuclty I believe lies in the differences on how patterns can be implemented in dynamic languages.
My interface is describing the actions the model can execute in every state:
p...
This is language agnostic, but I'm working with Java currently.
I have a class Odp that does stuff. It has two private helper methods, one of which determines the max value in an int[][], and the other returns the occurrences of a character in a String.
These aren't directly related to the task at hand, and seem like they could be reus...