答:
There are two parts to this:  QA and Planning.

QA

there are more ways to write bad/unusable user stories than writing really good ones. And it's easy to get to the wrong tracks even if you're careful.

How true.

That's true for software.  Woodwork.  Plumbing.  Painting.  Walking down stairs.

In all cases, we have a technique for preventing all the bad/unusable from overwhelming the good.

It's called "Quality Assurance".

I would like to know what other alternatives are to plan a project on the high level that ensures better results.

Without Quality Assurance, nothing works any better.

I've heard of Effect Mapping ...

Without Quality Assurance, this technique will be just as bad as user stories without Quality Assurance.

Can we follow some easy to understand and narrow guideline that will lead us to a great high-level plan?

No.  Not really.

It turns out that it's hard.  You can't get a "great" plan without "great" user stories.  And you can't get "great" user stories without some definition of greatness and the Quality Assurance to establish their greatness.

What are other more reliable approaches that simple user stories planning that are used in agile planning?

Nothing is more reliable than user stories.  Or.  To be more precise.  The reliability stems not from the technique, but from your Quality Assurance.  With poor QA, all techniques are equally poor.  With good QA, all techniques are equally good.

Apparently "Quality Assurance" is not a popular term for Quality Assurance.  If you want to call it "Verification and Validation", you can call it that instead.

You already have quality standards that you deem important.  You listed them in the question.

What you're not doing is assuring that all stories meet the quality standards.  What you need to do is to assure that all stories meet the quality standards before you use them for estimating.

Planning

You probably have unrealistic expectations for a "a great high-level plan".  If you think you're going to estimate to within a small factor of the final project cost, you're being naive.  You're initial planning is not actually of any value at all.

Zero.

The Agile (specifically Scrum) folks will tell you that the backlog is a very, very flexible thing that grows and shrinks wildly as people learn about the product, the stories, the technology and the problem domain.

The initial estimate is not really useful for anything, since many  of the low-priority user stories can easily be removed.  Some of the user stories are really epics with numerous user stories buried within them.  Some of the user stories are flat-out wrong.  And some of the user stories only hint at the real problem that needs to be solved.

After a few sprints, the backlog combined with the delivered features looks very little like the initial backlog.  This is the sign of a well-run project where people have permission to learn something and fix the backlog to reflect that learning.

"leads to valuable plan/results." is a backlog.  Not much more than a list of stories and relative complexities.   Detailed estimates based on super-accurate stories don't actually help develop software.  All that detailed estimates help with is estimation.

"A great high level plan isn't just a set of functional requirements, but rather a product vision with obvious goal in mind"  Is a backlog.  Nothing more.  Detailed estimates.  High quality user stories aren't essential.  Bad user stories are part of a great plan because they get reworked to improve their quality.

Title: Agile product planning alternatives to aid goal-oriented feature quality

Body:
What do I mean by high-level plan? The kind of plan that outlines product's functionality that needs to be developed but not going into too many details that are done afterwards. This kind of plan helps deciding functionality development order (priority) or even eliminating non-necessary ones. A great high level plan isn't just a set of functional requirements, but rather a product vision with obvious goal in mind.

In Agile terms these kind of functionality documentation is the Backlog. We're used to its content - user stories - as defined by Mike Cohn that go:

As a role I want functionality so that benefit.

But as we know from experience this may lead to:

unusable stories

Like: As a visitor I want to login so that I'm allowed to do stuff.

But how would one improve this user story? What other benefits can we describe that are more relevant than ...do stuff?

flat list of unmanageable seemingly unrelated stories

Hard to see which ones are related or not (they shouldn't be but I don't think we can totally avoid this), or even which ones provide means for achieving the same high-level goal.

too many unrelated goals/benefits

Goals just because we need to write them but without actual business value benefit - the high level business goal in mind.

The problem

As I have experienced there are more ways to write bad/unusable user stories than writing really good ones. And it's easy to get to the wrong tracks even if you're careful. And how can one write better user stories when they are working on their own product, so they don't have means to learn from other fellow team members, and they have to provide user stories now. Not after 6 months of learning.

That's why I would like to know about alternatives to planning a project on the high level that ensures better feature description and relevancy. I've heard of Effect mapping that seems very good in keeping goal focus and filtering relevant from irrelevant but I don't have any experience with it. I can imagine that setting a goal can be crucial. So if you set it wrong, everything else is wrong as well. Or better said irrelevant.

The main question is: Can we follow some easy to understand and narrow guideline that will lead us to a great high-level plan. A guideline that allows less errors and better leads to valuable plan/results. I can see myself writing user stories afterwards that describe features to implement. The problem with user stories is that it's easy to get lost in them. If you don't have lots of experience with user stories that may hinder your product because they distract you from the actual goal. All you can see are product features described in user stories. Something else above that would allow us to create better stories and also easily filter out those that are extremely relevant.

What are other more reliable approaches that simple user stories planning that are used in agile planning?

Focus of this question

I have been writing user stories on several projects in the past and know exactly how hard and vague this task is. I've also seen that writing these is even harder when you're writing them for your own project/product. You can easily over-design your product or incorrectly prioritise/evaluate features.

So I would like to write feature set for my coming product in a way they are actually relevant and prioritise them accordingly to reach my goal as reliably as possible.

So feature relevancy and quality along with goal-oriented prioritisation. And I'm talking about measurable quantitative goals like

20% month over month income increase or

  5% sale conversion rate of user visits

and not something vague like increase users or increase sales.

We can see that writing relevant features that support these goals is much harder.


问:
Agile product planning alternatives to aid goal-oriented feature quality
What do I mean by high-level plan? The kind of plan that outlines product's functionality that needs to be developed but not going into too many details that are done afterwards. This kind of plan helps deciding functionality development order (priority) or even eliminating non-necessary ones. A great high level plan isn't just a set of functional requirements, but rather a product vision with obvious goal in mind.

In Agile terms these kind of functionality documentation is the Backlog. We're used to its content - user stories - as defined by Mike Cohn that go:

As a role I want functionality so that benefit.

But as we know from experience this may lead to:

unusable stories

Like: As a visitor I want to login so that I'm allowed to do stuff.

But how would one improve this user story? What other benefits can we describe that are more relevant than ...do stuff?

flat list of unmanageable seemingly unrelated stories

Hard to see which ones are related or not (they shouldn't be but I don't think we can totally avoid this), or even which ones provide means for achieving the same high-level goal.

too many unrelated goals/benefits

Goals just because we need to write them but without actual business value benefit - the high level business goal in mind.

The problem

As I have experienced there are more ways to write bad/unusable user stories than writing really good ones. And it's easy to get to the wrong tracks even if you're careful. And how can one write better user stories when they are working on their own product, so they don't have means to learn from other fellow team members, and they have to provide user stories now. Not after 6 months of learning.

That's why I would like to know about alternatives to planning a project on the high level that ensures better feature description and relevancy. I've heard of Effect mapping that seems very good in keeping goal focus and filtering relevant from irrelevant but I don't have any experience with it. I can imagine that setting a goal can be crucial. So if you set it wrong, everything else is wrong as well. Or better said irrelevant.

The main question is: Can we follow some easy to understand and narrow guideline that will lead us to a great high-level plan. A guideline that allows less errors and better leads to valuable plan/results. I can see myself writing user stories afterwards that describe features to implement. The problem with user stories is that it's easy to get lost in them. If you don't have lots of experience with user stories that may hinder your product because they distract you from the actual goal. All you can see are product features described in user stories. Something else above that would allow us to create better stories and also easily filter out those that are extremely relevant.

What are other more reliable approaches that simple user stories planning that are used in agile planning?

Focus of this question

I have been writing user stories on several projects in the past and know exactly how hard and vague this task is. I've also seen that writing these is even harder when you're writing them for your own project/product. You can easily over-design your product or incorrectly prioritise/evaluate features.

So I would like to write feature set for my coming product in a way they are actually relevant and prioritise them accordingly to reach my goal as reliably as possible.

So feature relevancy and quality along with goal-oriented prioritisation. And I'm talking about measurable quantitative goals like

20% month over month income increase or

  5% sale conversion rate of user visits

and not something vague like increase users or increase sales.

We can see that writing relevant features that support these goals is much harder.

答:
Gathering requirements is not always easy, it needs almost always some experience. The "user stories" approach is just a tool which might help you to have a unified form of writing down your missing product features, but don't expect it to be a silver bullet. If you need other forms of requirement specs on a different level of abstraction, don't hesitate to create it.

Actually, I don't believe there is is an easy-to-learn guideline which can help you - just practice "requirement engineering", and after doing this for some months, you will get better in this job. Moreover, you have already identified some crucial points you want to avoid, which shows you are already on the right track. And if you are missing the "great high-level plan", why don't you try to write down some general, high-level project goals beforehand? In most projects I have participated, that was the easy part - the hard parts are always the details.

ContentLicense: CC BY-SA 3.0


问:
Two HTML elements with same id attribute: How bad is it really?
Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so:

```<code><div id="search" jstrack="1">
    <form action="/maps" id="...rest isn't important">
        ...
        <div id="search">...
</code>```

Since this is google, I'm assuming it's not a mistake.

