design

how to program high level concepts (i.e. Object class, and Generics) in C

Here lately I've been tinkering around with my own languages as well as reading various writings on the subject. Does anyone have any good advice on how, in C (or Assembler), do you program the concept of the Object Class and/or the concept of Generics into a language. (referring to the Java implementations of Object and Generics) For...

SOLID vs. YAGNI

One of the most frequent agruments I hear for not adhering to the SOLID principles in the class design is YAGNI (allthough the arguer often doesn't call it that): "It is OK that I put both feature X and feature Y into the same class. It is so simple why bother adding a new class (i.e. complexity)." "Yes, I can put all my business log...

multithreaded logging for high performance application

I have an application (server application) that needs an extensive amount of logging implemented and shouldn't be too affected performance wise by enabling logging. The application has a thread pool of worker threads performing the work. Originally I was going to just log on these thread pool threads, but then I'd need to lock practica...

Reference to various tables

Well, I'm in a middle of some design issue. I'm trying to built kinda universal commenting system for my site. So I started with two tables: Comment_node has many Comments Now I want to be able to attach my cool comment system to various places on my site. For example to blog_posts and to user_pages. blog_posts has one comment_node ...

Anyone got any input about how to model this?

Hi all.. I need to model a calendar, and I got some ideas myself, but I would like some input from you guys :) The domain is as follows: A calendar contains time entries (think google calendar here). For each group and day in the calendar, I have a starttime and an endtime, denoting the time its possible to enter new appointments in be...

TextView fills the 80% of the screens

Hello. I'm very very new on Android. I want to put a TextView inside a LinearLayout that fills the 80% of LinearLayout's height. How can I do that? or How can assign percentage on Widht and Height? Thanks. ...

ANDROID: Question regarding overlaying a transparent bar to make layout more aesthetic...

How would I go about putting a transparent bar along the top of a scrollview so that when the text scrolls up it kind of fades out towards the top? I am talking about the kind of thing that the Facebook and NFL mobile apps use. I think it just makes the whole design look nicer and I was wondering how I could implement this. Thanks for...

How to create multiple custom pages in wordpress?

I am designing a website in wordpress. I have 1 custom home page & another are single themed pages. Now I want to add some more landing pages with different design. How can I get this? ...

Looking for Wordpress plugin for images, text and buttons.

I am designing a website in wordpress. I have 3 boxes on the home page and I have widgeted them. Now I want to add their image, text, heading, and "read more" links. I have searched for a plugin to do this without success. I want to know about a plugin which can add image, text, and a read more link (button) to posts. ...

What is the best way expose key classes/methods my core API to 3rd party developers?

I have an application that I have designed and this app has a pretty decent core dll that contains an API that my main view's exe uses. I would like to allow other developers to access this core dll as well but I don't want them to have as much access as me since it would be a security risk. What is the standard way of exposing my core...

RESTful nested conventional routing

Hi, I have the model: User -1---n- Transaction(amount,description, date) User -1---n- TransactionImport -1---n- TransactonImportField(name,value) (personal expense tracking app). What I want to achieve is this: User opens URL and pastes the CSV with the list of transactions. User submits it. System extracts data from CSV into Tra...

How to add an error logger to a class.

Hi, I would like to use a generic error msg handler so I can GetLastError and SetError easily for any class. I came up with this scheme. But I have a couple of questions. Please note this implementation is just for testing. But I want to get the basic design right. #include <iostream> #include <stdarg.h> class ErrorHandler { p...

Your first gut feeling on this SqlServer design question

We have 2 tables. One holds measurements, the other one holds timestamps (one for every minute) every measurement holds a FK to a timestamp. We have 8M (million) measurements, and 2M timestamps. We are creating a report database via replication, and my first solution was this: when a new measurement was received via the replication proc...

Is there any way to prepare a struct for future additions?

I have the following struct which will be used to hold plugin information. I am very sure this will change (added to most probably) over time. Is there anything better to do here than what I have done assuming that this file is going to be fixed? struct PluginInfo { public: std::string s_Author; std::string s_Process...

How to design around lack of const in C#/Java?

While trying to model my domain, I came across the following problem. Let's image we have a Thing: class Thing { public int X { get; set; } } Things have a property X. Then, there are Packs, which aggregate Things. But the domain requires that there is some restriction on the Things the Packs can hold. Let it be for example that t...

Is it good practice to make member variables protected?

Asking this question because I feel that member variables of my base will be needed later in derived classes. Is there a drawback of making them protected? EDIT: Edited to better show my intention. EDIT: @sbi : Is this also wrong? This class will be used for error recording and retrieving in other classes. Is it better to derive from ...

Java Generics and interfaces

Having this design : interface Foo<T> { void doSomething(T t); } class FooImpl implements Foo<Integer> { //code... } interface Bar extends Foo { //code... } class BarImpl extends FooImpl implements Bar { //code... } It gives me Compile Error : The interface Foo cannot be implemented more than once with differ...

Database design - primary key naming conventions

Hi, I am interested to know what people think about (AND WHY) the following 3 different conventions for naming database table primary keys in MySQL? -Example 1- Table name: User, Primary key column name: user_id -Example 2- Table name: User, Primary key column name: id -Example 3- Table name: User, Primary key column name: pk_us...

What are the design/developing process errors cause data loss?

Recently I saw an application recording important data on disk without forcing fsync. I used to write various applications without testing. I lost a few blog posts by the lack of a WHERE clause in the UPDATE. Are there any statistics about the data loss by programmers mistakes ? What are the issues that could cause loss of data you s...

ASP.NET MVC singleton or static class to pass around data?

I'm creating a controller that will serve the combined/minified versions of my JavaScript and CSS. I need to somewhere along the line define which scripts/styles to be loaded. When a request is made, for example for style.css?VersionNumberHere, it will check if the combined/minified data is already in the HttpContext.Cache, if so spit i...