design

When is using the C# ref keyword ever a good idea?

The more I see ref used in production code, the more misuse I encounter and the more pain it causes me. I have come to hate this keyword, because from a framework-building standpoint, it seems silly. When would it be a good idea to communicate to users of your code the notion of maybe changing an object reference/value out from beneath t...

Extensions vs Partial

Let's suppose I have such "helper" methods used by some object. private int MatchRegex(string regex, string input) { var match = Regex.Match(input, regex); return match.Success ? Convert.ToInt32(match.Groups[1].Value) : 0; } private string Exec(string arguments, string path = "", bool oneLine = false) ...

Base class defines many protected methods: Is it a good OOP design?

I wrote a base class which defined many protected methods. Those methods are called in its sub classes. The methods define basic operations for its sub classes. For instance: class Base{ protected void foo(){} protected void bar(){} } class Sub1 extends Base{//The sub class only needs Base.foo() public void po(){ ... ...

"Monolithic" page classes - Is this a code smell?

I'm new to PHP and I'm trying to build a site for the first time without using a framework (n.b. I have nothing against frameworks, I just think I should learn to code from scratch before learning a framework on top of it. Sort of like learning Javascript before learning JQuery). I like OOP in concept, so I started there. I'm thinking o...

Outsourcing artwork for software projects

I am a software developer and I am planning to develop a mobile app. I am not really good in designer tools and creative stuff thus I would like to outsource the asset creation part of my project. Can you please recommend me good sites where I can do this? Recommendations with personal experience are very welcome! ...

ASP.net - Unsure on how to generate table

Given the following HTML: <asp:content id="Content1" contentplaceholderid="mainContent" runat="server"> <div class="scrollRow"> <table width="100%"> <tr> <td width="25%">Site name: <b>My site</b></td> <td>Created on 12th Aug 2010</td> <td align="right"><button onclick="doRevert(1)">Revert...

Should I use multiple classes for game?

I'm considering making a text-based RPG-type program in PHP as both a holiday project and a chance to learn more about PHP and OOP. (Maybe not the best choice in language, I know, but I didn't want to have to learn another language from scratch at the same time as OOP.) Anyway, I'm just beginning the design process and thinking about 'm...

Task/action based web API idea

Hi, lately one person in my company suggested a different approach to web API. Since we deal with a lot of transactional processes (product sales, devices provisioning, account reconfiguration, billing, ...), the idea was to switching from "one action per request", to "process per request". For example instead of sending: (trivial mockup...

Generic Collections - Ensuring Collections Contain Only One Type of Object?

Hey all, Let me start with the definitions of the objects with which I am working and then I'll do my best to explain what I'm after: class CacheItem<T> where T : EntityBase class CacheCollection : List<CacheItem<EntityBase>> OK, so my generic collection, CacheCollection should be a list of CacheItems which I can manipulate accordin...

How to make a GOOD reporting Interface

Hi All, I have a ton of associated data revolving around a school, students, teachers, classes, locations, etc etc I am faced with a challenge put fourth by my client; they want to have reports on everything. This means they want the ability to cross reference data points every which way and i think i'm just short of writing a pretty...

Should classes contain references to the objects that populate them?

Say I have the following classes: public class BackendObject {} public class ObjectA {} public class ObjectB { List<ObjectA> Children; } public class ObjectC { List<ObjectB> Children; } and several more levels of objects with children. In my domain, this structure could be quite large, and generating it all (by querying the...

How to change Django NullBooleanField widget application wide?

I would want to display all NullBooleanFields in my application as radio buttons. What's the best way to do it? Following template or something similar would be ideal. Just to allow rich styling and tone-of-voice different from plain "Yes/No/Unknown". '''<li class="field-%s"> <label class="%s" title="%s">%s</label> <label class...

Implementing a Tag property on entity classes

When I create entities in a class library, I tend to add a Tag property which may be used by users and extending libraries to store arbitrary data with the object. Now I am looking for the best way to implement such a Tag property in my class library, and the reasons why. In System.Windows.Forms, Microsoft uses object Tag { get; set; } ...

How thick is the line between designing and developing?

Currently a first-year student in .Net and Java development... question regarding the process of creating an application for a company or client and the need to differentiate between design and developing. When developing an application, be it for the PC, web, phone, etc. is the developer expected to have a sense of design and be interac...

C# database wrapper design

Hi, I am designing a database wrapper for C#. Below are the two options I have: Option A: class DBWrapper:IDisposable { private SqlConnection sqlConn; public DBWrapper() { sqlConn = new SqlConnection("my connection string"); sqlConn.Open(); } public DataTable RunQuery(string Sql) ...

How essential is polymorphism for writing a text editor?

Many years ago when I didn't know much about object oriented design I heard one guy said something like "How can you write a text editor without polymorphism?" I didn't know much about OOP and so I couldn't judge how wise that though was or ask any specific questions at that time. Now, after many years of software development (mostly C+...

How do I achieve the following result using RelativeLayout?

Pictures: http://img838.imageshack.us/img838/1402/picse.png How do I make the layout in Pic. 2 using RelativeLayout ONLY. Below is the xml layout of the first screenshot. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" ...

Designing an webtesting DSL to be implemented by different Web testing drivers - should we mix primitive and non-primitive operations?

We are implementing a web test automation project for some intranet applications. To easy the writing of each test, we are designing a Java DSL that can be implemented using different adapters (we've chosen Sahi and Selenium/WebDriver so far, as we want to measure them side by side in terms of performance, readability, maintainability,...

Why does AssemblyPart inherit DependencyObject? and my other related AssemblyPart mysteries

One of my biggest frustrations with using most APIs is that the use cases and/or user stories for the API are not documented anywhere. While the .NET Framework Design Guidelines preaches Scenario-Driven Design, MSDN typically does not explain real-world scenarios. If they provide programming examples, it is entirely explained in terms ...

In C++, why isn't the this keyword a reference?

Possible Duplicate: Why this is a pointer and not a reference? Hey guys, Is there a good reason that this is a pointer instead of a reference in C++? ...