So how bad can it really be to violate this rule? As long as you are careful in your css and dom selection, why not reuse id's like classes? Does anyone do this on purpose, and if so, why?

答:
In Scripting: getElementByID will return only the first match.
In CSS: #id will affect ALL elements with that ID.
In Browser Render won't be of any effect.

This is the behavior of w3c standard. Not a possible one, it's the facto defined one.

https://dom.spec.whatwg.org/#interface-nonelementparentnode


问:
Software to organize and maintain project documentation, specification?
I'm looking for software to organize and maintain projects internal documentation, specification, requirements, etc. Currently we store all documentation as lots of MS Word DOC files in a source control repository, which gives us version control, and that's nice. But you can't search this information, create links between them, categorize, collaborate.

Requirements, preferences:

Zero install on client side (WEB based).

Document version control.

Document annotations.

Document linking.

Full search (all documentation).

MS Word (*.doc) import\export.

WYSIWYG text editor.

Systems I have discovered and tried so far:

MediaWiki

XWiki

Confluence

答:
Well, you can try to implement a Wiki. Mediawiki has all the missing features you are talking of (search functions, versioning history, links, categorization). You will have to make sure you know exactly which version of the documentation belongs to which version of the software, but that can be done by convention of including a version reference or a specific category in each version dependent article.

BUT: You write you have "analysts" who are not developers (I admit, I am not a fan of that constellation). Those kind of people are often not happy when you replace their MS Office tools by some textual oriented tool like a Wiki. And since MS-Word is not free software, so I guess the requirement "free software" is not really a must. In this situation, a Sharepoint server might be the better alternative. Not free, but AFAIK it has all the features you are requesting, and documents can still be created using Word, Excel etc.


问:
What is (was) an update channel?
I was checking out what version of Firefox I'm using and it was telling me that I'm on the 'release update channel'.  So I googles "Update Channel" and I finds this seemingly antiquated MSDN article which has a confusing bit of ASP.NET pre-processed into the article to give you the sense that you both should not use this technology and should never have used this technology.

Microsoft Active Channel technology is obsolete as of Windows Internet Explorer 7 and should not be used. Users want an easy and convenient way to download and install new versions of software. Software Update Channels are specialized channels that you can use to notify users of software updates and also deliver and install the updates on their computers. Users who have downloaded your software and subscribed to your Software Update Channel are notified when new versions of your software become available. When notified of an update, users can click a gleaming icon representing your channel, which returns them to your download site so they can obtain the new version. Users can also choose to have software updates delivered and installed on their computers automatically.

Active Channel technology is obsolete as of Internet Explorer 7 and should not be used. This article introduces you to the terminology, benefits, and implementation of Software Update Channels. After reading this article, you will understand how easy it is for users to discover and interact with this technology, and you will know how to create your own Software Update Channels. Links to relevant overviews, references, and tutorials are provided at the end of the article.

So, I ask you.  Is this still some sort of metaphor for getting software easily to your clients.  If I store the info for my programs updates in a database, is there existing non-obsolete Microsofty technology that could take a generated XML file and tell people using my software that there are updates available and you should probably download them?

答:
Reflecting on your comments to @fabianhjr I will try to provide you with some more info about update channels in Mozilla applications.

The Mozilla wiki says the following about updates:

Firefox periodically checks the Mozilla.org update servers (AUS) for
  available updates. The update servers will return a manifest file
  (which is a simple XML file) over HTTPS that will point Firefox at the
  right update package to download.

More info about update channels can be found in a comments for a bug 302721:

Finally, the channel can be thought of as applying to the current
  branch.  So, if the user has a build from the 1.5 branch, with a
  nightly channel, then they will receive nightly updatees of 1.5 branch
  builds.  If they are using a beta channel, then they will receive
  updates to our 1.5.x release candidate builds.

For more info about the general update process of Mozilla applications look at Mozillazine.org and Mozilla Wiki checking for updates.

Title: What is (was) an update channel?


问:
Examples of general purpose algorithms that have benefited from running on a GPU?
I am looking for examples of general purpose algorithms (meaning non-graphics related) that have been proven to run an order of magnitude faster on a GPU than on a CPU. I will use these examples to think creatively about other algorithms that I could implement on a GPU.</p>

答:
Conway's Game of Life is a good academic example.

...The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

Any live cell with fewer than two live neighbours dies, as if caused by under-population.

Any live cell with two or three live neighbours lives on to the next generation.

Any live cell with more than three live neighbours dies, as if by overcrowding.

Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations...


问:
What is the Best Style for Functions with Multiple Returns and If/Else Statements?

Possible Duplicate:

  Elegant ways to handle if(if else) else

In a function where there are multiple returns, what is the best style to use?

This style, where there is no 'else' because it is frivolous and you think it is more concise?

```<code>f() {
    if (condition) {
        return value;
    }

    return other_value;
}
</code>```

Or this, if you think that 'else' provides nice syntax sugar to make it more readable?

```<code>f() {
    if (condition) {
        return value;
    } else {
        return other_value;
    }
}
</code>```

Feel free to share whatever other reasons you may have for preferring one over another.

EDIT:

The above samples are hypothetical, if they were this simple, as Yannis Rizos noted below, the ternary operator ( condition ? value : other ) would be acceptable. However I'm also interested in cases like this:

```<code>f() {
    if (condition1) {
        return value;
    } else if (condition2) {
        return value2;
    }
    ...
    else {
        return other_value;
    }
}
</code>```

答:
The "single var pattern" often found in Javascript suggests single points of return by insisting that all variables are declared at the top of the function body to prevent "hoisting". Thus, recording the evaluations instead of returning can prevent the need for an ELSE (which I have a strange aversion to...):

```<code> function doThis(required){
    var result = false;
    if(required){
        //base implementation
        result = doThat();
    }
    return result;
 }
</code>```

If you have sequential or optional conditions and can't break out to another function, then you can do this:

```<code> function doThis(required, opt){
    var result = false,
        oRequirement = 'foo';
    if(required){
        //base implementation
        result = doThat();
        if(result !== false && opt !== undefined && opt === oRequirement){
                //optional implementations
                result = doOptional();
            } else {
                //undo previous truthiness
                result = false;
            }
        }
    }
    return result;
 }
</code>```

You could delegate consumption of variables externally, making this function effectively a "guard clause":

```<code> function vA(a){
     return true;
 }

 function vB(c){
     return true;
 }

 function vB(c){
     return true;
 }

 function doThis(required, opt){
    var result = false;
    if(vA(required)){
        //base implementation
        result = doThat(required);
        if(vB(result) && vC(opt)){
            //optional
            result = doOptional(opt);
        }else{
            result = false;
        }
    }
    return result;
 }
</code>```

You could layer your evaluations:

```<code> function doThis(required, opt){
    var result = false;
    if(if(vA(required)){
      //base
      result = doThat(required);
    }

    if(if(vB(result) && vC(opt)){
      //optional
      result = doOptional(opt);
    }
    return result;
 }
</code>```

Ternaries can reduce size, and are very pretty, but they can be a little harder to debug, and a bit inconvenient if you need much in the way of nested evaluation steps:

```<code>function doThis(a, b, c){
    var o = false;
    if(valid(a)){ //assuming some sort of validation is required
        if(b !== undefined && valid(b)){
            o = c ? //an optional step
                doMore(a) ?
                    new Foo(a, b) :
                    false :
                new Bar(b, a) ;
        }
    }
    return o;
}
</code>```

Generally speaking, I need to nest IF statements if optional arguments are present. When the outcome is the result of a process within the body, then it suggests delegating or chaining into a separate method.

Having said that, I can't help but feel that there is no "right" way (although there are certainly wrong ones...), and it's this fact that makes coding a creative profession capable of a broad range of expression. I mean, who doesn't love a bit of refactoring?

Body:
The "single var pattern" often found in Javascript suggests single points of return by insisting that all variables are declared at the top of the function body to prevent "hoisting". Thus, recording the evaluations instead of returning can prevent the need for an ELSE (which I have a strange aversion to...):

 function doThis(required){
    var result = false;
    if(required){
        //base implementation
        result = doThat();
    }
    return result;
 }

If you have sequential or optional conditions and can't break out to another function, then you can do this:

 function doThis(required, opt){
    var result = false,
        oRequirement = 'foo';
    if(required){
        //base implementation
        result = doThat();
        if(result !== false && opt !== undefined && opt === oRequirement){
                //optional implementations
                result = doOptional();
            } else {
                //undo previous truthiness
                result = false;
            }
        }
    }
    return result;
 }

You could delegate consumption of variables externally, making this function effectively a "guard clause":

 function vA(a){
     return true;
 }

 function vB(c){
     return true;
 }

 function vB(c){
     return true;
 }

 function doThis(required, opt){
    var result = false;
    if(vA(required)){
        //base implementation
        result = doThat(required);
        if(vB(result) && vC(opt)){
            //optional
            result = doOptional(opt);
        }else{
            result = false;
        }
    }
    return result;
 }

