is an abstract class a type of interface?
In my /interfaces folder I put all my interfaces. Is an abstract class a type of interface? ...
In my /interfaces folder I put all my interfaces. Is an abstract class a type of interface? ...
I just noticed this behavior today - weird, I'm pretty sure in java a you can only access protected methods upstream on the inheritance chain since going the other way violates encapsulation. Was there a reason for this behavior in the language? ...
Let's say I have a class which has three properties as below. public class Travel { public int MinAirportArrival { get; set; } public int MinFlightTime { get; set; } public int TotalTravelTime { get; set; } } TotalTravelTime must be at least the sum of MinAirportArrival and MinFlightTime but could also be more in the event the...
I have been reading Robert C. Martin's (aka Uncle Bob) books very intensely as of late. I have found a lot of the things he talks about to be real life savers for me (small function size, very descriptive names for things, etc). The one problem I haven't gotten past yet is code coupling. One problem I keep having over and over is that ...
When performing a long operation in your application, how do you promote information from your business tier to your UI? Events? Passing in a status object which is hooked to the UI? Before I start I just wondered what cunning ways you guys and girls have come up with. ...
hi, I'm tired of looking after a frame work for mvc implementation. i want to build a good MVC based structure of my own that will serve me in my projects. so here is my thinking I'd like to know what do you think. first of all. here is the folder structure: The folder structure the Admin and the Site folders: I assume that the contro...
I'm trying to set up a new class for my web application, rewriting my code starting from original procedural programming. Since I need to populate my object using many different(complex) queries, and this object'll be stored in session, I decided to create another static class containing all long queries. Is it more convenient to define...
Hi all, I need to add shared functionality to both Forms and UserControls. Since multiple inheritance isn't supported in .net I wonder how I best tackle this? The shared functionality is a dictionary that is filled by the form or usercontrol and then processed. Regards ...
My guess is that "this" is more C#-ish and in F# it's better to use "self". Are there any required/preferred coding guidelines? ...
Hi, I had a quick question about the proper object relationship I should set up for this situation: I have a Customer object with associated parameters and a depot object with associated parameters. Each depot serves a set of customers and the customer needs access to particular information for their respective depot. I'm wonderin...
Here is the problem, lets say we are making a video game and want to use Dependency Injection. Here is what we have: Game Class // This is just the code to keep track of the overall game logic Character Class // This would be the guys in the game, good and bad guys both Weapon Class // The weapons for the characters So normally when ...
Okay, let's say we have a class defined like public class TestClass { private string MyPrivateProperty { get; set; } // This is for testing purposes public string GetMyProperty() { return MyPrivateProperty; } } then we try: TestClass t = new TestClass { MyPrivateProperty = "test" }; Compilation fails wi...
In my webapp I have a page called display.php. The script in this page behaves in different ways depending on POST and GET array content/existence, let's say: If I call this page and GET array isset, the script'll load a record using $_GET['id'], in another case, if no GET isset but isset a ceratin POST key the script'll load a random re...
Most likely an OO concept question/situation: I have a library that I use in my program with source files available. I've realized I need to tailor the library to my needs, say I need to modify the behavior of a single functions F in class C, while leaving the original library's source intact, to be able to painlessly upgrade it when ne...
I was wondering what is the recommended way to expose a collection within a class and if it is any different from the way of doing that same thing when working with NHibernate entities. Let me explain... I never had a specific problem with my classes exposing collection properties like: IList<SomeObjType> MyProperty { get; set; } Hav...
It seems that Python has some limitations regarding instance methods. Instance methods can't be copied. Instance methods can't be pickled. This is problematic for me, because I work on a very object-oriented project in which I reference instance methods, and there's use of both deepcopying and pickling. The pickling thing is done mos...
In their developer articles for Android, Google states that you should usually declare public variables rather than private ones with getters and setters to enhance performance on embedded devices (I suppose function calls are more expensive than just writing to an address). I was wondering - to what extent should performance be sacrif...
I am sure there is a clever way to handle this, but I just can't get it right in my head. Here is the scenario: I have a base class with about 30 properties. Say that I have a property on this class called Type. For a subset of the instances of this class, I want to add a few more properties based on the Type property. In this case...
In languages like Scala, one can have multiple definitions for one method name by changing the number of parameters and/or the type of the parameters of the method. This is called method overloading. How is that different from multiple dispatch? Thank you ...
Why such structure class A: def __init__(self, a): self.a = a def p(self, b=self.a): print b gives an error NameError: name 'self' is not defined? ...