I find it difficult to determine the responsiblity of classes: do i have to put this method in this class or should I put this method in another class? For example, imagine a simple User class with an id, forname, lastname and password. Now you have an userId and you want the forname and lastname, so you create a method like: public User...
Hi PPL.
I want to create 2 separate pickers in the same view using the same viewController.
But how do I set separate delegates and datasource for them?
Can't seem to get it working. They show up with the same data. If you have any sample code on this it will be much appreciated.
Thanks.
...
Hi,
Let's say I have a class Person, with a string[] nickNames, where Person can have 0 or more nicknames stored. I want to create an asp.net page where a user can go and add/edit/delete nicknames.
Question is- how to i persist the Person object between postbacks? I query the DB and create the object then display it on a form, but the...
Below is a Class I created to track the current Person in my glorified Data Entry and retrieval app. Once they select a person it calls the constrtuctor which then calls the database to fill in all the rest of the info. Also, throughout the program they will be able to change the various fields.
With this in mind do I have the below...
I got some set of base classes within one namespace and few sets of derived classes in other namespaces. Everything in one project. Something like:
Namespace Base
Public Class BaseElement
Protected Friend Readonly Property SubElements() as BaseElements
End Class
End Namespace
...
Namespace Books
Public Class Book
Inherits Base.B...
If Ruby gets invited to a party and brings:
foobarobject.send('foomethod')
.. and Python gets invited to the same party and brings:
getattr(foobarobject, 'foomethod')()
.. what does PHP have to bring to the party?
Bonus question: If Ruby and Python got jealous of PHP's party-favors, what English terms would they search for in PHP...
Is there a template that can be used to create threads when we program in
OO language ?
How to go about designing a threading package for an OO language?
...
It seems difficult to design a threading package in OO class than in
functional programming.
...
I have two tables (item and category, I think they speak for themselves) and two associated model objects. I'm facing a design decisions in the function that fetches 1 item from the database. I need this method to also return the category (name, not just id) of the item.
I have two options:
In the item model, use an SQL join to get th...
I have a main application class, which contains a logger, plus some general app configurations, etc.
Now I will display a lot of GUI windows and so on (that will use the logger and configs), and I don't want to pass the logger and configurations to every single constructor.
I have seen some variants, like declaring the main class ext...
Let's say I have a model Address which get entered from UI. I have to validate that the address never gets saved into a system in an incomplete state (whatever that might mean to the business).
When the user enters an address in the UI, it gets serialized into an Address object.
So I was wondering: where does a method like "isComplete" ...
Hello there
I'm writing a parallel evolutionary algorithm library using C++, MPI and CUDA. I need to extract the raw data from my object oriented design and stick it into a flat array (or std::vector using stl-mpi) for it to be sent across to nodes or the cuda device.
The complete design is quite complex with a lot of inheritance to k...
Hi,
I am working on a small educational project to exercise perst.net.
We have a tiny design problem, that is how to best resolve the relation between two classes of objects, that is the participant and championship. It is a many to many relation as participant can take part in many championships and championships can have a multiple p...
Is it worth extracting private methods for code that only gets called once in a class, or leaving the code in the parent method (maybe) with a comment that says what it does?
...
We use spring validation to validate our models before stuffing them into the database .
So for example an
Order --> OrderItem
before saving the order to the database it is validated by OrderValidator
OrderValidator validates order delegates to OrderItemValidator for validating OrderItem with the Order. So the hierarchy or valid...
Hi Guys,
I was passing a test and met a question in which we didn't find an agreement with my colleagues.
С++
1 class Base {};
2 class Derived : public Base {};
3 class Foo
4 {
5 public:
6 Foo()
7 {
-8- Base* b = new Derived(); // Concept name is?
9 }
10 };
C#
1 abstract class Base{}
2 publi...
I'm trying to move into OOP development and am turning to here as I'm sick of searching the web and finding only the very basic information about what classes are and how they can inherit from each other - that I understand.
What I don't understand as yet is how all these classes can be stored in different files, doted around a folder s...
I have a fairly large CRUD winform app that is set up to display forms embedded in tabcontrols. I want to have objects for Person,(has a) Enrollment,(has a) Plan that hold and track the information as they interact with the forms. How do I accomplish this? I found a suggestion to declare the Person object in my Program.cs like so --> ...
i want to check if a class is an instance of another without creating an instance.
i have a class that receives as a parameter a class name, and as a part of the validation process, i want to check if its of a specific class family (to prevent security issues an such). any good way of doing this?
...
Suppose I create a some client code consisting of a couple of classes. A user is able to create a class/object that causes an exception to be thrown. Is this bad design? Should your ideal code be such that it is impossible for someone to cause an exception?
...