You could layer your evaluations:

 function doThis(required, opt){
    var result = false;
    if(if(vA(required)){
      //base
      result = doThat(required);
    }

    if(if(vB(result) && vC(opt)){
      //optional
      result = doOptional(opt);
    }
    return result;
 }

Ternaries can reduce size, and are very pretty, but they can be a little harder to debug, and a bit inconvenient if you need much in the way of nested evaluation steps:

function doThis(a, b, c){
    var o = false;
    if(valid(a)){ //assuming some sort of validation is required
        if(b !== undefined && valid(b)){
            o = c ? //an optional step
                doMore(a) ?
                    new Foo(a, b) :
                    false :
                new Bar(b, a) ;
        }
    }
    return o;
}

Generally speaking, I need to nest IF statements if optional arguments are present. When the outcome is the result of a process within the body, then it suggests delegating or chaining into a separate method.

Having said that, I can't help but feel that there is no "right" way (although there are certainly wrong ones...), and it's this fact that makes coding a creative profession capable of a broad range of expression. I mean, who doesn't love a bit of refactoring?


问:
What is the required background to apply Machine Learning to Finance?
I'm interested in machine learning in relations to the stock market (predicting future values of stocks etc).

What topics would I need to learn - e.g. what branch of AI to look into etc?
and what libraries/tools do I need?

答:
Machine learning is a whole field in Computer Science, which is quite different from Artificial Intelligence.

Stanford provides a free online class for machine learning which will get you started.

You need to understand that machine learning alone will most probably not be sufficient to create good trading strategies; you need to understand well how the markets work and most systematic strategies require large enough capital to minimize the transaction costs (otherwise the strategy is not profitable, see implementation shortfall).

To be able to understand and apply machine learning, you'll also need a good mathematical background (the better it is, the deeper you can go with the algorithms). I would recommend Information Theory, Inference and Learning Algorithms (MacKay) as a reference book for the field.


问:
Naming conventions: camelCase versus underscore_case ? what are your thoughts about it?
I've been using underscore_case for about 2 years and I recently switched to camelCase because of the new job (been using the later one for about 2 months and I still think underscore_case is better suited for large projects where there are alot of programmers involved, mainly because the code is easier to read).

Now everybody at work uses camelCase because (so they say) the code looks more elegant .

What are you're thoughts about camelCase or underscore_case

p.s. please excuse my bad english

Edit

Some update first:

platform used is PHP (but I'm not expecting strict PHP platform related answers , anybody can share their thoughts on which would be the best to use , that's why I came here in the first place)

I use camelCase just as everibody else in the team (just as most of you recomend)

we use Zend Framework which also recommends camelCase

Some examples (related to PHP) :

Codeigniter framework recommends underscore_case , and honestly the code is easier to read .

ZF recomends camelCase and I'm not the only one who thinks ZF code is a tad harder to follow through.

So my question would be rephrased:

Let's take a case where you have the platform Foo which doesn't recommend any naming conventions and it's the team leader's choice to pick one. You are that team leader, why would you pick camelCase or why underscore_case?

p.s. thanks everybody for the prompt answers so far

答:
For programming languages I've used, like Java, Python, C++, I've adopted a clear format:

ClassNamesArePascalCase

methodNamesAreCamalCase

variable_names_are_underscore

CONSTANT_VARIABLES_ARE_CAPITAL_VARIABLES

This allows me to immediately discern what I'm dealing with. I have found that to be useful to maintain for myself, and it should be easy to follow for someone else reading the code. I think as others mentioned consistency is most important. So I find my format to be simple enough to maintain, while providing clear distinctions between types of names. I could imagine interface_Names_Are_Like_This and Abstract_Classes_Are_Like_This as possible extensions, but seem to be more complicated to follow and maybe not as useful a distinction to make.

I've also found it useful to be strict and name things in PascalCase such as an HTML parser as HtmlParser instead of HTMLParser or HTMLparser. Because I believe it's easier to remember the strict rule and keeps the word boundaries clearer (unfortunately it requires misspelling things like HTML or SQL). Similarly with camelCase, htmlParserMethod instead of HTMLParserMethod or HTMLparserMethod.

UPDATE:

I've since found use in expanding these rules to include private variables.
 - _private_variable_names_are_prefixed_with_an_underscore
 - _PRIVATE_CONSTANT_VARIABLES_ARE_PREFIXED_WITH_AN_UNDERSCORE

In Java, this means that private fields are by definition in a different namespace than local variables, which means you can skip the this. on private fields. Other formats I've seen prefix with "m", but those formats also use camelCase for the variable names. This also allows me to make a distinction between fields that should only be accessed internally by the class (and making it super clear when it's happening outside of the class object._field_x stands out).

ContentLicense: CC BY-SA 2.5


问:
How can I separate the user interface from the business logic while still maintaining efficiency?
Let's say that I want to show a form that represents 10 different objects on a combobox. For example, I want the user to pick one hamburguer from 10 different ones that contain tomatoes.

Since I want to separate UI and logic, I'd have to pass the form a string representation of the hamburguers in order to display them on the combobox. Otherwise, the UI would have to dig into the objects fields. Then the user would pick a hamburguer from the combobox, and submit it back to the controller. Now the controller would have to find again said hamburguer based on the string representation used by the form (maybe an ID?).

Isn't that incredibly inefficient? You already had the objects you wanted to pick one from. If you submited to the form the whole objects, and then returned a specific object, you wouldn't have to refind it later on since the form already returned a reference to that object.

Moreover, if I'm wrong and you actually should send the whole object to the form, how can I isolate UI from logic?

答:
You should separate each piece of the Model, View & Controller, but there's no reason why you cannot (for example) pass Model objects between the Controller and the View.

So in your case, the Hamburger objects would be part of the Model. You then use your Controller to fetch the required list of Hamburgers, and pass those objects to the View (the combobox) to display. When your user has selected which hamburger, you can then pass the Hamburger object back to the Controller again for processing.

The point is, you can still unit test the "fetch Hamburgers" logic and the "process Hamburger" logic separately from the actual display of hamburgers.


问:
How To Handle Previously Uploaded Files
I'm new to PHP and MySQL and I've only seen posts related to this on Zend and ASP so I'm looking for some advice to point me in the right direction for a LAMP project.

I'm putting together a webform for a project of mine that logged in users will access to upload a submission. Each user will reuse previously uploaded files for each submission. At the bottom of the form the user can upload multiple files. Images, spreadsheets, and pdf's, etc. but I would like to give them access to files they have uploaded before rather than having to resubmit all new files for each submission.

My question is what is your advice on accomplishing this? I figure I could have each user create a library of files that they could access from the form in some way. Maybe a list of files with checkboxes to select previously uploaded files? I haven't found much here or on Google so I'm not sure if there is a standard way to handle something like this.

Note that the users will only be reusing only their own images, not those of the community. If it makes a difference I'm storing the images in MySQL as BLOB's. Thanks for any advice and information.

答:
Firstly, I'd stop storing your files as BLOBs - you already have a filesystem on your computer, and it isn't efficient to have MySQL act like a filesystem - just store the filepath in the database.

So, as for 'select previous files' - a list of filenames and checkboxes would be the simplest way forward - but that list could become quite long if they are a particularly active uploader. You'd probably want to be able to scroll the list independent of the form (using the CSS overflow attribute on a container element for the list of filenames) - maybe even a filter input (javascript).

As ChrisF mentions in his comment - there is an SE for User Experience, or you can try and think of other sites that do something similar.

Title: How To Handle Previously Uploaded Files


问:
What is an effective way to convert a shared memory-mapped system to another data access model?
I have a code base that is designed around shared memory.  Each process that needs to access the memory maps it into its own address space.  The data structures in the shared memory are directly accessed, that is, there is no API.  For example:

Assume the following:

```<code>typedef struct {
  int x;
  int y;
  struct {
    int a;
    int b;
  } z;
} myStruct;

myStruct s;
</code>```

Then a process might access this structure as:

```<code>myStruct *s = mapGlobalMem();
</code>```

And use it as:

```<code>int tmpX = s->x;
</code>```

The majority of the information in the global structure is configuration information that is set once and read many times.  I would like to store this information in a database and develop an API to access the database.  The problem is, these references are sprinkled throughout the code.  I need a way to parse the code and identify global structure references that will need to be refactored.

I've looked into using ANTLR to create a parser that will identify references to a small set of structures and enter them into a custom symbol table.  I could then use this symbol table to identify which source files need to be refactored.  It looks like a promising approach.

What other approaches are there?  Of course, I'm looking for a programmatic approach.  There are far too many source files to examine each one visually.

This is all ordinary ANSI C.  Nothing else.

答:
A slightly less all-or-nothing approach might be to populate the global structure and return only "const" pointers to it. Let the compiler warnings be your guide, again, but you only "must" update the writers. Initialize the struct once (add an is_configured flag, perhaps as a file scoped static?) on the first request, and if the "writer" function is called, refresh the struct and the backing database. @Lasse has the "right" answer, but this might be the "expedient" one for short-term duct-taping.

Downside: you'd need to handle some kind of asynchronous signal if another process changes a setting. On Unix/Linux, SIGWINCH is a good candidate, and SIGHUP is somewhat traditional. (SIGWINCH gets spurious hits if you're running from an xterm that gets resized, but for a background daemon, it's never called and defaults to being IGNored. SIGHUP defaults to killing you.)


问:
Is this bad design? How can it be improved?
I wrote the following a while back, but I've come to review it recently, and now don't think it's good design.

The design is for a kind of modular database layer using Entity Framework 4. There is a single database object which loads (lazily) entity framework contexts from external libraries in a specified location, and instances of the loaded contexts are stored in a hash table against their name (EG "ContentMgmtContext").

All contact with the database in this system is through stored procedures. To make a call to the database, the query method signature looks like this:

```<code>List<TReturn> Query<TReturn>(string Context,
                             string Procedure,
                             TransactionScope Scope,
                             List<ObjectParameter> QueryParameters)
</code>```

This modularity is something I like. However, there is one significant drawback to this approach: when using the database layer, the code using it has to have a reference to the library in which the context is stored, in order to access the types returned by the stored procedures through Entity Framework. In the model,  the objects from the database layer are translated in to new objects that the view and controller use.

I think this is bad design, but how can I improve it? I've considered adding an empty interface like IStoredProecedureObject to give every data type returned by a stored procedure a common base type, however this appears to be foiled by Entity Framework. Every time the .edmx file is recompiled, the code is generated anew, and any additions removed. Is there any way to stop this happening?

How can I improve this design? What (else) is wrong with it? Or am I on the right track?

答:
Disclaimer: I don't use entity framework and am heavily biased against just about any database helper framework.

It looks like you have made a wrapper.

I make a distinction between "wrapper" and "layer". Layer being something you might compile to it's own DLL/project/Jar/whatever. The data access layer. Wrapper being a "helper" class you use within that DLL. With the purpose of simplifying the interface, or maybe eliminate duplication.

The problem with simplifying the interface of database access is it's commonly not simple. You either end up duplicating the interface of ADO/JDBC/etc. Or you force people to bypass it. Wrappers tend to do all sorts of unwanted things. They may automatically close a connection when you need it open to support a transaction. They often mistakenly leave connections open if you had to stream data, and are using one of those garbage collected languages. To give the full power of the library behind your wrapper you are forced to duplicate it.

Libraries like ADO/JDBC are already a GREAT interface. They are some of the finest examples of OOP done right. I would prefer to use them over a wrapper some wizbang pulled out of his hat.

The classic JDBC/ADO style interface is well known and understood. The wrapper you pulled out of your hat is not.

Want to reduce redundant "paramters.Add"? Look into generics. Or just accept that by trying to reduce "paramter.Add" you actually just push the ".add" to another layer of code.

BTW this is a great question. I'd upvote it 10 times if I could.

Edit: Of course JDBC code would be hidden away in the data access layer.


问:
Am I misusing instance initialization?
I often write tests when I need to set data object for integration tests involving a few pages with forms. Herein each form on a page could be represented by a different data object class. There are are times when test end up in filling same data for a specific page while varying it for other pages and validating the overall flow.
I thought instead of setting data object each time from test method I can take advantage of instance initialization block to set data for tests.
Herein I have listed a smaller version of tests I usually write -

This my data class which holds data for form values - textbox, drop down etc. I have not kept setters for sake of brevity -

```<code>public class DataClass {

private int i;
private int j;

public DataClass() {
    i=1;
    j=1;
}

public int getI(){
    return i;
}

public int getJ(){
    return j;
}
}
</code>```

Following is the helper class which is used by test class to fill form data on page -

```<code>public class WorkerClass {

private DataClass data;

public void setData(DataClass data){
    this.data = data;
}

public int add() {
    return data.getI()+data.getJ();
}

public int substract() {
    return data.getI()-data.getJ();
}
}
</code>```

And here is the test method.
Notice that instead of calling setData of WorkerClass in each test method I used instance initialization block -

```<code>public class TestClass {

private DataClass data = new DataClass();
WorkerClass workerClass = new WorkerClass();

{
    workerClass.setData(data);
}

@Test
public void testAddition() {
    assert workerClass.add()==0:"addition Failed";

}

@Test
public void testSubstraction() {
    assert workerClass.substract()==0:"substraction failed";
}
}
</code>```

My question is, am I misusing instance initialization block and should rather be calling it from each test method, even if all the test method require same set of data?

答: Forget about 'should' and think about the goal: minimal tested code meeting the user's needs.  The shortest (tested) code is best.  If all your test methods require the same data, then there's no point in duplicating it.  </p>

Title: Am I misusing instance initialization?


问:
At the end of my rope
I am a contractor to a big company.  Currently, there are three developers on the project, myself included.

The problem is the other 2 developers don't really get it.  By "it" i mean the following:

They don't understand the best practices for the technology we are using.  After 6 months of me and others giving them examples there are terrible anti-patterns being used.

They are "copy and paste" programmers that produce primarily spaghetti code.

They constantly break things, implementing changes but not doing a basic smoke test
to see if all is good

They refuse/rarely to ask for code-reviews.

They refuse/rarely even do basic things like formatting code.

No documentation on any classes (jsdocs)

Afraid to delete code that doesn't do anything

Leave commented code blocks everywhere even though we have version control.

I find myself getting more and more frustrated as I format others code, fix bugs, discover functionality that is broken, and create abstractions to remove the spaghetti.

I really don't know what to do.  I try not to get to frustrated, but it's just a mess.  I like these people as people, but I feel like the coding situation is so bad that I could move faster if they simply browsed the web all day.

Would it be out of line to ask our manager to review the others svn commit access; commits can only be done after a review by someone who is knowledgeable in what we are doing?  As a contractor, I'm not sure if that's the best move.

Is there a subtle/not so subtle way of making it clear how many things I am fixing?

答:
I'm sure by now you've seen my comments and my other post, so I won't pretend that I actually know the answer. Best I can offer is a summary of what I've heard/read from others and add some of my own experience into the mix.

First, I want to say that a little while ago I came across a blog which belongs to one of our own Programmers SE members, Martin Blore and IMO this one specific post about TDD self-actualization is very accurate. TDD is the last, highest level that ties everything together but without previous levels, especially the largest one, principles and practices of producing clear and readable code, it will be very difficult if not impossible to make TDD work.

In my company, both Agile and TDD were imposed on us by management, and at first we simply did them because we were told (which is the opposite of agile). We've tried TDD twice and while I'm a huge proponent of using automated tests, I've personally thrown out all the ones that the team slapped together in the last release. They were fragile, gigantic, copy/pasted up the wazoo and riddled with sleep statements that made them run really slowly and unpredictably. My advice for your team: DO NOT DO TDD... yet.

I don't know what your situation is because you mentioned you've been with the company for only 6 months and that you are a contractor. Are your long-term goals to stay with this company or is the contract going to run out? I'm asking because even if you do something, it might take quite some time to actually see results.

Also when you join a team, it usually takes time before you get enough credibility and respect of your team where they (developers and management) would even consider anything you propose. In my experience, it helps if you put out few fires and demonstrate that you have skills and knowledge that others can depend on. Not sure if 6 months is enough. Quite frequently a new, ambitious person would join the team, then make a post here asking how they can change the world.  Sad reality is that they simply can't.

So assuming you have your team's respect and attention. Now what?

First, both management and developers need to be aware that there is a problem. Management measures results in terms of work delivered. If they are happy with the current quantity and quality of features, then sad reality is that they won't listen. As others have pointed out, without management's support, it will be extremely difficult to introduce any kind of change.

Once you do get management support, next step is to dig deep and identify the root causes of why the team operates the way it does. This next topic is something that's been a personal quest of mine of a little while now. So far this has been my journey:

Once you have management's support. You can start introducing a lot of centrally-dictated practices/processes that MainMa suggested in response to my question. We've done a lot of them (except for paired programming) and you definitely see benefits.  Code reviews especially helped to standardize on styling, documentation and also allowed us to shared knowledge/techniques among the team.  Even though, code reviews were dictated, the team actually likes them and we review every piece of functionality that is checked in. However...

You notice that the code that is generally written is still too coupled, design is bad or completely lacking. Code reviews catch some of it, but there's only so much you can rewrite. Why is design bad in the first place? -- A lot of developers have never been introduced to good practices and were never formally taught OOD in the first place.  A lot of people "simply coded" whatever task they were given.

With management's support you can introduce more process, such as discussing design before any coding takes place. But you are only one person and it seems that as soon as you don't pay attention the team reverts back to what they've always done. Why?

Can better practices or habits be introduced and taught so you don't have to constantly monitor? -- Turns out this part is not so easy.

Why are other team members reluctant to learn and pick up new practices and why are they so resistant to SOLID or DRY when it's been written about so much in modern software methodology literature? With all positive changes we've had in my team, 2 weeks ago I had an argument were I refactored 2 functions that had identical 15 lines of code and the reviewer called it heroic, unnecessary effort because there's nothing wrong with copy/paste of only 15 lines. I strongly disagree with such views but for now we've settled on agreeing to disagree.  -- So now what? Now we've reached the topic of my other post.

As maple_shaft and nikie pointed out in their answers (sorry, MainMa, you got the most votes, but you are so 5 steps behind :) ), you have reached a stage where "process" can no longer help you and nobody on this forum can tell you what the "fix" is. Next step is to approach individuals, maybe one-on-one, maybe as a team, probably both at one time or another and talk to them.  Ask them, what works and what doesn't. The only way to identify the root cause of what drives them is now to talk to them individually and find that out. As part of this step, I recently came across a completely different team problem, but I think Joel's answer here, which is very detailed and insightful, would apply to this case as well. In summary, while using management as "short leash" is a possible approach to just about anything, we need to remember that we are dealing with humans so to truly understand motivations we have to cross more into psychoanalysis than pure management or technical leadership.

