I write a lot of scripts in Python to analyze and plot experimental data as well as write simple simulations to test how theories fit the data. The scripts tend to be very procedural; calculate some property, calculate some other property, plot properties, analyze plot...
Rather than just writing a procedure, would there be an benefits...
I'm doing this to learn about class creation and to test geometry routines. As I build the class I will add other polygon-related functionality like getting the bounding box, determining convexity, turning the poly into triangles and the like.
Is it best to put that kind of code in functions or in methods of the class?
...
In Java, is it possible to override member data in a subclass and have that overridden version be the data used in a super class's implementation?
In other words, here's what I am trying to get to happen, and it's not happening:
abstract public class BasicStuff {
protected String[] stuff = { "Pizza", "Shoes" };
public ...
Hi, I've just reviewed some code that looked like this before
public class ProductChecker
{
// some std stuff
public ProductChecker(int AccountNumber)
{
var account = new AccountPersonalDetails(AccountNumber);
//Get some info from account and populate class fields
}
public bool ProductACriteri...
I was wondering if there is some standard way to divide a class into regions.
almost every project is using a different "region approach" (even classes within the same project).
We pay so much attention to naming conventions and so little to the class's structure. I think that introducing some standard will make it much easier on us to ...
Hi all,
I'm sorry if my question isn't clear.
I have a class contain some properties and one of them is "Parent" which the same type of this class.
when i read data from Database i set the suitable value for each property. But how could i put the "Parent" property when i read it from database as "ParentID".
If it's not clear I'll put...
I am implementing a singleton class in Java to make sure no more than one instance of the class is created.
...
I read at many places that singletons can use interfaces. Some how I am unable to comprehend this.
...
I am running a service A which has a class X. I am going to deploy another service B on same machine which is using this class X. How can I make sure that the same instance of service A is reused instead of another.
PS:Service written in JAVA.
Adding: Both these services are Axis2 services. Service B is hot-deployed. Service B used cla...
I have a domain model that is trivially represented by the following.
IMyInterface
ClassA : IMyInterface
ClassB : IMyInterface
What I want is to implement IEquatable in such a way that I can write code something like.
if(dynamicallyCreatedInstanceOfClassA == dynamicallyCreatedinstanceOfClassB)
{
// Do something relevant
}
My fi...
Hi,
I have a class called MembershipHelper, which I am using in my ASP.NET project. It looks like this:
Public Class MembershipHelper
Public Shared Function IsMultiStoreUser() As Boolean
return Roles.IsUserInRole(....)
End Function
Public Shared Function IsAdmin() As Boolean
return Roles.IsUserInRole(....)
...
I have a large tree-like data structure of objects which behave mostly identical but differ in one or two methods that calculate some keys used to navigate through the structure. The divergent behaviour depends on where the objects are in the structure.
I was starting out with an abstract base class and have several subclasses that impl...
Hello,
This is something I find rather curious, that a lot of third party libraries such as FileHelpers and Command Line Parser are designed to work at field level rather than property level.
Is there a particular reason why so many have chosen to target their tools at public fields rather than properties?
My personal feeling is that p...
Hi,
I recently posted this C++ DAL question about how best to design a 'loadCar' method in a C++ DLL, with the consensus being that 'bool DAL::loadCar(int id, Car&) {}' would be the best signature to use.
Now, it so happens that in a lot of our use cases the client code will often want to retrieve the car's manufacturer with the car ob...
how can i store different data enetered using multiple steps?
Its 4-5 step procedure, user can go through each step & at the final submission i want to store it in database.
I want to create class to store this data & store the data in object of that class & use it from session.
I just want to know what type should i use to store multipl...
I'm working on a custom user control. How can I prevent the HEIGHT ONLY of the control from being modified during the design-time interface.
...
All,
I recently posted this question on DAL design. From that it would seem that passing a reference to an object into a function, with the function then populating that object, would be a good interface for a C++ Data Access Layer, e.g.
bool DAL::loadCar(int id, Car& car) {}
I'm now wondering if using a reference to a boost::shar...
I have a class, which returns three properties. First property is dependent on some parameter, second one is dependent on the first property and third one is dependend on the second property.
What is the best way, to implement this type of class, is there a appropriate design pattern for this one? Below I pasted two versions of my code...
Is there a concept in C# of class definition and implementation similar to what you find in C++?
I prefer to keep my class definitions simple by removing most, if no every, implementations details (it depends on several factors as you may know, but generally I move towards leaving most member implementation details outside the class def...
When I design a class I often have trouble deciding if I should throw an exception or have 2 func with the 2nd returning an err value. In the case of 2 functions how should I name the exception and non exception method?
For example if I wrote a class that decompresses a stream and the stream had errors or incomplete I would throw an exc...