design

Making a drawing program

I am making a drawing program, and have a few question with regards to that. I'll need the user to have the choice of drawing a rectangle, an oval and a line. I suppose I need to make a super class they all derive from. Should I make this an interface or an abstract class? And how would I set up that all the shapes have some default val...

Where should generating image URLs be handled in JSF?

For a uni assignment, I'm doing a JSF webapp to play poker. Cards in a player's hand are displayed by images. What's would be the "cleanest" way of mapping the card suit/rank to the URL of the associated image? I'm currently leaning towards either using whatever Card#toString returns, or handling this in the backing bean, it's just that...

Cyclic Namespaces in C#

How truly "evil" are cyclic namespace dependencies within a single assembly. I understand using multiple assemblies changes everything and something like that wouldn't compile, but what is the real risk of doing it within a single assembly? ...

C# OO Design Question

I have a windows form app written in C#. the main_form class instantiates an AccessProcess named AccessProcessWorker which is a class that inherits from BackgroundWorker, then main_form then initializes Process with the following code AccessProcessWorker.DoWork += new DoWorkEventHandler(processWorker.worker_DoWork); Acc...

Use external file or resource?

I am writing a C# application that uses a long "hard-coded" string. For maintainability reasons I have decided to put this string in an external text file and load it. Is this a good idea? The extra I/O does not seem big in this case. I realize that I also have an option to embed this file as a .resx resource. Is this a better idea? Th...

What is the best way to implement REST based Web Services in .NET?

So far my options are ADO.Net data services, WCF REST Starter Kit(not sure if I can use it, as their EULA is hard to comprehend and confusing), ASP.NET MVC. There are quite a few posts, but I want to see if there are anymore frameworks that I am missing. Also please post your experiences if you already used any of the above options. Th...

How does a Software Architect get his designs programmed?

Furthering my previous question about what an SA does, I'd like to know how SA's usually manage the developers under them. Is it: a manual process, where they meet with developers to make them understand the design semi automatic, where they draw diagrams that mostly suffice to explain the code to developers fully automatic, where they...

Separation of responsibility in assemblies

Hi All, We are working on an Asp.net project. It has two parts, first one is for the public users (to be used on internet) and other one is for internal use inside the organization. The processes and objects are more complicated, vast and intricate on the intranet side. Though both the sites will be using the same database (to be conne...

Why is java secure coding important?

I'm having trouble understanding why java secure coding is important. For example, why is it important to declare variables private? I mean I get that it will make it impossible to access those variables from outside the class, but I could simply decompile the class to get the value. Similarly, defining a class as final will make it impo...

Modeling a Flow Chart

Hey guys, I have a predetermined flow chart made up entirely out of boolean conditions and a bunch of logic to be performed in response. The flow is unlikely to change much, but there is a small possibility that it will. (new steps might be introduced, or the order of conditions might change) What would be the best approach to code th...

C# How to create extension methods with lambda expressions

Currently i am creating an extension method that accepts parameters. Using the below example, how could one convert this using lambda expressions? public static decimal ChangePercentage(this IEnumerable<Trade> trades, DateTime startDate, DateTime endDate) { var query = from trade in trades where trade.TradeTime >=...

How to design an app that requires synchronized notifications on all client computers

We have an asp.net application that needs to be expanded to notify users when an update occurs. All users need to be notified even if they don't have the asp.net app opened. All notifications must occur at the same time for everyone, so email is not an option. The application will run on a corporate network with standardized client co...

What design pattern should I use to create an easy binding map between a query and textboxes for Linq search screens?

Over and over, I find myself developing WinForm business application screens that have a bunch of text boxes for search criteria, then a search button. These are mapped into an expression using Linq, then passed onto my Linq2Sql layer. I'd like to create an easy way to "bind" these textboxes to the underlying query using different opti...

Spring and Stripes Security Design

I'm building a web application using Stripes and Spring. It needs to have a login/authentication feature. Right now I store user information separate from user credentials in the database. My User model does not contain the credentials as I don't want to be passing around valuable passwords. Spring manages all of my DAO's. Now, I ...

Is it Better to Design a Language that Utilizes White Space Instead of Symbols to Group Code?

I have found myself designing a language for fun that is a cross between Ruby and Java, and as I work on the compiler / interpreter I find myself pondering using whitespace as a terminator, like: class myClass extends baseClass function someFunction(arg) value eq firstValue value2 eq anotherValue x = 2 The alter...

IOC - Injection of multiple dependancies.

Consider the below: public class DependencyA {} public class DependencyB {} public class DependencyC {} public class DependencyD {} public class Service1 { public Service1(DependencyA a, DependencyB b, DependencyC c, DependencyD d) { ... } } public class Service2 { public Service2(DependencyA a, DependencyB b, DependencyC c, De...

How to modify map element key

I have a container that holds map of elements. class MyContainer{ ..... Map<String,MyElement> elements = new ... ... } Each element has name property. The key in the map is the element's name. i.e. the method insert is as follows: void addElement(MyElement elem){ elements.put(elem.getName,elem); } I need to use the map data s...

good way to represent a excel sheet value in Java

Consider that I've a excel sheet in below format: person age Foo 29 Bar 27 Now I want to read these values (using POI HSSF) and have to process them. What's the best way to do that? Note that I do not have a Object Person in my application, becasue the values that may come in excel sheet is arbitrary (i.e. it may not be the ...

static class data vs. anonymous namespaces in C++

I occasionally have classes with private static data members. I'm currently debating if I should replace these with static variables in an unnamed namespace in the implementation file. Other that not being able to use these variables in inline methods, are there any other drawbacks? The advantage that I see is that is hides them compl...

Designing interface between application and GUI

For homework, I need to build a small java application.The main goal is to learn how to interact with XML. But a second goal is to learn how to build such an application. I have quite some experience on programming, but little experience in designing programs. I've read about designpatterns and designprinciples like Solid and TDD. But ...