So now you are talking to your teammates? What do you ask them? I'm not sure about this next part because I've never been here. Here's a possible scenario: Q: How come no SOLID? A: I don't need it. Q: It might help. A: I do alright as is. -- somehow you need to generate a series of sounds that would leave your mouth and cause the listener to recognize that things could be better if they give whatever you are peddling a chance.  If you fail here, they won't ever be convinced that whatever "the process" makes them do actually has any value. On the other hand if you get past this point, you'll probably find you don't even need "the process" any more.

IMO at the very root, your teammates won't learn if they don't see anything wrong with their current habits/practices. So maybe next step in all this is to find a way to illustrate, highlight the problems and make them obvious. After all, we are not writing readable code, using SOLID/DRY principles or maintaining documentation just because it gives us a warm and fuzzy feeling. We do it because it produces better quality code and frankly makes us code faster. Can that be measured? Maybe this is where software metrics come in?

Here's a crazy idea and I have no idea if it would actually work (it might be a standard industry practice, or it maybe completely invalid. I just made it up in the last 24 hours), but I'm very tempted to bring it to the table as soon as next year starts:

Against opinions of many others, introduce the idea of Author/Owner for all source files. As The Pragmatic Programmer suggests this will give a sense of ownership and responsibility to a single person who will be responsible for a piece of source code. It doesn't mean other people can't modify the code, we are all working as a team, but at the end of the day, person that owns the code is responsible for reviewing changes.

