design

What are your tips for best practice for web application structure?

I do a lot of custom applications at work. I'm trying to define some standards for new applications. Something a little like Elements. CSS: How do you organize the style sheets? Should I have one base style sheet for the whole site and one for each individual page for customizations? Should I have another for print styles? I've hea...

When is it good to use embedded script language like Lua

Hi, I'm playing WoW for about 2 years and I was quite curious about Lua which is used to write addons. Since what I've read so far about Lua was "fast", "light" and "this is great", I was wondering how and when to use it. What is the typical situation where you will need to embed a script language like Lua in a system ? ...

Forms - Can they be done without tables?

I've gotten used to using <table>s for aligning my form fields perfectly. This is how I commonly write my forms: <table border="0"> <tr> <td><label for="f_name">First name:</label></td> <td><input type='text' id='f_name' name='f_name' /></td> <td class='error'><?=form_error('f_name');?></td> </tr> </table> I know ...

Design considerations for a class full of static methods

As a Swing developer for as many years as one can possibly be a Swing developer, I've identified a lot of patterns that I use in laying out components. For example, I often create components that are associated with a JLabel. I usually write: JPanel panel = new JPanel(new BorderLayout()); panel.add(label, BorderLayout.NORTH); panel.ad...

Do you ever design software by envisioning the ideal solution?

I saw myself doing this and I was wondering if other people work like this as well: What I usually do when confronted with a software design problem is that I jot down "the ideal" solution, without taking into account feasibility or any other consideration. Then I peel away at it top-down, until I have the solution. Is that a methodolo...

Variations on a simple webservice/API: Summing a list of numbers.

In another question I asked for different implementations of a simple RESTful webservice. It was pointed out, however, that the API I defined was not particularly RESTful. My question: Is that a bad thing? More specifically: What are alternative ways to define such an API? I'll add the answer from the problem definition in the other qu...

Are Stored Procedures Easier to Maintain?

What is the argument for and against putting code in stored procedures with the intention of making the code more maintainable (i.e. Easier to make changes to the business rules without recompiling code)? All else being equal what makes a stored procedure better/worse for maintenance? ...

How do I explain loose coupling and information hiding to a new programmer?

How do I explain loose coupling and information hiding to a new programmer? I have a programmer who I write designs for, but who can't seem to grasp the concepts of loose coupling and information hiding. I write designs with everything nicely broken down into classes by function (data access is separate, a class for requests, a contr...

Where does one begin when designing and implementing an application?

Hi, I am fairly new to designing and implementing real world applications (other than the ones I did at university). I would like to know from the ones more experienced than me how does one go about designing and implementing an application? What are the first steps involved?I know that there are tons of information out there with regar...

What program are you using to design large scale software?

I am working on a large scale application but only in design. Right now it's all on papers but the problem is I want the ability to say design some classes just the names not implementations and then have a schematic graph that I can form things with those. And also when I change a particular class name, that it would update the graph w...

Generics or not Generics

Basically I have a custom List class that contains different fruits. Assume that each fruit has an ID number that is stored in the list. Is it better to have: new AppleList(); new OrangeList(); new LemonList(); or new FruitList<Fruit.Apple>(); new FruitList<Fruit.Orange>(); new FruitList<Fruit.Lemon>(); Things to consider: All I...

How should validation behave

In the very common scenario where you have a textbox, and some kind of validation rule which constraints the valid entries on that textbox. How should a failing validation affect the content of the textbox especially in the case when there originally was a valid value entered before the invalid. Example: Imagine a form where one can ent...

Layer Supertype in ActiveRecord (Rails)

Hi, I'm developing a ruby on rails app and I want to be able to excecute a method on every AR object before each save. I thought I'd create a layer-super-type like this: MyObject << DomainObject << ActiveRecord::Base and put in DomainObject a callback (before_save) with my special method (which basically strips all tags like "H1" fro...

When talking about programming languages, what is the definition of Magic?

The word "magic" gets thrown around a lot here in contexts like "language X just has too much magic", or "platform Y generally avoids magic". However, it seems the term is pretty poorly defined, something people know when they see it. For example, Java is reputed to contain very little magic, but its garbage collector hides a lot from ...

Tips on proper classes

Hello, I'm using C#. I have a products class with fields like sku, name, description.... and methods like setSku, setDescription, setImages(products have an image attached). I was keeping these methods inside the Product class but because of the large amount of settings available to the client on how to set the sku and descriptions and ...

Handling of UI state

I have application running on Windows written using MFC. The enable/disable state of the menu items depends upon a lot of conditions. For example, I have to enable the menu item if condition A is satisfied OR if condition B is satisfied, but should be disabled if both A AND B are TRUE at the same time. How do we model this in code ? I t...

C++ "smart" predicate for stl algorithm.

I need to designe predicate for stl algorithms such as find_if, count_if. namespace lib { struct Finder { Finder( const std::string& name ): name_( name ) { } template< typename TElement > bool operator( const TElement& element ) { return element.isPresent(...

Python: Choosing between modules and classes.

In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options: Make a separate appstate.py file with global variables with functions over them. It looks fine initially but it see...

What methodologies, processes, and tools are available for designing and modeling non-object-oriented applications?

I'm quite familiar with UML for modeling object-oriented applications. However, I'm not familiar with anything specifically designed for designing and/or modeling procedural, functional, or any other paradigm. How do you design or model applications written in a non-object-oriented language? ...

Design Tips for PHP Function Include Files

Good design dictates only writing each function once. In PHP I'm doing this by using include files (like Utils.php and Authenticate.php), with the PHP command include_once. However I haven't been able to find any standards or best practices for PHP include files. What would you at StackOverflow suggest? I'm looking for: Naming St...