Create a source repository trigger that monitors all check-ins and specifically looks for those which are bug fixes. Make it a process so that every bug fix has a reference identifier right up front in the check-in description.  Now write a script that would parse a list of files that were changed and strip out the "Author" from the file header comment block.  Create a SQL database that would track # of defects checked in per file/per project/per author.

Once you have enough statistics, hopefully you will notice that your code has fewer defects/changes than some of the other code. This is hard data you can use. If a single project has significantly above average defect rate, bring it up as a candidate for next clean-up/refactoring effort to pay back some technical debt.

If a project or file has significantly above average defect rate and it has one owner, talk one-on-one with that person. Ask them, very politely, non-confrontationally what they can do to address this. Since they are the owner, they should drive the change, but offer any and all help from your side.  Hopefully, the owner will trace a lot of the causes to their own spaghetti code and as soon as they ask for help, that's when you spring into action and lay down some SOLID.

Title: At the end of my rope


问:
If you could only have one programming related book on your bookshelf what would it be and why?
One per answer please. I'll add my favourite as an answer.</p>

答:
Bruce F. Webster's "Pitfalls of Object Oriented Development"

We got too many "OO" developers who still don't know what an object or a class is or what is for; don't know what good OO, procedural, modular and structured programming look like; and somehow manage to cobble badly made pseudo-procedural code together with classes.

This book (plus a few 70's oldies on structured design) would go a long way in helping these poor souls finally get to understand what good object orientation should look like.

Furthermore, chances are that if I were forced to pick one book and one book only beside this one, I would not pick a technology-specific book.


问:
Is it worth listing testing or self-learning repositories on my résumé?
I have a GitHub repository with toy programs that I write when I learn something. For example, when I read an about an algorithms or data structures, I write up a quick implementation of of it to make sure that it works and I understand it.

I sometimes solve algorithm and data structure puzzles and that gets pushed into the repository.

Would this repository be worth linking on my résumé, or would it actually be a detriment to my chances of getting hired?

答:
I once heard a résumé described as "a balance sheet that shows only your assets but not your liabilities".

Based on this definition, you want to include projects that will be an asset to you in getting the job while leaving out those that might be a liability. This means they should be relevant to the job you are applying for and show off your best work. Even if you consider your code "toy programs" this doesn't means they can't be well structured. Hence, don't include throw-away code or dirty hacks. Keep those in a private repository. And of course you should be able to talk about your programs, the design decisions that went into them etc. I once had a candidate who claimed to have done this awesome project a year before, but then couldn't tell me anything about it. Not so good.


问:
Do more object declarations affect the program?
I am programming in Windows Forms and MySQL.

If I declare this in the program, I can use the connection and command objects in the whole .cs page:

```<code> MySqlConnection connection = null;
 MySqlCommand command = null;
 MySqlDataReader Reader;
</code>```

But if I write the code below, connection and command objects are declared twice:

```<code> private void cmbo_class_SelectedValueChanged(object sender, EventArgs e)
        {
            string clas = cmbo_class.SelectedItem.ToString();

            try
            {
                MySqlConnection connection = new MySqlConnection(hp.myConnStr);
                MySqlCommand command = connection.CreateCommand();
                MySqlDataReader Reader;
                command.CommandText = "select id,code from reg_class_master where name ='" + clas + "' and Delete_Status=0";
                connection.Open();
                Reader = command.ExecuteReader();
                while (Reader.Read())
                {
                    class_id = Convert.ToInt32(Reader[0].ToString());
                    class_code = Reader[1].ToString();
                }
                connection.Close();
            }
            catch(Exception ex)
            {
                MessageBox.Show("Error in ","Information",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }

            cmbo_division.Items.Clear();

            try
            {
                MySqlConnection connection = new MySqlConnection(hp.myConnStr);
                MySqlCommand command = connection.CreateCommand();
                MySqlDataReader Reader;
                command.CommandText = "select name from reg_division_master where class_id = " + class_id + " and Delete_Status=0 order by display_index";
                connection.Open();
                Reader = command.ExecuteReader();
                while (Reader.Read())
                {
                    cmbo_division.Items.Add(Reader[0].ToString());
                }
                connection.Close();
            }
            catch
            {
            }
</code>```

I think one object declaration is the best way. Do more object declarations affect the program?

答:
Since you haven't declared any of these variables as static, your choice won't noticeably impact the application. It's simply a matter of coding-style, code organization, and ultimately readability.

Since the connection isn't subject to change during the application's lIfetime, I think it makes sense to make it static so that all class instances can share it.

On the other hand, command may vary across methods and datareader will surely vary per execution, so it makes sense to declare and instantiate those within the event handler methods.


答:
Remember, a resume should be developed with the interviewer in mind, and most people don't want to have to sift through a treatise just to determine if you merit an interview. They want you to provide the most relevant information concerning the position in a concise manner. This requires careful prioritizing of content. I tend to customize my resume by position so-as to best highlight relevant information, and I believe this is a reasonable approach for this particular question.

If you're applying for a low-level, general developer position, then a broad range of programs could be useful. Maybe one of the toy programs illustrates the moment you finally "clicked" with javascript prototypes, or when you studied the your first LISP. These could be beneficial.

However, if you were applying for a position that required you to build compilers for national defense systems, the earlier-stated examples would be of little help to the interviewers. They'd be much more interested in other types of background information (compiler projects you've contributed to/lead, etc.)

All this to say, I would try to gauge the relevance of the toy projects to the current position. If they seem relevant to the current position (e.g., position requires git competency, position requires general predisposition to autonomous learning, etc.), then I would include the repository. Otherwise, there may be more important information that can be highlighted.

Title: Is it worth listing testing or self-learning repositories on my résumé?

Body:
I have a GitHub repository with toy programs that I write when I learn something. For example, when I read an about an algorithms or data structures, I write up a quick implementation of of it to make sure that it works and I understand it.

I sometimes solve algorithm and data structure puzzles and that gets pushed into the repository.

Would this repository be worth linking on my résumé, or would it actually be a detriment to my chances of getting hired?


问:
What is the best/easiest way to get my degree, already being an experienced developer?
I have been an active professional software developer (mostly utilizing .NET) for the past five years and, without being too full of myself, I would say I'm a very competent developer. I stay intimately up to date with the latest tools, the industry, and modern standards/practices. I work for a fairly high-level IT company and I swing just fine with the rest of them. I am even up to date on the latest team dynamic methodologies and feel like I have good leadership/management/people skills.

However, I never got my degree. I learned and am learning everything I know on my own from hundreds of books and experiences. I ran my own software company for a while until it took a big hit from the economy a year or so ago. It took a LONG time and A LOT of applications, but I finally found the job I have now.

Like an idiot I dropped out of college to forgo paying more tuition and I started my company and as life goes, I now wish I had stayed and got the degree. I have student loans that are in default and I'm working my hind end off to pay off those debts now that I am making a fair amount of money again.

I have hit too many ceilings without this degree. For one, I will never make as much as someone with the same level of knowledge and experience, but also has a degree. Also, the amount of effort it took to get a job in the industry without a degree was exhausting and depressing.

Now I am wondering what the best way for me to go about getting my degree is?

Are there online schools that would offer this degree?

Would an online school even be a good choice?

Would my knowledge and experience in the industry help me finish schooling faster/cheaper?

Have any of you ever found yourself in a similar position? If so, how did you overcome all the barriers put in front of you?

Have any of you ever had student loans in default and tried to go back to school later? How did you deal with that and how did it affect you?

答:
Here in Belgium and the Netherlands we have something called the open university. It's a collaboration between different universities and certain grades, like computer science, can be obtained from it.

You get your curriculum, information about the courses and the books you need to know for them and every time you learned a course, you just call to make an appointment to make the exam (two weeks beforehand). So in that way, you can do it as fast or as slow as you like. There aren't a lot of people doing this, most are just going to the "real" university, but it's a perfect solution if you're in your situation.

It's specially designed for adults who still want to obtain a degree and I think it's a great initiative.

I don't know where you live exactly, but maybe there are other initiatives like these where you are from? Over here the cost is really reasonable, I don"t think they charge more than normal students ($900 dollars a year if you include books, tuition, ...) but I'm afraid that it's a lot more expensive where you are from.

Apparently its origin lies in the UK and can be followed and is accredited by the United States. I don't know how expensive it is, but you can find more info on the wikipedia page or the official homepage.

It's something that I might do later too. I do business engineering now, but I really would like a computer science degree too.


问:
Implications of handles between forms
I was developing a WindowsForm application in C#, with 2 forms. Regardless of what they both did specifically I needed to access values in form2 and send them to form1 and vice versa. For this to happen I found someone talking about constructor overload and it worked for me as I explain in the code.

Form1:

```<code>namespace miniDldMngr
{
    public partial class Main : Form
    {
        miniDldMngr.SettingsForm settingsForm; //Instantiate settingsForm

        private void settingsToolStripButton_Click(object sender, EventArgs e)
        {
            settingsForm = new miniDldMngr.SettingsForm(this); //Create handle for Form1
            settingsForm.ShowDialog(); //Form properties were changed to act like a dialog
        }
</code>```

Form2:

```<code>namespace miniDldMngr
{
    public partial class SettingsForm : Form
    {
        private Main HandleToForm1; //local variable to store handle to Form1

        public SettingsForm()
        {
            InitializeComponent();
        }

        public SettingsForm(Main frm1Handle) //overloaded constructor with handle to Form1
        {
            InitializeComponent();
            HandleToForm1 = frm1Handle;
            txtIni.Text = HandleToForm1.comboLoad.Text; //here's how i access controls on form1 for example, as long as modifiers are public
        }
</code>```

I came across this answer on Stack Overflow and user codesparkle commented:

It's neither scalable nor OOP-like.

Which lead me to believe that it might not have been the best choice to solve my initial issue. (S)He further added:

One approach is to create an event in the class that knows the information which needs to be shown. The form can then register one of its methods as an event handler. Once the information becomes available, the class notifies the Form by calling that handler with an argument containing the displayable information. The beauty of this approach is that the class is decoupled (not dependent on) the implementation of Form. The MVC and MVVM design patterns are other robust ways of doing it.

Now I'm left with some questions:

What are the implications of the procedure I used?

Why isn't it an object-oriented approach?

What would be the best practice to send information back and forth between classes/forms?

How would you go about creating the event mentioned by codesparkle?

I don't know anything about MVC or MVVM design patterns, so some links to a structured explanation would be appreciated.

Please consider that I'm very new to programming and I won't understand you if you talk like I know what I am doing. Code examples work wonders with me, since I can test them.

答:
I think that others are concerned about tight coupling.

For instance, what will txtIni.Text display when Form2 has been instantiated with the default constructor?

In my opinion, you should resolve this value in its own property with a backing store, so that the alternate constructor, which Form1 would call, could set this property.

Title: Implications of handles between forms


问:
Storing hierarchical template into a database
If this title is ambiguous, feel free to change it, I don't know how to put this in a one-liner.

Example:

Let's assume you have a html template which contains some custom tags, like <text_field />. We now create a page based on a template containing more of those custom tags. When a user wants to edit the page, he sees a text field. he can input things and save it.

This looks fairly easy to set up. You either have something like a template_positions table which stores the content of those fields.

Case:

I now have a bit of a blockade keeping things as simple as possible. Assume you have the same tag given in your example, and additionally, <layout> and <repeat> tags. Here's an example how they should be used:

```<code><repeat>
  <layout name="image-left">
    <image /> <text_field />
  </layout>

  <layout name="image-right">
    <text_field /> <image />
  </layout>
</repeat>
</code>```

We now have a block which can be repeated, obviously. This means: when creting/editing a page containing such a template block, I can choose between a layout image-left and image-right which then gets inserted as content element (where content for <image /> and <text_field /> gets stored). And because this is inside a <repeat>, content elements from the given layouts can be inserted multiple times.

How do you store this? Simply said, this could be stored with the same setup I've wrote in the example above, I just need to add a parent_id or something similiar to maintain a hierarchy. but I think I am missing something. At least the relation between an inserted content element and the origin/insertion point is missing. And what happens when I update the template file?

Do I have to give every custom tag that acts as editable part of a template an identifier that matches an identifier in the template to substitue them correctly?

Or can you think of a clean solution that might be better?

答:
for your reference you can see Active directory implementation it is pretty much the same thing. but i would prefer you must use hierarchical database for this purpose.

you problem has solution is in No-SQL database. there are many databases with key value store schema under no-SQL umbrella.
Relational databases are not design for this purpose although you can use them by having parent child relationships, insertion is fine  but we will face difficulties while retrieving data.

if there is no restriction on changing the database you must go with that. but if you have no option other than SQL DB as you might have been using SQL for relational purposes it would be cumbersome to have separate DB base for this purpose only.

but again don't use  SQL DB for this purpose.


问:
How to spread awareness for generic programming among team members?
I am staying in an environment, where people believe:

Java generics are the feature exclusively used for library writing
and not for the real coding.

C++ is an OO programming language; template is an optional and
avoidable feature

Though, these people rely highly on the libraries written using generic programming (e.g. STL, Java containers). If I write a code using templates or generics, the code reviewer is most likely to reject it and will comment to write it in a "proper / understandable / elegant" way.

Such mentality is applicable from normal programmer to senior most manager. There is no way out, because 90% of the time, these people have their lobbying.

What is the best way (not being cut throat) of explaining them, the practical approach of writing code which constitutes OO and generic programming both at the same time ?

答:
Note "understandable".  If the code reviewer does not see the benefit of generics, then all the <<<>>>-stuff is just un-understandable noise which is unnecessary.

I would suggest having a look at how many actually, current bugs (open or recently fixed) that your bug database contains that could have been avoided by using generics.  Look for ClassCastExceptions.

Also note that if you do not have any bugs that could have been avoided by using generics then your colleagues have a point in that you do not need them.


答:
I'm working closely with machine learning experts, and I see that it requires a lot of expertise and math knowledge to apply ML correctly, You have not stated what your current background is. If this is mathematics, phyics, or aome other math heavy study, you could probably learn a lot online and from books. If not, to get up to the level to use ML as more than a black box, consider doing a masters degree which incorporates ML. People in finance not knowing statistics/ML, but still applying it because it gets them something that impresses their boss/client, but also could lead them to providing advive which results in the loss of millions of dollars.

I realize that doing a masters degree of two years is quite an investment. However, I think to really use ML sensibly, this could be a requirement.

Title: What is the required background to apply Machine Learning to Finance?

Body:
I'm interested in machine learning in relations to the stock market (predicting future values of stocks etc).

What topics would I need to learn - e.g. what branch of AI to look into etc?
and what libraries/tools do I need?


问:
Agile product planning alternatives to aid goal-oriented feature quality
What do I mean by high-level plan? The kind of plan that outlines product's functionality that needs to be developed but not going into too many details that are done afterwards. This kind of plan helps deciding functionality development order (priority) or even eliminating non-necessary ones. A great high level plan isn't just a set of functional requirements, but rather a product vision with obvious goal in mind.

In Agile terms these kind of functionality documentation is the Backlog. We're used to its content - user stories - as defined by Mike Cohn that go:

As a role I want functionality so that benefit.

But as we know from experience this may lead to:

unusable stories

Like: As a visitor I want to login so that I'm allowed to do stuff.

But how would one improve this user story? What other benefits can we describe that are more relevant than ...do stuff?

flat list of unmanageable seemingly unrelated stories

Hard to see which ones are related or not (they shouldn't be but I don't think we can totally avoid this), or even which ones provide means for achieving the same high-level goal.

too many unrelated goals/benefits

Goals just because we need to write them but without actual business value benefit - the high level business goal in mind.

The problem

As I have experienced there are more ways to write bad/unusable user stories than writing really good ones. And it's easy to get to the wrong tracks even if you're careful. And how can one write better user stories when they are working on their own product, so they don't have means to learn from other fellow team members, and they have to provide user stories now. Not after 6 months of learning.

That's why I would like to know about alternatives to planning a project on the high level that ensures better feature description and relevancy. I've heard of Effect mapping that seems very good in keeping goal focus and filtering relevant from irrelevant but I don't have any experience with it. I can imagine that setting a goal can be crucial. So if you set it wrong, everything else is wrong as well. Or better said irrelevant.

The main question is: Can we follow some easy to understand and narrow guideline that will lead us to a great high-level plan. A guideline that allows less errors and better leads to valuable plan/results. I can see myself writing user stories afterwards that describe features to implement. The problem with user stories is that it's easy to get lost in them. If you don't have lots of experience with user stories that may hinder your product because they distract you from the actual goal. All you can see are product features described in user stories. Something else above that would allow us to create better stories and also easily filter out those that are extremely relevant.

What are other more reliable approaches that simple user stories planning that are used in agile planning?

Focus of this question

I have been writing user stories on several projects in the past and know exactly how hard and vague this task is. I've also seen that writing these is even harder when you're writing them for your own project/product. You can easily over-design your product or incorrectly prioritise/evaluate features.

So I would like to write feature set for my coming product in a way they are actually relevant and prioritise them accordingly to reach my goal as reliably as possible.

So feature relevancy and quality along with goal-oriented prioritisation. And I'm talking about measurable quantitative goals like

20% month over month income increase or

  5% sale conversion rate of user visits

and not something vague like increase users or increase sales.

We can see that writing relevant features that support these goals is much harder.

答:
In our development group we use Scrum and manage the product and release backlog using stories alone. Few tips that could help you:

Don't write very low-level stories early on. If you are planning a release that is 6 months out, no need to fill backlog with 1-2 point stories.  That creates too much to manage.  Instead, define larger chunks (i.e. epic stories). Break down more important ones which you will start working on first, but leave the other ones at high point estimate.  That will help you keep number of stories in the backlog low

As others pointed out, story hierarchies are your friends.  Which ties into (1). When you get to a point where better estimate is needed take your Epic (or plain large) story and split it into smaller stories which will become it's children.

In the past, our backlog appeared as unmanageable mess of stuff which served no predictive value.  The key, which we've learned in the last release, is to continuously do some form of release planning and periodically check to see what is in the backlog.  The order of stories should match the priority in which these stories should be done.  As priorities/requirements change, backlog needs to change with them. Periodic reviews will

ensure the team knows what's ahead and

keeps the backlog from becoming a dumping ground

I read this somewhere (either a book or a blog, but don't remember where). The author suggested that backlog should never be planned out more than 12-18 months in the future.  He said that even if there are "important" items that you think you will do in the next release, you don't need to actually write them down and have to manage them.  If they are truly important, they'll come up in the next release planning.

What's the size of your team?  We've split our development group into 3 separate agile teams.  This way we have 3 scrum masters, 3 planning meetings and each team only has 1/3rd of the stories that they actually need to manage and shuffle.  Our team was split based on functional areas of the product and then the functional areas were adjusted for equal load.


问:
Simple issue tracker for 1-2 developers
I'm currently working mostly alone on a project (in Java). I'm mostly alone as I have an advisor that gives me high level instructions on what to do, and will seldom make any code contribution. She will code in a couple of acceptance tests from time to time, though.

I've never used an issue tracker before, and was thinking about starting to use one now, as I'd like to have a place where I can log possible bugs I find and keep track of them in a centralized manner. Would it be possible to integrate the issue tracker with Eclipse, better yet.

So here are the constraints:

It's NOT a open-source project. Our code is not to be shared with anyone!

we are and will be using Subversion;

we have our own Subversion server and we will keep using this same Subversion server;

it must be free;

it must allow at least 2 users.

What is your advice on what to pick? I'm looking for the simplest solution available.

答:
"the simplest solution available" is of course a judgement call.

I find FogBugz very easy to use and can recommend it for the use case you are describing. It is free for teams of two people and very affordable for larger ones, has an Eclipse plugin and integrates with Subversion.

In the interest of full disclosure: My experience with FogBugz has been with the on-premise version with the Visual Studio plugin and Perforce integration and not the exact setup you are looking for.

Title: Simple issue tracker for 1-2 developers


答:
First of all, the example you provided is not incredibly inefficient; its only slightly inefficient; its inefficiency is below the perceptible level. But, in any case, let's move on with the question.

The way I understand it, when we speak of separation of UI and Logic, we mean avoidance of close coupling.

Close coupling refers to the situation in which the UI knows (and invokes) the logic, and the logic knows (and invokes) the UI. To avoid close coupling one does not need to resort to abolishing coupling altogether. (That's what you seem to be aiming at by demolishing the interface between them down to a least-common-denominator string interface.) All one needs to do is to employ loose coupling.

Loose coupling means that A knows B, but B does not know A. In other words, the two parties involved play distinct client and server roles, where the client knows the server, but the server does not know the client.

In the case of UI and logic, the best way of arranging this in my opinion is by seeing the logic as a server, and the UI as a client. So, the UI is built for the logic, has knowledge of the logic, and invokes the logic, while the logic knows nothing about the UI, and simply responds to the requests that it receives. (And these requests happen to come from the UI, but the logic does not know that.)

To put it in more practical terms, nowhere within the source code files of the logic should you find any include/import/using statements that refer to UI files, while the source code files of the UI will be full of include/import/using statements that refer to Logic files.

So, to come back to your case, there is absolutely nothing wrong with the fact that the UI code which populates the combo-box knows about the hamburger class. There would be a problem if the hamburger class knew anything about combo boxes.

Incidentally, this design allows another thing which you should expect from such a system: it should be possible to plug as many different UIs as you wish to the logic, and the whole thing should still work.

Title: How can I separate the user interface from the business logic while still maintaining efficiency?

Body:
Let's say that I want to show a form that represents 10 different objects on a combobox. For example, I want the user to pick one hamburguer from 10 different ones that contain tomatoes.

Since I want to separate UI and logic, I'd have to pass the form a string representation of the hamburguers in order to display them on the combobox. Otherwise, the UI would have to dig into the objects fields. Then the user would pick a hamburguer from the combobox, and submit it back to the controller. Now the controller would have to find again said hamburguer based on the string representation used by the form (maybe an ID?).

Isn't that incredibly inefficient? You already had the objects you wanted to pick one from. If you submited to the form the whole objects, and then returned a specific object, you wouldn't have to refind it later on since the form already returned a reference to that object.

Moreover, if I'm wrong and you actually should send the whole object to the form, how can I isolate UI from logic?


答:
You could also take a look at BugZilla. See also this comparison of different bug trackers on programmers SE. Trac is also a good alternative to use as a tracker.

Another option is Sourceforge. To my knowledge, it is free regardless of the number of users. It includes an SVN repository (which you probably will not be using) and a tracker. For an example of how this tracker looks like, see this example form the Audacity project (open source recording software).

Title: Simple issue tracker for 1-2 developers

Body:
I'm currently working mostly alone on a project (in Java). I'm mostly alone as I have an advisor that gives me high level instructions on what to do, and will seldom make any code contribution. She will code in a couple of acceptance tests from time to time, though.

I've never used an issue tracker before, and was thinking about starting to use one now, as I'd like to have a place where I can log possible bugs I find and keep track of them in a centralized manner. Would it be possible to integrate the issue tracker with Eclipse, better yet.

So here are the constraints:

It's NOT a open-source project. Our code is not to be shared with anyone!

we are and will be using Subversion;

we have our own Subversion server and we will keep using this same Subversion server;

it must be free;

it must allow at least 2 users.

What is your advice on what to pick? I'm looking for the simplest solution available.


答:
You can use Mantis:
http://www.mantisbt.org/index.php

It's pretty simple, and it con be configured to integrate with SVN and Eclipse:
http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/
http://stackoverflow.com/questions/2939794/mantis-bug-tracker-api-integration

That said, sticking to just the basic features of Trac can make it pretty easy to use, too:
http://trac.edgewall.org/

Title: Simple issue tracker for 1-2 developers


问:
Learn HTML5 CSS3 and JavaScript
What is best way to learn these technologies which would enable me to understand all the 3 in a combined perspective rather than individually?</p>

答:
Mozilla Developer Network has great resources; In my opinion it also has the best JS reference.

HTML5

CSS

JavaScript

Title: Learn HTML5 CSS3 and JavaScript


答: Learning style depends from person to person and in case you feel right in learning from books, I would suggest Head First HTML5 programming. The book has pretty decent examples explaining the potential of HTML incorporated with javascript. A little background of HTML and CSS is expected for no looking back into basic HTML and CSS rules. It's pretty easier and covers the most of basic requirements in todays web-apps.</p>

Title: Learn HTML5 CSS3 and JavaScript

Body: What is best way to learn these technologies which would enable me to understand all the 3 in a combined perspective rather than individually?</p>


答:
SVN + Trac + Eclipse with SVN Team Provider plugin (& Mylyn if you want)

This will work for both concurrent personal and team projects.

From Eclipse (with the above plugins and Trac XML-RPC plugin) you and your team will be able to

access and use the SVN repo from within Eclipse and without restriction

track issue tickets via Trac

set personal and team tasks via Mylyn

track time spent by project members on each task

see all of the above in a single dynamic workspace

Title: Simple issue tracker for 1-2 developers


问:
Should one use pseudocode before actual coding?
Pseudocode helps us understand tasks in a language-agnostic manner. Is it best practice or suggested approach to have pseudocode creation as part of the development lifecycle? For instance:

Identify and split the coding tasks

Write pseudocode

Get it approved [by PL or TL]

Start Coding based on Pseudocode

Is this a suggested approach? Is it practiced in the industry?

答:
Is pseudo-code a suggested approach?
For beginning programmers, I say yes.  It helps the new programmer learn how to translate a problem into code without worrying about the exact syntax of the language.  This shapes the thought process and can help ingrain useful habits (and I suppose bad habits too).  This is why it is used in schools so much.

Is it practiced in industry?
In my experience, no.  No one has the time to rough out the project between the documentation (requirements, specifications, story boards, use cases or whatever else they use) and the actual code.  It is generally assumed that sufficient thought has already been put into the problem prior to the green-light to code.  At that point, coding the project is more important than adding one more layer of design preparation.


问:
Would you choose a database or a dvcs as storage for a documentation wiki?
I'm about to start coding a documentation oriented wiki, as a pet project. The core features are:

Extremely easy grouping of documents per version

Markdown syntax (subset of)

Multiple authors & projects

I'm still undecided on storage options. The obvious approach would be a database. Since this is a pet project, I will probably go with a NoSQL solution, probably MongoDB. Most work related projects are based around MySQL, and I want to keep this fun, i.e. not do the same stuff I do at work all day.

The less obvious approach would be Mercurial, in similar fashion to git-wiki. Mercurial would offer obviously tighter integration with the code and I won't have to build versioning. I still need some sort of database, to store repository info and possibly other stuff, but Mercurial would be the main storage for texts.

I've compiled a small list of the major points for each approach:

Database

Can shape it as I want, without caring for Mercurial workflow.

Code integration could be as easy as putting a link to the repository (but nothing more).

Quite easy to switch databases at any point, if need be (abundance of native tools).

Natural choice (more people are used to it, not coupled to a vcs).

Mercurial

Versioning and diff by default.

Tight integration with code means lots of cool stuff are possible, like a code review plugin.

I'll have to write a wrapper, I'm not happy with every ready made library I've evaluated (not necessarily a bad thing).

Some sort of database still needed.

Several valid workflows, the one I choose for the tool might not be very compatible with those people will choose for their code.

I want to make this as small and fun as possible, and I am a little bit stuck on the two approaches. Thoughts? Is there something obvious I'm missing? If this is too fuzzy to decide, what should I better define before I choose?

答:
If you're using Bitbucket with Mercurial, there's a built in wiki that uses Mercurial at a slightly different URL than your project, and it can be merged and branched separately, if you so choose. It uses a Wiki syntax that's not that different than any other Wiki system out there, and Wiki-based documentation is now fairly common at smaller companies that I've worked for.

I don't have the energy to build another wiki or documentation system, but if I were inclined to roll my own, I'd probably use some variation of this approach. It wouldn't be a hard sell with the documentation guy on our team, since most tech writers are now used to VCS in one form or another.

Documentation, by definition, is document-oriented, and a relational database is probably not the ideal fit for the problem; MongoDb is a reasonable alternative, but if you need versioning, diffs, and so on, you'll be reinventing solutions that are already well understood in version control systems. If you let the DVCS do the versioning for you, you'll be able to focus more on features that make your documentation-oriented Wiki, well, better for documentation.

Also, if you went the route of simply building the wiki features and not worrying about storage, since Mercurial gets you most of the way there, you can always refactor to support other storage mechanisms later, since you won't have tied your design to a specific database solution. If you start with the presumption of a database, you'll spend a lot of time engineering to support the interaction with the database, and it'll be hard to avoid the temptation to couple yourself to the features of the database system, so changing your mind later in that case may be harder.


答:
For small projects, I've become a big fan of Trello.  It has such a low barrier to entry, and such high usability, I would use it for any smaller projects.

If you want something a bit more complicated-looking and feature-complete, I'd second the suggestions of FogBugz or Bugzilla.

Edit to provide more "explanation and context":

The most common issue that I've noticed among smaller teams without dedicated project managers is that so many things just don't get entered into the system.  Either the devs don't take the time to enter en everything that needs to get done, or the issues are only sporadically updated as the work progresses.

Trello encourages users to actually keep the system up to date with good data by making it stupidly easy to add new issues and update the status of existing issues.

Most notably, its system of "lists" inside of boards can be easily and quickly tweaked to represent almost any system of milestones and issue-types that a small project would want to use.

It also supports more common issue tracking tools such as commenting on issues, voting on issues, reordering, tagging, and assignment - but they're all hidden out of your way (but pretty much right where you want them when you need them).

Bugzilla is a fine, fully-featured issue tracker, but there's no denying that it feels like creating and editing bugs is expensive.  FogBugz lessens much of the subconscious pain of tracking everything in your project, but still has enough edits and screens to feel like more work than, say, simply dragging a card from "doing" to "done" in Trello.

tl;dr - the best way to keep an issue tracker relevant and up to date is to make it as easy to use as possible, and that is what Trello was built to accomplish.

Title: Simple issue tracker for 1-2 developers


答:
It may not be "simple", but I consider it one of the best issue trackers in the business: Jira from Atlassian. It comes with a starter license of 10 users for 10 (aussie) dollars... I am using it as a solo-developer. (Please note that the site seems to have a preference for showing "on demand" licensing/pricing, and you may need the "download" pricing).

Another big plus for this starter rate: the full proceeds are donated to the Room to Read charity. So you can benefit from a full-featured bugtracker and feel good about it too :-)

Title: Simple issue tracker for 1-2 developers


答: Refactoring: Improving the Design of Existing Code

Title: If you could only have one programming related book on your bookshelf what would it be and why?

Body: One per answer please. I'll add my favourite as an answer.</p>


答:
For this concrete case, I think you have correctly identified the two almost identical declarations and initializations of the connection, command and reader as a problem. This maybe a gross oversimplification, but I live by wherever there is duplication, there is a design problem.

I would therefore move the delcaration of the connection etc. to the top of the method, do the initialization there once and then only change the command text at the two points of use. If the connection is used repeatedly throughout your application, you might even consider creating it only once at application start-up.

Generally speaking, there are (at least) two things to balance:

Limited variable scope: On the one hand, you want to delcare variables as close to where they will be used as possible, so you will never have to wonder where a variable came from, how it has been initialized etc. and you won't be tempted to re-use a variable for something else.

Resource consumption and performance: Constantly opening and closing a database connection is probably not a very good idea, as it is a (relatively) lengthy operation, incurs some overhead on the database server and might lead to a situation where the first half of your operation completes, but the second fails, because your reconnect to the database was unsuccessful.

Body:
I am programming in Windows Forms and MySQL.

If I declare this in the program, I can use the connection and command objects in the whole .cs page:

```<code> MySqlConnection connection = null;
 MySqlCommand command = null;
 MySqlDataReader Reader;
</code>```

But if I write the code below, connection and command objects are declared twice:

```<code> private void cmbo_class_SelectedValueChanged(object sender, EventArgs e)
        {
            string clas = cmbo_class.SelectedItem.ToString();

            try
            {
                MySqlConnection connection = new MySqlConnection(hp.myConnStr);
                MySqlCommand command = connection.CreateCommand();
                MySqlDataReader Reader;
                command.CommandText = "select id,code from reg_class_master where name ='" + clas + "' and Delete_Status=0";
                connection.Open();
                Reader = command.ExecuteReader();
                while (Reader.Read())
                {
                    class_id = Convert.ToInt32(Reader[0].ToString());
                    class_code = Reader[1].ToString();
                }
                connection.Close();
            }
            catch(Exception ex)
            {
                MessageBox.Show("Error in ","Information",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }

            cmbo_division.Items.Clear();

            try
            {
                MySqlConnection connection = new MySqlConnection(hp.myConnStr);
                MySqlCommand command = connection.CreateCommand();
                MySqlDataReader Reader;
                command.CommandText = "select name from reg_division_master where class_id = " + class_id + " and Delete_Status=0 order by display_index";
                connection.Open();
                Reader = command.ExecuteReader();
                while (Reader.Read())
                {
                    cmbo_division.Items.Add(Reader[0].ToString());
                }
                connection.Close();
            }
            catch
            {
            }
</code>```

I think one object declaration is the best way. Do more object declarations affect the program?


问:
Telerik ASP.NET MVC components licensing
There's thread on stackoverflow about this
https://stackoverflow.com/questions/5524046/is-telerik-extensions-for-asp-net-mvc-free

It says that it is ok for internal site, but I think it is still not clear (also in faq notice about internal site usage is gone I think).

They say, as long as website is internal, you should be ok with open source license, but

1) Can I use it for site, that has closed community, I mean only logged in people will use telerik components?

2) Can I use only for site's administration part, that means that only internal staff will access it?

UPDATE: It looks like same question (same license type) - Using GPL libraries without modification on a commercial website, do I need to make my source code available?, but answers are completely different?

UPDATE2: I don't wish to in any way distribute site's code.

答: If you are developing open-sourced software you may use the free version.  If you don't want to (or can't)  then you will need a paid license.  </p>

OwnerDisplayName: Giedrius

OwnerDisplayName: Matthew Whited