答:
There pretty much aren't any. I sure hope that you, for example, never use the same variable twice.

```<code>void foo() {
    print_int(x);
}
void bar() {
    print_string(x);
}
</code>```

Now how do you call both foo and bar from the same function?

This is effectively akin to simply using a global variable, and it's bad for all the same reasons.

Title: When would dynamic scoping be useful?

Body:
With dynamic scoping, a callee can access the variables of its caller. Pseudo C code:

```<code>void foo()
{
    print(x);
}

void bar()
{
    int x = 42;
    foo();
}
</code>```

Since I have never programmed in a language that supports dynamic scoping, I wonder what some real world use cases for dynamic scoping would be.

Body:
There pretty much aren't any. I sure hope that you, for example, never use the same variable twice.

void foo() {
    print_int(x);
}
void bar() {
    print_string(x);
}

Now how do you call both foo and bar from the same function?

This is effectively akin to simply using a global variable, and it's bad for all the same reasons.


问:
When would dynamic scoping be useful?
With dynamic scoping, a callee can access the variables of its caller. Pseudo C code:

```<code>void foo()
{
    print(x);
}

void bar()
{
    int x = 42;
    foo();
}
</code>```

Since I have never programmed in a language that supports dynamic scoping, I wonder what some real world use cases for dynamic scoping would be.

答:
Not 100% sure if this is an exact match, but I think it at least gets near enough in a general sense to show where it may can be of use to break or change scoping rules.

The Ruby language comes the templating class ERB, which for example in Rails is used to generate html files. If you use it looks like this:

```<code>require 'erb'

x = 42
template = ERB.new <<-EOF
  The value of x is: <%= x %>
EOF
puts template.result(binding)
</code>```

The binding hands access to local variables to the ERB method call, so it can access them and use them to fill the template. (The code between the EOFs is a string, the part between <%= %> evaluated as Ruby code by ERB and would declare it's own scope like a function)

A Rails example even better demonstrates this. In an article controller, you would find something like this:

```<code>def index
  @articles = Article.all

  respond_to do |format|
    format.html
    format.xml  { render :xml => @posts }
  end
end
</code>```

The index.html.erb file could then use the local variable @articles like this (in this case the creation of an ERB object and the binding are handled by the Rails framework, so you don't see it here):

```<code><ul>
<% @articles.each do |article| %>
  <li><%= article.name</li>
<% end %>
</ul>
</code>```

So by use of a binding variable, Ruby allows to run one and the same template code in different contexts.

The ERB class is only one example of usage. Ruby allows in general to get the actual state of execution with variable and method bindings by use of Kernel#binding, which is very useful in any context where you want to evaluate a method in different context or want to keep a context for later use.

ContentLicense: CC BY-SA 3.0

Title: When would dynamic scoping be useful?

Body:
Not 100% sure if this is an exact match, but I think it at least gets near enough in a general sense to show where it may can be of use to break or change scoping rules.

The Ruby language comes the templating class ERB, which for example in Rails is used to generate html files. If you use it looks like this:

require 'erb'

x = 42
template = ERB.new <<-EOF
  The value of x is: <%= x %>
EOF
puts template.result(binding)

The binding hands access to local variables to the ERB method call, so it can access them and use them to fill the template. (The code between the EOFs is a string, the part between <%= %> evaluated as Ruby code by ERB and would declare it's own scope like a function)

A Rails example even better demonstrates this. In an article controller, you would find something like this:

def index
  @articles = Article.all

  respond_to do |format|
    format.html
    format.xml  { render :xml => @posts }
  end
end

The index.html.erb file could then use the local variable @articles like this (in this case the creation of an ERB object and the binding are handled by the Rails framework, so you don't see it here):

<ul>
<% @articles.each do |article| %>
  <li><%= article.name</li>
<% end %>
</ul>

So by use of a binding variable, Ruby allows to run one and the same template code in different contexts.

The ERB class is only one example of usage. Ruby allows in general to get the actual state of execution with variable and method bindings by use of Kernel#binding, which is very useful in any context where you want to evaluate a method in different context or want to keep a context for later use.


问:
Should a special version of a website be developed for tablet users?
Does the desktop browser version of a web site always suffice for the tablet version(assuming no flash)? or is it common for websites to have a special tablet version that is different from both desktop and phone?</p>

答:
Websites can be set up in a way that they adapt to the screen size of the device. This is called responsive design, where the design reflows in response to the viewport. This can also be simulated by reducing the width of a browser on a desktop system.

This technique can remove the need to do a separate site version for the purpose. Depending on the need of the site, a full mobile version may be appropriate; in other cases, a responsive design will suffice.

Good articles on the subject:

http://www.alistapart.com/articles/responsive-web-design/

http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/

Examples of responsive designs: http://mediaqueri.es/

ContentLicense: CC BY-SA 4.0


问:
Promoting scalability in small business applications
I am part of a small software company that specializes in small to medium-sized business applications and my experience with distributed architectures/SOA is limited. Please let me know if I'm going about this all wrong.

We often start development on small business applications, where a distributed architecture seems like overkill and will not be implemented as such. However, in some cases, the project expands way beyond the original scope, and the preferred solution may later become a distributed one.

How do we ensure from the very beginning that this transition becomes as smooth as possible, with a minimum cost of performance and (primarily) time? Specifically, I'm looking for advice in regard to the architecture of the solution in order to achieve this.

Take this simple example:

At first a windows application is running on several computers, invoking all business logic locally in an assembly that is distributed along with the application.

Later, the business logic is moved to a central server, and the windows application must now communicate with the business layer through a WCF service.

The obvious answer here would be to just create the WCF service from the very beginning and have it run locally on each machine, but my initial thought was that this could cause undesirable time consumption on projects with strict deadlines, due to increased overhead in development (having to maintain the intermediate layer(s) etc.).

One of the concrete problems with the initial architecture is that instances of objects are passed from the windows application to the business layer, thereby creating a dependency that could break code when moving to a distributed solution.

By 'simulating' a distributed solution, we could ensure that our developers aren't unintentionally introducing these sorts of issues.

What is the best way to achieve this scalability?

Am I wrong in my assumptions regarding time consumption and performance?

答:
You are not wrong about regarding the time factor. It will take longer to design and develop a partitioned application such as you are suggestng. However, given your past experiences you can see that the time will be well spent.

It seems to me that if you would partition the application much like a distributed application, as you suggest, you would remove dependenecies and clearly define areas of responsiblity. Using interfaces and other software, such as a message bus to decouple your components, you could build an application quickly but enable it grow if needed.


问:
Why isn't Java used for modern web application development?
As a professional Java programmer, I've been trying to understand - why the hate toward Java for modern web applications?

I've noticed a trend that out of modern day web startups, a relatively small percentage of them appears to be using Java (compared to Java's overall popularity).  When I've asked a few about this, I've typically received a response like, "I hate Java with a passion."  But no one really seems to be able to give a definitive answer.

I've also heard this same web startup community refer negatively to Java developers - more or less implying that they are slow, not creative, old.

As a result, I've spent time working to pick up Ruby/Rails, basically to find out what I'm missing.  But I can't help thinking to myself, "I could do this much faster if I were using Java," primarily due to my relative experience levels.

But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application.

Which brings me to my question(s):

Why is Java not being used in modern web applications?

Is it a weakness of the language?

Is it an unfair stereotype of Java because it's been around so long (it's been unfairly associated with its older technologies, and doesn't receive recognition for its "modern" capabilities)?

Is the negative stereotype of Java developers too strong? (Java is just no longer "cool")

Are applications written in other languages really faster to build, easier to maintain, and do they perform better?

Is Java only used by big companies who are too slow to adapt to a new language?

答:
Simple answer: learning curve to base productivity.

Framework based systems like RoR tend to put the "magic" in the language/syntax. It is very easy to ramp up on your basic RoR syntax and get an app up and going.

Java was a language first, and tools and frameworks showed up later. So you have to learn Java first, and then you have to learn Spring, or Grails, or your super IDE, or whatever. Favorite example of Ruby, it doesn't require setters and getters. Fact is, Java IDEs got rid of the manual coding too...but it is still in your source. The benefit of this approach, is that below the framework, there is a language that consistent that all Java developers can work with.

This benefit is dubious to small startups where time is of the essence. Usually, they are doing very little that they couldn't do with an out of the box framework. So they can grab their RAD system of choice and have an app live the next day.

But if you look at Facebook and Twitter, as they expanded, they found things that couldn't be handled by out of box frameworks and so they had to use lower level technologies.

This holy war that framework developers have that they can do anything faster is bogus, they can do a lot of what they need simpler and with less of a learning curve. And for a lot of things, that is "good enough." Use what is right for the problem.


答:
I think the key is to use good OO principles and make sure your components are cohesive.  Keep the business logic in the business logic layer and the presentation logic in the presentation layer and make sure they are at worst loosely coupled.

Then, if the application needs to be scaled, you can add the mechanisms for the WCF service, but you're not rewriting the logic.

Title: Promoting scalability in small business applications

Body:
I am part of a small software company that specializes in small to medium-sized business applications and my experience with distributed architectures/SOA is limited. Please let me know if I'm going about this all wrong.

We often start development on small business applications, where a distributed architecture seems like overkill and will not be implemented as such. However, in some cases, the project expands way beyond the original scope, and the preferred solution may later become a distributed one.

How do we ensure from the very beginning that this transition becomes as smooth as possible, with a minimum cost of performance and (primarily) time? Specifically, I'm looking for advice in regard to the architecture of the solution in order to achieve this.

Take this simple example:

At first a windows application is running on several computers, invoking all business logic locally in an assembly that is distributed along with the application.

Later, the business logic is moved to a central server, and the windows application must now communicate with the business layer through a WCF service.

The obvious answer here would be to just create the WCF service from the very beginning and have it run locally on each machine, but my initial thought was that this could cause undesirable time consumption on projects with strict deadlines, due to increased overhead in development (having to maintain the intermediate layer(s) etc.).

One of the concrete problems with the initial architecture is that instances of objects are passed from the windows application to the business layer, thereby creating a dependency that could break code when moving to a distributed solution.

By 'simulating' a distributed solution, we could ensure that our developers aren't unintentionally introducing these sorts of issues.

What is the best way to achieve this scalability?

Am I wrong in my assumptions regarding time consumption and performance?


答:
A very useful application of dynamic scoping is for passing contextual parameters without having to add new parameters explicitly to every function in a call stack

For example, Clojure supports dynamic scoping via binding, which can be used to temporarily reassign the value of *out* for printing. If you re-bind *out* then every call to print within the dynamic scope of the binding will print to your new output stream. Very useful if, for example, you want to redirect all printed output to some kind of debugging log.

Example: in the code below, the do-stuff function will print to the debug output rather than standard out, but note that I didn't need to add an output parameter to do-stuff to enable this....

```<code>(defn do-stuff []
  (do-other-stuff)
  (print "stuff done!"))

(binding [*out* my-debug-output-writer]
  (do-stuff))
</code>```

Note that Clojure's bindings are also thread-local, so you don't have an issue with concurrent usage of this capability. This makes bindings considerably safer than (ab)using global variables for the same purpose.

Title: When would dynamic scoping be useful?

Body:
A very useful application of dynamic scoping is for passing contextual parameters without having to add new parameters explicitly to every function in a call stack

For example, Clojure supports dynamic scoping via binding, which can be used to temporarily reassign the value of *out* for printing. If you re-bind *out* then every call to print within the dynamic scope of the binding will print to your new output stream. Very useful if, for example, you want to redirect all printed output to some kind of debugging log.

Example: in the code below, the do-stuff function will print to the debug output rather than standard out, but note that I didn't need to add an output parameter to do-stuff to enable this....

(defn do-stuff []
  (do-other-stuff)
  (print "stuff done!"))

(binding [*out* my-debug-output-writer]
  (do-stuff))

Note that Clojure's bindings are also thread-local, so you don't have an issue with concurrent usage of this capability. This makes bindings considerably safer than (ab)using global variables for the same purpose.


答:
You should think ahead which parts would be considered 'client-side' and which would be 'server-side'. The server tier would be exposed via a service layer, not necessarily using WCF or any tecnology. At first, would be just an interface (IService). In the client tier you would have a delegate layer that knows how to reach the service layer. At first it would be only one-liners to call the service layer. When you decide to change your arquitecture you can just change the service to be a WCF service and the delegate to setup endpoints and stuff to reach your service.

Hope that helps.


问:
How to handle "can you add just a few more fields" type of requests from customers?
Very commonly we have feature requests for fields that only one customer wants. This, at best, clutters the application's code. Often when we look in their database a few months after adding the fields, we can see that they are not actually even using the extra fields. Also, it's quite an old application so adding a single field requires multiple code changes, changing reports, and making sure that it doesn't affect other customers who do not need to see the field.

How can we make sure that a customer actually needs these feature requests?

How do we politely say "you don't really need that"?

Currently we are beginning to charge for certain feature requests. (Previously, feature requests were free usually) Is there anything else we can do?

答: Are they paying for the additional features? If so, then it's really not your business whether they are using them or not.  Give them what they pay for.  If, however, that is not the case, then it's up to your leadership to decide if they are willing to keep adding features at no additional income.</p>


答:
We have a similar situation. The way we handle is building a trust-based relationship which gives us the liberty to say "you don't need this". It takes time, pacience and you have to be prepared to talk a lot and have lunches and other boring tasks. These boring meetings will pay for themselves in the long term where you can focus on creating really important features.

Talking will also make you see if what they're asking is really that important.

Title: How to handle "can you add just a few more fields" type of requests from customers?

Body:
Very commonly we have feature requests for fields that only one customer wants. This, at best, clutters the application's code. Often when we look in their database a few months after adding the fields, we can see that they are not actually even using the extra fields. Also, it's quite an old application so adding a single field requires multiple code changes, changing reports, and making sure that it doesn't affect other customers who do not need to see the field.

How can we make sure that a customer actually needs these feature requests?

How do we politely say "you don't really need that"?

Currently we are beginning to charge for certain feature requests. (Previously, feature requests were free usually) Is there anything else we can do?


答:
Feature "requests" are just that, requests. If they're making demands then you need to decide how much it is worth to the company to "clutter" the codebase with that. If it becomes an endemic problem then you can clamp down on it, but if they're willing to pay what you're asking or something close to it and it's just a few features here and there, I say go with the money.

To go even further, if this is a constant issue with your product and multiple customers are looking for these sort of customizations, perhaps it's time to rethink these portions of your app and make them flexible in a way that the customers are empowered to do this themselves, be it ad-hoc reporting, flexible data gathering, etc. Try to turn these annoyances into a selling point. "Our stock data model not good enough for you? Check out our customization options! You can do it yourself!"


答:
I don't think you can get into the "do you really need it?" arguement with customers. Personally, I'd like to ask, "How will this make your company more money?" but the fact of the matter is, some manager, for some reason wants to track it and they're use to getting their way. If you don't want to do it, say no or charge such a large amount of money to discourage the request.

Start considering ways to make it easier for your application to handle a larger number of customer fields.

Allow labels in reports and forms to be set by the customer to utilize existing fields.

Add generic fields (String12) to existing or additional custom field tables.

Have a user defined field system where this is all handled by data entry and not having to create new columns in tables (I cannot remember what this is called-help.).

You may find that existing customers are out-growing your system. The industry may be shifting so new requirements are popping up.

Sorry, but if you can't offer your customers what they want purely for technical reasons and not profit, you need to pick up the pace. It wouldn't be difficult for a new comer to enter your market with more fields, so don't let that happen.


答:
You should be speccing out exactly what you are going to be doing in said feature and applying an estimated time to build it. If the customer wants additional fields that is fine, bill them for it. I tell my customers that if you want to add features after i've built the feature, that is fine, but it's going to cost a bit more to work them in, in some cases.

I'm having a hard time understanding why you care if they use it or not. It's simple, you build what they want and you get paid for it.

Code base clutter? If you need to refactor your code when working in the new feature charge them for it.


答:
Looking from the other side of the window for a moment, at my last job I was exposed to an ERP system that allowed "custom" columns to be added by the end user to any entity/table.  From my brief interactions with it, it looked like they were dynamically adding the columns to a second table with a one-to-one mapping.  For instance:

WIDGET table with static columns:

WIDGET_ID

WIDGET_NAME

WIDGET_COST

etc.

WIDGETCUSTOM table with user-definable columns:

WIDGET_ID

WIDGET_WEIGHT

DID_BOB_WORK_ON_WIDGET

etc.

The WIDGET_ID column could tie them together.  It automatically showed your extra fields when you were editing a widget, and you could include them in dynamic reports, or even search by them.  It was fairly efficient because the database could still keep track of them and index those columns if necessary, etc.

From a programming standpoint, I see how that would keep it sane.  Every customer can have their own custom columns, but those custom columns don't interfere with your core logic.


答:
Create a list of several features you consider adding, including adding "just a few extra fields".
Show the list to your customers and ask them for feedback on which ones they'd like first.
Explain that your resources are limited and that you can't do it all at once.
Use the feedback to decide what direction you want to go with your application.

If a customer insists that the few extra fields really are that important and you still decide on not adding them, hopefully the customer can still see the benefit of the features you are implementing instead.


问:
How risky is it to use Coffeescript without knowing Javascript?
I'm a reasonably experienced programmer trying to learn web developement.  I'm trying to develop a client-side web application which uses svg or canvas for graphics.  I've decided I'd like to write the application code in Coffeescript.  I don't know either Javascript or Coffeescript.

How necessary knowing Javascript to Coffeescript web development?  Am I likely to hit some gnarly problem which requires me to understand Javascript?  Can I work happily with Javascript APIs from Coffeescript?

Edit:
I could easily learn the basics of Javascript in a week.  I'm more concerned that Javascript seems to have a lot of hidden sharp edges.  In the strangest language feature question on StackOverflow Javascript is one of the most common languages.  It has an unusual object and class model.  It has non-obvious name scoping rules.  I find it takes more than a week for me to really know a language.

I'm going to work on a small simple project to learn web development.  Would I be better off to use Javascript or Coffeescript?  I think in the long run I'll prefer Coffeescript but I'm willing to start with Javascript if that I'm going to need a thorough understanding of Javascript to use Coffeescript.

答: The coffeescript documentation defines coffescript in terms of the equivalent javascript. If you do not understand javascript, you will not understand coffeescript either.</p>


问:
Avoiding wrapper objects in collections
I'm getting a little annoyed of having to wrap primitive types in wrapper objects to store them in collection data structures (sets, maps, lists, etc.) in languages like Java and Objective C. I'd really like to have, say, a Map data structure that works the same way whether I'm mapping NSNumbers to Strings or integers to doubles or integers to MyBigCustomObject*.

My understanding is that the reason collection data structures in these languages require wrapping in an object is so it can just always assume that the number given is a pointer - I actually can make a NSDictionary with [NSDictionary dictionaryWithObject: MyCustomObject forKey: 1], but it will treat the 1 as a pointer instead of an integer, try to access memory address 1 and segfault. But I don't see any reason why you couldn't make a collection data structure that keeps track of the type of keys and values that wouldn't have this problem. Even a relatively inflexible data structure like a Map of specifically-ints to specifically-pointers-to-objects would be a decently common use case (I certainly could use one, I'm doing a lot of work recently that involves indexing objects by an integer ID). Is there a reason why this isn't a common paradigm in languages that have an Object/primitive type distinction?

答:
in Java, this seem to be a common paradigm indeed. One can find plenty 3-rd party libraries for collections like you refer to. Some of these were discussed at SO: What is the most efficient Java Collections library? Searching web for java library high performance collections shows even more, like eg HPPC

The reason why such libraries didn't make it into standard Java API (yet?) is most likely that these did not gain popularity sufficient to justify such an inclusion (yet?). Another possible reason is that there seem to be no common agreement (yet?) on how to design standard API for these collections. As Joshua Bloch said, Public APIs, like diamonds, are forever. You have one chance to get it right so give it your best.

Title: Avoiding wrapper objects in collections


答: This is basically what happens in C++- the language always knows whether something is a pointer or not. Quite simply, there is no fundamental reason that this is required at all- Java and other languages just do it because they enjoy restricting programmer freedom.</p>

Title: Avoiding wrapper objects in collections

Body:
I'm getting a little annoyed of having to wrap primitive types in wrapper objects to store them in collection data structures (sets, maps, lists, etc.) in languages like Java and Objective C. I'd really like to have, say, a Map data structure that works the same way whether I'm mapping NSNumbers to Strings or integers to doubles or integers to MyBigCustomObject*.

My understanding is that the reason collection data structures in these languages require wrapping in an object is so it can just always assume that the number given is a pointer - I actually can make a NSDictionary with [NSDictionary dictionaryWithObject: MyCustomObject forKey: 1], but it will treat the 1 as a pointer instead of an integer, try to access memory address 1 and segfault. But I don't see any reason why you couldn't make a collection data structure that keeps track of the type of keys and values that wouldn't have this problem. Even a relatively inflexible data structure like a Map of specifically-ints to specifically-pointers-to-objects would be a decently common use case (I certainly could use one, I'm doing a lot of work recently that involves indexing objects by an integer ID). Is there a reason why this isn't a common paradigm in languages that have an Object/primitive type distinction?


问:
What to do when the programming activity becomes a problem?
I once saw a program (can't remember which) where it talked about people "experiencing flow" when they are doing something they are passionate about. When "in flow", they tend to lose track of time and surrounding, concentrating only on their activity at hand.

This happens a lot for me when I program; most particularly when I face a problem. I refuse to give up until it's solved. This usually leads to hours just rushing by and I forget to eat lunch, dinner gets pushed into far into the evening, and when I finally look at the clock, it's way into the wee-hours of the night and I will only get a few hours of sleep before having to rise early in the morning. (This is not to say that I'm in flow only when facing a problem - but I find it particularly hard to stop programming and step back when there's something I can't solve immediately.)

I love programming, but I hate it when it disrupts my normal routines (most importantly eating and sleeping patterns). And sitting still for so many hours, staring a screen, is not healthy.

Please, any ideas on how I can get my rampant programming activity under control?

答:
Use technology to break you out of the flow.

For example, if you're using Windows 7, parental controls can lock you out of your account at specified times (meal times, bed time, etc). My suggestion would be to set up another installation of Windows (dual-boot) with all your development tools. Remove everything development related from your original Windows installation. On the development install, set up an administrator account with a long auto-generated password that you entrust with someone else (or put the password out of reach in some other way), and set up a limited account with parental controls which limit what hours you can use the account, so that during that time you're locked out of your account (locking the workstation doesn't close any applications, so there won't be any loss of work).

Getting the admin password to override the parental controls should be a long and inconvenient enough process to break you out of the flow, or a process that you won't consider doing at all (e.g. wake someone up late at night to ask for the password). As soon as you break out of it, hunger, thirst, and/or sleepiness will settle in, taking the place of adrenaline, and getting back into the flow will be pretty hard.

That's the general idea. I'm sure there are similar technological solutions you can try that will be more suitable for you (and that work on your preferred OS). I'm sure there are also solutions that require less work to set up, but I find that the less they require, the easier they are to bypass and the less chance they have of interrupting your flow.

ContentLicense: CC BY-SA 2.5


问:
What is Visual Studio Lightswitch and how does it differ from normal Visual Studio versions?
How is Visual Studio Lightswitch different from regular Visual Studio? In what sort of situations would you use this IDE over regular Visual Studio?

I'm trying to decide if this is something that would be worthwhile for me to take the time learning since I am currently doing WPF/Silverlight development.

答:
LightSwitch is for one kind of app and one kind only - a forms-over-data app. One where the ui is pretty much driven by the schema of the data, and you want to offer essentially CRUD to that data. It lets people without a lot of coding experience wire up forms to serve that purpose. Its big advantage is that when the app starts to grow organically and get a little out of hand, an actual experienced developer can take over in Visual Studio and add more things as required. This in contrast to say an Access app that can go so far and then no further.

It also has some bells and whistles like being a client (Desktop) app or a web app as a configurable choice, supporting a nice range of extensions and custom controls, and being all Silverlighty and beautiful. If you aren't writing forms-over-data, you don't care. If you are, look into it.


答: It sounds like you might benefit from some sort of pull system. Let the user choose what feature gets implemented next, but limit the number that can be in development at any given time. A Kanban board is terrific for this. It can give the user ownership of the priortiztion process (aka less responsibility and stress for you). Trust me, if the user is forced to decide which feature gets put into development next, knowing that the other requests will be put aside, they will invest a lot more in really deciding what they need to have. </p>


答: From what I can tell, programmers are not the intended audience for the product. It would mostly help you do the things you can already trivially do as a WPF developer anyway, while slowing down the challenging custom work that does not fall within the template. I shudder to think about modifying the auto-generated code that gets cranked out on the backend. It looks pretty awesome for its intended use, but just does not seem to add much value for a WPF developer IMHO.</p>

Title: What is Visual Studio Lightswitch and how does it differ from normal Visual Studio versions?

Body:
How is Visual Studio Lightswitch different from regular Visual Studio? In what sort of situations would you use this IDE over regular Visual Studio?

I'm trying to decide if this is something that would be worthwhile for me to take the time learning since I am currently doing WPF/Silverlight development.


问:
How do you report "startup experience" on your resume?
Say you've spent a significant amount of time (5 years) serially starting up companies, with enough success to keep going for 5 years, but not enough to retire rich.

And now, with a mortgage and a serious relationship, burned out, you're trying to dust off your resume and get a regular, 9-5 job.

How would you record/report on your work experience at the startups?

Making a list of technologies sounds silly (it'll get out of hand on account of size), and very incomplete (with very small, early stage startups, there is a lot more work to go around than just hacking away at code). A regular programming job also seems like a waste (with all of the mix of experience that comes from working at a startup, giving up on the additional skills learned along the way doesn't feel quite right) so reporting on the experience as one would on a regular programmers' resume might not be the correct thing.

答:
That is a very difficult question to answer without knowing exactly what you are looking for.  First, identify the opportunities that really interest you.  Then, once you have identified an opportunity that you want to pursue, tailor your resume to best fit that opportunity.

It sounds like you have a plethora of skills and experience that could fit many types of openings not just programming, but also on the project management and director/business side as well.

Therefore, adjust your resume according to the opportunity and highlight the best of the related experience for that job.


答:
I report mine just like another job:

1/200X - 12/201Y - SuperCoolStartup - Co-Founder and Technical Lead

Brief company description, including funding and other measurable forms
  of success

Brief description of management duties

Brief description of technical duties and technologies used

I also try to tailor my resume for each job. Sometimes I emphasize management duties, other time the technical solutions.

Title: How do you report "startup experience" on your resume?

Body:
Say you've spent a significant amount of time (5 years) serially starting up companies, with enough success to keep going for 5 years, but not enough to retire rich.

And now, with a mortgage and a serious relationship, burned out, you're trying to dust off your resume and get a regular, 9-5 job.

How would you record/report on your work experience at the startups?

Making a list of technologies sounds silly (it'll get out of hand on account of size), and very incomplete (with very small, early stage startups, there is a lot more work to go around than just hacking away at code). A regular programming job also seems like a waste (with all of the mix of experience that comes from working at a startup, giving up on the additional skills learned along the way doesn't feel quite right) so reporting on the experience as one would on a regular programmers' resume might not be the correct thing.


答:
Things to Downplay

Firstly, a major concern for a lot of employers would be the "serially starting up"? Because one thing that worries employers is a lot of job changes in a short period of time. (For the obvious reason that they're worried about you jumping ship to a new job at an inconvenient point)

The other would be "burned out". Nothing says "hire someone else" like "I've done my best work, now I'd like to settle for you". You need to find a more positive way to describe what you're looking for in a company.

What to Emphasise

At the end of the day, CV's fall into two types. One is the one you put online for recruitment firms. In this case, just dump literally EVERYTHING on it. Every programming language you'd be willing to work in, every soft skill you possess, every place you've worked for. They're basically using a big ol' regex, and you want to catch as many jobs as possible so you get a good range of available jobs.

The other CV is the one you write for the companies you're actually seeking out yourself. These are the ones you tailor, for example emphasising that you've got very strong programming skills in the area the company you want to work for works with, and why you want to work for them.

Note that occasionally, a recruiting firm will contact you based on the former CV, and it's often worth drafting a CV of the latter type, in order to get past the far more stringent hiring department of the companies they send your CV on to.

The other thing that helps with either kind of CV is examples of how you've applied your soft skills.

For example: "Very Customer Focused" vs. "Customer Focus: During one project dealt with the client on a weekly basis, clarifying requirements and demonstrating prototypes over the entire project lifespan. This helped to build trust and contributed to being offered further work from this client."

The first will be picked up by the regex, along with every other CV on the internet. The second will prove that you actually did something they can talk to you about in interview, and will be picked up by the regex.

Basically, write something that hits the requirements so that it's listed when they look for it (programming languages, soft skills), but when you read it back makes you think, "I'd like to talk to this guy and find out if he's actually worth hiring". And for god's sake don't add anything that gives them an excuse to reject you. Any firm worth working for is getting multiple applications for each place. If they see something that makes them go hmmmm, that allows them to trim the stack of the CV's down by one.


答: I think you should ask your customer to put one or more of you through a "day at the office" to see how they really use the software... Wait... Hire me for $250/hour and I will go find out.  Also, please, please don't goldplate. Make it just work. Most businesses don't care that it looks ugly when it works well.</p>


答:
You can't, unless you're going for a managerial role.

But just because you can't explicitly include it in your resume, it doesn't mean it doesn't exist. Your experience and knowledge gained from creating startups will be prevalent in any interview. The resume is just a necessary (small) step.

It'll feel silly to write a resume that, on paper, will look extremely different to what you've achieved and learnt in the last five years. But, it has to be done. It has to be done in order to show your prospective employers that you are capable of fulfilling the role. While you were creating startups, you've been on that side. You know what it is like to look for someone that will fill the gap and bring the best to the business.

Get an interview by showing you can do the job. Then let yourself shine from there. Oh, and please don't apply for jobs where you'll be performing menial tasks for more than 15% of the time because you'll just be dead bored.


答: Track the requests. As you get to designing/developing the big features, pick a handful of prioritized requests to include in that release.


问:
Should I remove unreferenced code?
I'm working on a medium sized (100k lines) code base, it's all relatively recent code (less than a year old) and has good unit test coverage.

I keep coming across methods which are either no longer used anywhere or only referenced in unit tests which only test that specific method.

Should I remove this code if I'm certain that it's no longer needed?

Reasons to remove it:

Less code, less bugs

Less code is easier for others to digest

It's still under source control

Reasons to keep it:

Can be used as reference

It may be useful sometime

It may have been written to 'round-out' the functionality for a class

答:
In my experience, removing unused code can backfire too. You may forget you had that code and you won't look for it in the history. Or you may not even know someone had implemented that code and then removed it later. Again, you won't look for it in the history...

No doubt, having unused code is a bad smell.

UPDATE: I just noticed Ed Staub gave a very similar answer.

Title: Should I remove unreferenced code?


问:
How to automate a tasks system in a CMS software
I'm currently developing v2.0 of my personal cms. However, I'm stuck. I strongly feel that my old solution for "tasks" is not very dynamic and must be revisited. Currently I'm looking the whole concept of how to dynamically add tasks and run them.

What I mean by task system

Like always in cms software, there are a lot of content, such as images, dynamic files, database entries, etc. I created my own task system aka. The Parser (sounds evil right?) It is made of two files, one parser-classes and other the triggers with the $parser = new ParserClasses(); (I hope you understand what I mean.) Some of the features the parser does:

First turn off the site (after the parser is done, turn it back on)

Checks for active files (files that don't have parent mysql entry, will be deleted)

Clears out old cache

Generates new static cache

Deals with languages and translation related cache

and other tasks related to cms management and maintenance

Why do I want to make it more automatic

Basically all plugins and some themes (add-ons in general,) use this task system. But the problem is that it's not very dynamical, because all functions sit in one huge class. This means that the add-on cannot be installed without opening your php editor.

How I was planning to do it

First I would create my own task language, with preset functions to handle files, cache,  etc. (very broad example: GenerateFreshCache('pages')). Now, storing it is the issue.. My ideas are:

To create tasks-table in mysql database. Then add tasks there, with my task language. Later while() them from the database and eval(). (This is a good way, because I can add scheduled times and similar in function, for CRON jobs. Or even categorize the tasks.)

Add .php files to some folder, where they get loaded. They will probably use the same task language, but don't need to be eval()'ed. (I'm scared that this would slow down the parser, because so many files are getting included.)

However, I'm not sure about those ideas and I'm hoping someone has already come across this functionality and can give me pointers. All crazy ideas and concepts are welcome, thanks in advance.

Conclusion

Thanks to everyone who replied. I picked the answer, that helped me the most and not "ohh, too much work, use framework". My task systems core is done and working. Took 2-3 days and currently ~600 lines of code and two classes (outer and inner core.) I finally ended up with two mysql tables, one with tasks (task db) and another with combos (multiple tasks combined together for easier run.) Also, added some features so it would be safe to run via ajax (cant really talk about that, top secret^^). There are might be too many loops, handling the tasks parsing, however this makes adding new tasks very very simple.. Just add it to tasks DB and add the task to cron-list-automatic-run-list or run it straight up via the admin panel.

答: I don't see any particular advantage of files over a DB.  But why limit yourself to eval(), why not compile and cache the compiled code (if you think a one time hit that can often happen in the background is better in your case)?</p>


答:
I've relatively frequently had the experience of finding a function that looks like it will do exactly what I need, and trusting it to work since it's been in production for a long time, only to find out it hasn't actually been used in several years.  Code that isn't used isn't maintained, and while it may have worked years ago, the API all around it has changed enough that you can't trust it.

At best, you end up spending a lot of time making sure it actually still does what you want.  At worst, it appears to work until you get bitten with a nasty bug later, and take longer tracking it down because you assumed the "production-tested" code works so the problem must be somewhere else in your new code.  In my experience, it's almost always quicker just to write a new function myself.

If you delete it, but find out relatively soon you actually need it, it's right there in source control.  If you don't need it until so much time has passed that you don't remember it's in source control, you're probably better off writing it from scratch anyway.

Title: Should I remove unreferenced code?

Body:
I'm working on a medium sized (100k lines) code base, it's all relatively recent code (less than a year old) and has good unit test coverage.

I keep coming across methods which are either no longer used anywhere or only referenced in unit tests which only test that specific method.

Should I remove this code if I'm certain that it's no longer needed?

Reasons to remove it:

Less code, less bugs

Less code is easier for others to digest

It's still under source control

Reasons to keep it:

Can be used as reference

It may be useful sometime

It may have been written to 'round-out' the functionality for a class


答:
Microsoft's Site below has a link on the right side of the page that links to PDF document titled "White Paper: What is LightSwitch?" - Site:

http://www.microsoft.com/visualstudio/en-us/lightswitch/overview


问:
Data Mining Books
I'm passionate about data mining, I have read some books like Programming Collective Intelligence, and I would like to know more good books, specially practical ones, about data mining in conjunction with AI. Any tips will be appreciated as well. Thanks.

答:
Ok. The following books are the top books that any data mining lover would recommend you reading:

Artificial Intelligence: A Modern Approach

Data Mining: Practical Machine Learning Tools and Techniques, Third Edition

Data Mining: Concepts and Techniques, Second Edition

Read those and you "won't need" any more theory =) However, you will need to get your hands dirty.

Title: Data Mining Books


答:
Data Mining, 3rd Edition is really extensive and useful book. I read it to learn about Data Mining. It contains advanced Data Mining subjects like "Real Machine Learning Schemes", "Data Transformation", "Ensemble Learning" and Weka data mining project.

Machine Learning and Data Mining for Computer Security as it is obvious discuses data mining in the perspective of Computers security.

Data Mining Concepts, Models and Techniques is a gentle introduction and a well explained book about data mining in general.

Title: Data Mining Books

Body: I'm passionate about data mining, I have read some books like Programming Collective Intelligence, and I would like to know more good books, specially practical ones, about data mining in conjunction with AI. Any tips will be appreciated as well. Thanks.


问:
Portable programming style
I'm a Python programmer that prefers to develop on Windows but still end up deploying to a Linux server.

I've just finished writing a little script: stuff that downloads files from a site, generates a sitemap, gzip it, pings the search engines and emails the response code.

Nowadays most GNU tools are available and compiled also for Windows and I sure do use Wget and Grep whenever I need to.

Until now I've always tried to implement the functionality I needed in Python (gzipping and opening urls require very few lines of code) but I found myself thinking if maybe I could write more resilient code if I didn't reinvent the wheel and just scripted everything in a bash script style where a big part of the functionality is delegated to an external process such as mail, wget, curl, etc and the other tools *nix makes generally available.

What is your take on this? When you target *nix do you glue tools together or you tend to implement all the functionality in your scripting language of choice?

答:
When you target *nix do you glue tools together or you tend to implement all the functionality in your scripting language of choice?

Note that most scripting languages are good at interacting with other programs, so when I use them instead of sh or bash, it is seldom for "implementing all functionality" myself.

The decision point I have found is, how much arithmetics or data structures is needed. Often a shell-script is fine. At other times a perl- or python-program is better.

In bash there are array variables, string operations, and integer arithmetics, but any non-trivial use of these tend to be awkward and produce ugly code.

A plus with the Bourne Shell family, is the very useful case-esac construct.

Title: Portable programming style


答:
Nothing consumes less time than no code.

If you have to dive into a codebase, you need some time to figure out, what that code is used for, and if it is used for nothing, you need even more time.

Ok - this could be healed be a comment, but then again, everybody will reason about why this unused code is still in the code base, whether it should be removed or not.

If there is nothing, nobody will lose time with it.

If it was hard to get it right, you need a good documentation, that this code exists, but if the codebase evolves over some iterations, maybe it will not longer work, if it gets reactivated.

Title: Should I remove unreferenced code?


问:
Is it out of line to give unsolicited constructive criticism to a programmer?
I recently started work at new office that uses a proprietary program written by a solo developer. He's occasionally around as part-time tech support, but the company has signed off on this software and he's no longer being paid to develop it.

As a user of his software there are many issues that leap out to me as a source of concern:

very simple to directly view the DB as a low-privilege user

passwords stored as plaintext

dictionary admin passwords

app uses the DB root account

DB doesn't meet 1NF (eg. appointment1, appointment2, etc.)

I feel like these are serious issues and that if I were him I'd want them pointed out to me, but I'm not a qualified programmer (I'm a social worker) and I don't know if it would be rude of me to just buttonhole him and start blabbering about salted hashes and normal forms, especially when this is no longer a paid task of his.

Is it out of line? If not, how would you broach it?

Edit - more info prompted by comments:

The application holds sensitive data.

It's for internal use, but it's running on lots of machines in several cities and many visitors come through our offices.

My concerns are for the developer's future projects as well as this specific one.

答:
As a social worker, would you appreciate it if this programmer were to come to you to advise you on how he thought you had mishandled an important case you once worked on, but were no longer assigned to?

I'd say that he would be on very shaky ground for approaching you; the reverse is also true.

Under the circumstances, I'd say that if you have concerns for the security state of the application in question (and given what you've written here, you should have such concerns), that would be best served by bringing your concerns up to those who have some power to effect corrections.  Trying to educate the former developer is not your bailiwick, and is more likely to be seen as interference than anything else.


答:
Remove unused code - less clutter, better understanding. Your version control system will take care.
Also, if you are using anything better than notepad, your environment will allow you to use older code for reference.

Long comments of old code are distracting and make difficult navigating.

Regards

Title: Should I remove unreferenced code?


问:
Rails data model - best practices question
I'm writing a Rails cookbook app as a learning exercise. I've created a table for Recipes which holds info for the recipe (name, author, etc...). I also have a table for Ingredients which will be a master ingredients list, and then a table in-between which holds info specific to that recipe/ingredient combo (for example, the ingredient table would have a listing for Onion, the in-between table would have the amount, technique (slice, chop, etc...) and whatever else for a particular recipe).

Anyway - this is all working fine, but as I add ingredients to the table, I realize there are quite a few categories of ingredients (Spices, Vegetables, Meats, Fruits, etc...) and they have different bits of info I want to record about them. For example, meats and veggies might have the technique field (chop, dice, mince, etc) but spices might have a "spice_type" field to record if it is dry or fresh. Meats might require a "doneness" field (well-done, rare, etc..) while fruits do not...

So, the crux of my question - is it better to have one large ingredients table with fields for every category, only using the ones I need for a particular row, or is it better to create five tables, one for each type of ingredient?

I started coding it as separate tables, as it seemed proper since I am holding different fields for each type, but then I realized how much work it will be to code 5 x models, 5 x controllers, 5 x views, etc...

SO, better to stuff it all in one table (after all, they are all ingredients!), have each record just leave the non-applicable fields nil, and make my views/etc.. dynamic to adapt to whatever type of ingredient is being worked with (essentially hiding or displaying the appropriate fields)?

I hope this makes sense, whenever I get on this site I turn into a rambling fool ;)

Thanks for the help

Update:

I was making some beer yesterday and thinking about my beer recipes along the lines of my cookbook app, and realized the beer recipes are a much better example of what I am trying to figure out, so below is the same question posed in a different paradigm:

In my beer recipes, I have three types of Ingredients. There is malt, hops, and yeast.

They are common in the sense that they are all ingredients, and will all have a few common attributes such as Name, Brand, and Price. However, there are specific attributes to each that the others don't share - for example, Malt has an SRM attribute (essentially color), while Hops has an AA (alpha acids) attribute, and yeast has a Flocculation attribute.

So do I go STI and lay out a table like this?
id, type, name, brand, price, srm, aa, flocculation

Additionally, the "in-between" table will contain different info on each. All ingredients will have an Amount attribute, but hops will have a BoilTime and malts will have a MashTemp, etc...

So do I use one table with STI and one "in-between" table to join? Do I make the "in-between" table STI as well?

I have a lot of reading to do! :)

答:
Does each type have different fields or does the one field hold a different meaning depending on the ingredient category? You can have a text field to hold the extra information (sorry, I don't have a name for it; maybe Additional Preparation?) to the ingredient. Meat (Chopped), Pepper (Freshly Ground). You could query by this field if necessary. </p>

<p>The other option is to link to a different table for each ingredient category. I don't see a need for it unless you want to have some sort of lookup to make sure users select "Freshly Ground" instead of "Ground" or "ground". The other reason would be if each category had several fields that were different instead of just one field with different meanings. Options on a car would be very different than options on a motorcycle. </p>

Body:
Does each type have different fields or does the one field hold a different meaning depending on the ingredient category? You can have a text field to hold the extra information (sorry, I don't have a name for it; maybe Additional Preparation?) to the ingredient. Meat (Chopped), Pepper (Freshly Ground). You could query by this field if necessary.

The other option is to link to a different table for each ingredient category. I don't see a need for it unless you want to have some sort of lookup to make sure users select "Freshly Ground" instead of "Ground" or "ground". The other reason would be if each category had several fields that were different instead of just one field with different meanings. Options on a car would be very different than options on a motorcycle.


答:
It makes sense that you combine the different ingredients in 1 table - You should:

have a unique ID for each row independent from the ingredient name, for example, the literal 'fruit' is not a good key.

define non-used fields as null/blank

don't run calculations on non-used fields (this is correct in your case indeed)

have a column that indicates the ingredient type

Hope this helps

Title: Rails data model - best practices question

Body:
I'm writing a Rails cookbook app as a learning exercise. I've created a table for Recipes which holds info for the recipe (name, author, etc...). I also have a table for Ingredients which will be a master ingredients list, and then a table in-between which holds info specific to that recipe/ingredient combo (for example, the ingredient table would have a listing for Onion, the in-between table would have the amount, technique (slice, chop, etc...) and whatever else for a particular recipe).

Anyway - this is all working fine, but as I add ingredients to the table, I realize there are quite a few categories of ingredients (Spices, Vegetables, Meats, Fruits, etc...) and they have different bits of info I want to record about them. For example, meats and veggies might have the technique field (chop, dice, mince, etc) but spices might have a "spice_type" field to record if it is dry or fresh. Meats might require a "doneness" field (well-done, rare, etc..) while fruits do not...

So, the crux of my question - is it better to have one large ingredients table with fields for every category, only using the ones I need for a particular row, or is it better to create five tables, one for each type of ingredient?

I started coding it as separate tables, as it seemed proper since I am holding different fields for each type, but then I realized how much work it will be to code 5 x models, 5 x controllers, 5 x views, etc...

SO, better to stuff it all in one table (after all, they are all ingredients!), have each record just leave the non-applicable fields nil, and make my views/etc.. dynamic to adapt to whatever type of ingredient is being worked with (essentially hiding or displaying the appropriate fields)?

I hope this makes sense, whenever I get on this site I turn into a rambling fool ;)

Thanks for the help

Update:

I was making some beer yesterday and thinking about my beer recipes along the lines of my cookbook app, and realized the beer recipes are a much better example of what I am trying to figure out, so below is the same question posed in a different paradigm:

In my beer recipes, I have three types of Ingredients. There is malt, hops, and yeast.

They are common in the sense that they are all ingredients, and will all have a few common attributes such as Name, Brand, and Price. However, there are specific attributes to each that the others don't share - for example, Malt has an SRM attribute (essentially color), while Hops has an AA (alpha acids) attribute, and yeast has a Flocculation attribute.

So do I go STI and lay out a table like this?
id, type, name, brand, price, srm, aa, flocculation

Additionally, the "in-between" table will contain different info on each. All ingredients will have an Amount attribute, but hops will have a BoilTime and malts will have a MashTemp, etc...

So do I use one table with STI and one "in-between" table to join? Do I make the "in-between" table STI as well?

I have a lot of reading to do! :)


答:
I currently work in a company which has quite a few "I hate Java" Developers. It used to stun me too. I certainly hate all the hoards of technologies that are available with Java. This makes taking decisions too difficult. Its like When you have too much choice you have no choice. You have to spend time with 100's of frameworks to really come up with the framework that works for you. The standard Servelt architecture is waayy to complicated for most applications. This is not the case with Ruby, Django and stuff. They are are more of a single framework rather than language.

The biggest complaints I hear from developers

The Syntax is too long. Just to print something we have to write System.out.print. You cant really use a simple VI like editor and write out a working piece of code in a few hours.

Weak test frameworks. Even though the testing frameworks are very similar in Java and Ruby, Ruby takes a step forward by making thing easily available for testing. This is especially true if you are using DB extensively in your application. Even many of the Web frameworks dont think about testing.

Templates are a pain. Makes the relatively simple language into a Noodle Soup.

Not Cool. Most Java applications are written in huge companies, which is associated with Bureaucracy that does not go so well with developers. People don't think Google when they think Java. Google == Python. It has also to do a lot with no books coming out indicating do X in Y days.

Dont like to compile. To most developers compilation is a decade old phenomenon. It made sense in 80's with C but mordern computers can do a lot more. They dont write code in compiled languages. Java is one of the very few languages that is compiled and used to write web applications.

Too many Oops Concepts. Even though developers have quietly adopted the Oops domain. They dont like it in full. They dont like when you write an application with 10 classes with each class doing just one thing. Makes you open 100's of files and imagine interaction across 100's of classes, sometimes with frameworks. Makes the whole programming activity a chore. This could be true with most languages but I have seen that Java Developers pay a lot of attention to what a class does. Its the Java Developers who often come up with a code with 100's of classes. This is good from many perspectives but non java developers hate it.

So all in all Java imposes a steep curve at the beginning of the project, which means too much money to be committed. Add to this a huge community attached to java, each thinking in different ways and no one to really spear head the whole community. They also dont see talks and conferences conducted by the community showing off all the cool new things. No new cool books. Java it looks like will go down because it was used to solve too many different problems a few years back.

Title: Why isn't Java used for modern web application development?

Body:
As a professional Java programmer, I've been trying to understand - why the hate toward Java for modern web applications?

I've noticed a trend that out of modern day web startups, a relatively small percentage of them appears to be using Java (compared to Java's overall popularity).  When I've asked a few about this, I've typically received a response like, "I hate Java with a passion."  But no one really seems to be able to give a definitive answer.

I've also heard this same web startup community refer negatively to Java developers - more or less implying that they are slow, not creative, old.

As a result, I've spent time working to pick up Ruby/Rails, basically to find out what I'm missing.  But I can't help thinking to myself, "I could do this much faster if I were using Java," primarily due to my relative experience levels.

But also because I haven't seen anything critical "missing" from Java, preventing me from building the same application.

Which brings me to my question(s):

Why is Java not being used in modern web applications?

Is it a weakness of the language?

Is it an unfair stereotype of Java because it's been around so long (it's been unfairly associated with its older technologies, and doesn't receive recognition for its "modern" capabilities)?

Is the negative stereotype of Java developers too strong? (Java is just no longer "cool")

Are applications written in other languages really faster to build, easier to maintain, and do they perform better?

Is Java only used by big companies who are too slow to adapt to a new language?


问:
Why is DRY important?
Quite simple, why would I want to write code that works for all cases and scalable data when all I need to do is repeat the same process a few times with a few minor tweaks?

I'm unlikely to need to edit this again any time soon.

It looks like a lot of less work to just go...

```<code>function doStuff1(){/*.a.*/}
function doStuff2(){/*.b.*/}
function doStuff3(){/*.c.*/}
</code>```

And if I ever need to add something...

```<code>function doStuff4(){/*.d.*/}
</code>```

And if I need to remove it, I remove it.

It's harder to figure out how to make all of those into one straight-forward pattern that I can just feed data into and deal with all the cases, and make a bunch of changes I don't feel like I'm ever going to have to do.

Why be DRY when it looks like a quick cut+paste is going to be so much less work?

答:
Because DRY will be less work later.

DRY: (Don't Repeat Yourself)

One function taking an argument.

```<code>def log(arg):
    print(arg)
</code>```

C&P: (Copy&Paste)

26 gazillion functions doing essentially the same thing, but with a 2 char difference.

```<code>def logA():
    print('a')

def logB():
    print('b')

...ad infinitum...
</code>```

How about we update our printing to specify what exactly is printing?

DRY:

```<code>def log(arg):
    print(arg + "Printed from process foo")
</code>```

Done.

C&P:

You have to go back and change every single function.

Which do you think would be easier to debug?

Title: Why is DRY important?

Body:
Because DRY will be less work later.

DRY: (Don't Repeat Yourself)

One function taking an argument.

def log(arg):
    print(arg)

C&P: (Copy&Paste)

26 gazillion functions doing essentially the same thing, but with a 2 char difference.

def logA():
    print('a')

def logB():
    print('b')

...ad infinitum...

How about we update our printing to specify what exactly is printing?

DRY:

def log(arg):
    print(arg + "Printed from process foo")

Done.

C&P:

You have to go back and change every single function.

Which do you think would be easier to debug?


答:
If you repeat yourself, you can create maintainability issues. If doStuff1-3 all have similarly structured code and you fix a problem in one, you could easily forget to fix the problem in other places. Also, if you have to add a new case to handle, you can simply pass different parameters into one function rather than copy-pasting all over the place.

However, DRY is often taken to an extreme by clever programmers. Sometimes to not repeat yourself you have to create abstractions so obtuse that your teammates cannot follow them. Sometimes the structure of two things is only vaguely similar but different enough. If doStuff1-4 are different enough such that refactoring them to not repeat yourself causes you to have to write unnatural code or undergo clever coding backflips that will cause your team to glare at you, then it may be ok to repeat yourself. I've bent over backwards to not repeat myself a couple of times in unnatural ways and regretted the end product.

I always err on the side of DRY, in the rare case repeating myself when I think that the benefits in readability are worth the risks of someone forgetting to fix a bug in multiple places.

Taking that advice into account, it sounds like in your case

repeat the same process a few times with a few minor tweaks

I would definitely work hard to not repeat myself in your case. Assuming minimal "tweaks" -- they can be handled with different parameters that impact the behavior or perhaps dependancy-injected to perform different subtasks.

Why be DRY when it looks like a quick cut+paste is going to be so much less work?

Famous last words. You will regret thinking that when a junior engineer tweaks/fixes/refactors one doStuff and doesn't even realize the others exists. Hilarity ensues. No mostly heartburn ensues. Every line of code costs more. How many code paths must you test with so many repeated functions? If one function, you just have to test one main path with a few behavioral modifications. If copy-pasted you have to test every doStuff separately. Odds are you'll miss one and a customer may have an unwelcome bug and you may have some unwelcome emails in your inbox.

Title: Why is DRY important?

Body:
Quite simple, why would I want to write code that works for all cases and scalable data when all I need to do is repeat the same process a few times with a few minor tweaks?

I'm unlikely to need to edit this again any time soon.

It looks like a lot of less work to just go...

```<code>function doStuff1(){/*.a.*/}
function doStuff2(){/*.b.*/}
function doStuff3(){/*.c.*/}
</code>```

And if I ever need to add something...

```<code>function doStuff4(){/*.d.*/}
</code>```

And if I need to remove it, I remove it.

It's harder to figure out how to make all of those into one straight-forward pattern that I can just feed data into and deal with all the cases, and make a bunch of changes I don't feel like I'm ever going to have to do.

Why be DRY when it looks like a quick cut+paste is going to be so much less work?


答:
I'm unlikely to need to edit this again any time soon.

If this is really truely the case, then you might be able to get away with it, but more often than not you're going to be working on code that needs to be maintained. That means extending functionality, fixing bugs and other improvements. If you have small variations of the same code in 10 different places, and one day you come back to that code and need to make a change, you now have the error prone task of making the same change in 10 different places (Sorry, there were 11 places, you forgot one and now you have a bug).

If you can generalize what problem you're trying to solve you can make your code easier to extend and fix if bugs pop up.

Title: Why is DRY important?


答:
Because, applied to your example:

+ readability

Less code often translates to less noise. (not always...)

+ flexibility

If you ever had to change the behavior of the doStuffX, you'll want to kill yourself or whoever wrote it,

+ extensibility

If you had extracted the distinct parts to a data-structure of your choice and then just iterated over it by calling a generic doStuff, you could just as well add one line in your data structure where you want a new entry, or remove one, and changing the behavior will just mean editing doStuff. Easier to maintain.

+ cost efficiency

less code here means:

=> less development => reduced cost

=> less probability for bugs => less support time => reduced cost

+ (possible) managed optimization

Depending on the language, the compiler/interpreter might have a bigger chance of determining that generic doStuff does always the nearly identical things often one call after another, and could inline it or attempt to optimize it. Probably wouldn't for X variations of doStuffX.

+ testing and quality

Testing is easier: doStuff needs testing, and that's it. Well, not exactly, but that covers already more. Only its IO expectations vary and need to be tested under different conditions, but it's still a lot easier to test and more maintainable than all the variations of doStuffX.

Overall this accounts for more maintainable code and an improved development efficiency for your team, and it is one of many good practices to help you produce more robust and dependable software.

Title: Why is DRY important?


答:
Rails has, built-in, the concept of Single-Table Inheritance. Read up on it and use it, it's perfect for this situation.

In essence, what it does is allow you to have a type field in your table which literally defines the type (class name) of the object defined in the row. Fields that don't have matching attributes on objects of a particular type are nulled and ignored. In other words: it does everything that Emmad suggests for you.

It is such a fundamental part of the framework that if you have a field named Type, which isn't implementing STI, then you need to add some code to make sure the framework knows that.

One word of warning though: there is a danger with this technique of ending up with a table with dozens of fields which are only used by a few records. If this starts to happen, consider taking some of those fields out into separate tables. That is, you can still have a single main table, but if Spices have 20 fields not used by other types, you can store that in another table with a 1-to-1 relationship to the Spice object.


答:
Follow this simple algorithm:

Is it backed up in an SCM? If yes, jump to 3.

Set up an SCM.

Throw the stuff away.

All your points in favor of removal are valid.

All your points in favor of keeping the clutter are invalid once you have an SCM to look it up or restore it. Actually, your SCM should be able to help you determine why that code is here and unused, if it was used properly.

It's called "dead code" for a reason. Let it die and rest in peace.

Title: Should I remove unreferenced code?


答:
Since everyone else has done a great job at explaining the maintainability issues with duplicate code, I'll just say this:

Much of programming requires you to think about the future, not just the immediate present.  You're right that copy & paste is easier now, but the statement, I'm unlikely to need to edit this again any time soon" shows you're not thinking correctly.  Yes, you might buy yourself a bit of time with a quick and dirty copy/paste, but in doing so you're showing that you can't look beyond your immediate problem and think about tomorrow.  Are you positive you'll never need to revisit this code?  Do you know for certain there are no bugs in it?  Can you 100% guarantee you won't need to revisit it when your next set of features need to be implemented?  Those are issues for tomorrow, and need to be considered when you're designing today.

Of course, there are times when copy/paste will be necessary.  As a UI developer, I've found there are times when I have to violate the DRY principle.  It sucks, I cringe every time it happens, and thankfully, it's rare.  But it does happen.

The difference is that when violating DRY, you should have a very compelling reason to do so, and the statement, It's harder to figure out how to make all of those into one straight-forward pattern isn't really one of them.  Unless you are under a massive time crunch and have your boss screaming to get something in the next few hours or you'll lose your job, I don't think this is a valid rationale.

Don't take this the wrong way: I'm not trying to castigate or chastise you, but rather try and get you to see where your mentality is wrong.  Programmers invest in future laziness; DRY is a way of achieving that.  The work you do today solving a difficult design problem will payoff tomorrow.

Title: Why is DRY important?


答:
Show your work.

The point of a resume is to convey what you've done in the past and what you will be able to do for your prospective employer.

List the startups that you've worked on just like you'd list any other job.

Explain the products developed in each case and how you contributed to them.

Talk about your responsibilities at each company, especially if they're relevant to the job that you're applying for.

Include the experience that you gained and skills that you used in each case.

The cover letter that you include with your resume is a good place to add relevant details about your experiences that don't easily fit into a resume.


答:
I'm assuming you have built the requisite mathematical foundation. In any case, here's a good, comprehensive guide from the basics to the advanced -

http://measuringmeasures.blogspot.com/2010/01/learning-about-statistical-learning.html

Edit: From your profile I see that you just started CS in college, hence I would suggest that you build the base first and then move on to actual data mining.

Title: Data Mining Books


问:
Implementing technical paper algorithms in C++ or MATLAB
I am an Electrical Engineering undergrad. I've reading many technical papers about Signal and Image processing algorithms (reconstruction, segmentation, filtering, etc). Most of the algorithms shown in these papers are defined over continuous time and continuous frequency, and often give the solutions in terms of complicated equations. How would you implement a technical paper from scratch in C++ or MATLAB in order to replicate the results obtained in said paper?

More specifically, I was looking at the paper "A general cone-beam reconstruction algorithm" by Wang et al (IEEE Trans Med Imaging. 1993;12(3):486-96), and I was wondering, how do I even start implementing their algorithm?
Equation 10 gives you the formula of the reconstructed image at . How would you code that up? Would you have a for-loop going through each voxel and computing the corresponding formula? How would you code functions of functions in that formula? How would you evaluate functions at arbitrary points?

I've read the book "Digital Image Processing" by Gonzalez and Woods but I'm still at a loss. I have also read about the Numerical Recipes book series. Would that be the correct way?

What are your experiences programming algorithms from research papers? Any tips or suggestions?

答:
Signal processing algorithms defined in continuous time/space/frequency are typically implemented by sampling the signal on a discrete grid and converting integrals into sums (and derivatives into differences).  Spatial filters are implemented through convolution with a convolution kernel (i.e. weighted sum of neighbors).

There is a huge body of knowledge concerning filtering sampled time-domain signals; time-domain filters are implemented as either finite impulse response filters, where the current output sample is computed as a weighted sum of the previous N input samples; or infinite impulse response filters, where the current output is a weighted sum of the previous inputs and previous outputs.  Formally, the discrete time filters are described using the z-transform, which is the discrete-time analog to the Laplace transform.  The bilinear transform maps one to the other (c2d and d2c in Matlab).

How would you evaluate functions at arbitrary points?

When you need the value of a signal at a point that does not lie directly on your sampling grid, you interpolate its value from nearby points.  Interpolation can be as simple as choosing the nearest sample, computing a weighted average of the nearest samples, or fitting an arbitrarily complicated analytic function to the sampled data and evaluating this function at the needed coordinates.  Interpolating onto a uniform finer grid is upsampling.  If your original (continuous) signal does not contain details (i.e. frequencies) finer than half the sampling grid, then the continuous function can be perfectly reconstructed from the sampled version (the Nyquist-Shannon sampling theorem).  For an example of how you can interpolate in 2D, see bilinear interpolation.

In Matlab you can use interp1 or interp2 to interpolate 1D or regularly sampled 2D data (respectively), or griddata to interpolate from irregularly sampled 2D data.

Would you have a for-loop going through each voxel and computing the corresponding formula?

Yes, exactly.

Matlab saves you from having to do this via explicit for-loops because it is designed to operate on matrices and vectors (i.e. multidimensional arrays).  In Matlab this is called "vectorization".  Definite integrals can be approximated with sum, cumsum, trapz, cumtrapz, etc.

I've read the book "Digital Image Processing" by Gonzalez and Woods but I'm still at a loss. I have also read about the Numerical Recipes book series. Would that be the correct way?

Yes, Numerical Recipes would be a great start.  It is very practical and covers most of the numerical methods you'll end up needing.  (You will find that Matlab already implements everything you need, but  Numerical Recipes will provide excellent background.)

I have taken an "algorithms and data structures" class, but I don't see the relation between the material presented there and implementing scientific algorithms.

The material treated in "Algorithms and data structures" courses tends to concentrate on structures like lists, arrays, trees, and graphs containing integers or strings and operations like sorting and selecting: problems for which there is typically a single correct result.  When it comes to scientific algorithms, this is only half of the story.  The other half concerns methods to estimate real numbers and analytic functions.  You'll find this in a course on "Numerical Methods" (or "Numerical Analysis"; like this one - scroll down for the slides): how to estimate special functions, how to estimate integrals and derivatives, etc.  Here one of the main tasks is to estimate the accuracy of your result, and one common pattern is to iterate a routine that improves an estimate until it is sufficiently accurate.  (You might ask yourself how Matlab knows how to do something as simple as estimate a value of sin(x) for some x.)

As a simple example, here is a short script that computes a radon transform of an image in Matlab.  The radon transform takes projections of an image over a set of projection angles.  Instead of trying to compute the projection along an arbitrary angle, I instead rotate the entire image using imrotate, so that the projection take is always vertical.  Then we can take the projection simply using sum, since the sum of a matrix returns a vector containing the sum over each column.

You could write your own imrotate if you prefer, using interp2.

```<code>%%# Home-made Radon Tranform

%# load a density map (image).
A = phantom;

n_pixels = size(A, 1);  %# image width (assume square)

%# At what rotation angles do we want to take projections?
n_thetas = 101;
thetas = linspace(0, 180, n_thetas);

result = zeros(n_thetas, n_pixels);

%# Loop over angles
for ii=1:length(thetas)
    theta = thetas(ii);
    rotated_image = imrotate(A, theta, 'crop');
    result(ii, :) = sum(rotated_image);
end

%# display the result
imagesc(thetas, 1:n_pixels, result.');
xlabel('projection angle [degrees]');
</code>```

What was once an integral of the density along a ray is now a sum over a column of a discretely sampled image, which was in turn found by interpolating the original image over a transformed coordinate system.

OwnerDisplayName: Damian

Body:
Signal processing algorithms defined in continuous time/space/frequency are typically implemented by sampling the signal on a discrete grid and converting integrals into sums (and derivatives into differences).  Spatial filters are implemented through convolution with a convolution kernel (i.e. weighted sum of neighbors).

There is a huge body of knowledge concerning filtering sampled time-domain signals; time-domain filters are implemented as either finite impulse response filters, where the current output sample is computed as a weighted sum of the previous N input samples; or infinite impulse response filters, where the current output is a weighted sum of the previous inputs and previous outputs.  Formally, the discrete time filters are described using the z-transform, which is the discrete-time analog to the Laplace transform.  The bilinear transform maps one to the other (c2d and d2c in Matlab).

How would you evaluate functions at arbitrary points?

When you need the value of a signal at a point that does not lie directly on your sampling grid, you interpolate its value from nearby points.  Interpolation can be as simple as choosing the nearest sample, computing a weighted average of the nearest samples, or fitting an arbitrarily complicated analytic function to the sampled data and evaluating this function at the needed coordinates.  Interpolating onto a uniform finer grid is upsampling.  If your original (continuous) signal does not contain details (i.e. frequencies) finer than half the sampling grid, then the continuous function can be perfectly reconstructed from the sampled version (the Nyquist-Shannon sampling theorem).  For an example of how you can interpolate in 2D, see bilinear interpolation.

In Matlab you can use interp1 or interp2 to interpolate 1D or regularly sampled 2D data (respectively), or griddata to interpolate from irregularly sampled 2D data.

Would you have a for-loop going through each voxel and computing the corresponding formula?

Yes, exactly.

Matlab saves you from having to do this via explicit for-loops because it is designed to operate on matrices and vectors (i.e. multidimensional arrays).  In Matlab this is called "vectorization".  Definite integrals can be approximated with sum, cumsum, trapz, cumtrapz, etc.

I've read the book "Digital Image Processing" by Gonzalez and Woods but I'm still at a loss. I have also read about the Numerical Recipes book series. Would that be the correct way?

Yes, Numerical Recipes would be a great start.  It is very practical and covers most of the numerical methods you'll end up needing.  (You will find that Matlab already implements everything you need, but  Numerical Recipes will provide excellent background.)

I have taken an "algorithms and data structures" class, but I don't see the relation between the material presented there and implementing scientific algorithms.

The material treated in "Algorithms and data structures" courses tends to concentrate on structures like lists, arrays, trees, and graphs containing integers or strings and operations like sorting and selecting: problems for which there is typically a single correct result.  When it comes to scientific algorithms, this is only half of the story.  The other half concerns methods to estimate real numbers and analytic functions.  You'll find this in a course on "Numerical Methods" (or "Numerical Analysis"; like this one - scroll down for the slides): how to estimate special functions, how to estimate integrals and derivatives, etc.  Here one of the main tasks is to estimate the accuracy of your result, and one common pattern is to iterate a routine that improves an estimate until it is sufficiently accurate.  (You might ask yourself how Matlab knows how to do something as simple as estimate a value of sin(x) for some x.)

As a simple example, here is a short script that computes a radon transform of an image in Matlab.  The radon transform takes projections of an image over a set of projection angles.  Instead of trying to compute the projection along an arbitrary angle, I instead rotate the entire image using imrotate, so that the projection take is always vertical.  Then we can take the projection simply using sum, since the sum of a matrix returns a vector containing the sum over each column.

You could write your own imrotate if you prefer, using interp2.

%%# Home-made Radon Tranform

%# load a density map (image).
A = phantom;

n_pixels = size(A, 1);  %# image width (assume square)

%# At what rotation angles do we want to take projections?
n_thetas = 101;
thetas = linspace(0, 180, n_thetas);

result = zeros(n_thetas, n_pixels);

%# Loop over angles
for ii=1:length(thetas)
    theta = thetas(ii);
    rotated_image = imrotate(A, theta, 'crop');
    result(ii, :) = sum(rotated_image);
end

%# display the result
imagesc(thetas, 1:n_pixels, result.');
xlabel('projection angle [degrees]');

What was once an integral of the density along a ray is now a sum over a column of a discretely sampled image, which was in turn found by interpolating the original image over a transformed coordinate system.

OwnerDisplayName: nibot


问:
Best design for data entry UI
I am working on a software project that is intended to replace the data entry done in Excel spreadsheets. We have a grid control that displays the data but it is edited in a form with tabs for different sections (over 60 columns in the spreadsheet).

The users are complaining that it takes them longer with the tabbed form to enter the data that simply typing in a spreadsheet and moving to the next cell. So now I am wondering if there was an error in our UI design.

Are there any good books or other resources which describe the most efficient UI for data entry?

答:
This sounds as if they have to enter large amounts of data. In this case, having tabs and being forced to use the mouse several times for entering a single record may in fact be a bad idea.

Either change it back to a single table or, if this is possible, you could add keyboard shortcuts, that would allow your users to change between tabs as fast as they where able with the single table, like having ctrl-1, ctrl-2 and so on or maybe alt-tab or ctrl-tab. Have a look at FireFox with multiple tabs open, you can switch between them with ctrl-tab.

Title: Best design for data entry UI


问:
How frequently do you switch mode?
I tried VIM and liked it but something stopped from using it: I had to type ESC to often, very often, something like each 5 seconds, and it was highly uncomfortable, so I stopped using it as a primary text editor (now I use emacs, nice for programmer as I am).

After my sad experience with VIM, I could get why some much intensive users love vim. But now I suppose that maybe, after a bigger training, the frequency of mode switching could decrease dramatically.

So, to verify this hypothesis, I am asking to you, old vim users, how frequently do you switch the mode?

答:
to change the mode ,you can use ctrl-[ to replace the esc

It will  work better! stick with it and you will done!

Title: How frequently do you switch mode?


问:
Why do most programming languages not nest block comments?
A few do, but not any of the popular ones as far as I know. Is there something bad about nesting comments?

I plan to have block comments nest in the (small) language I'm working on, but I would like to know if this is a bad idea.

答: Since nobody else mentioned it, I'll list a few languages that do support nested comments:  Rexx, Modula-2, Modula-3, Oberon. Despite all the complaints here about difficulty and speed issues, none of those seem to have any huge problems.</p>

OwnerDisplayName: Vuntic


问:
Work Item type for refactoring duplicate methods (i.e. turning them into 1)
Given that you have two identical methods (signatures, body, input/output) that you wanted to refactor into just one, what type of Work Item from the MS Agile template would be most appropriate?  Task, Bug, Quality of Service, Risk?  Why?</p>

答:
I would create a user story called "Refactoring duplicate methods" and plan it in an iteration. Then besides only removing this duplicate, also take some time to check on other duplicate items.

If you are sure it is only this only task, then you could have a standing user story and bind a task to it. It is a good practice to have all work attached to a bug or user story.


答:
Just to clarify, as I don't find this in any of the other answers:

DRY is a principle of software development aimed at reducing
repetition of information of all kinds.

Every piece of knowledge must have a single, unambiguous,
authoritative representation within a system.

The DRY principle as mentioned by Andy Hunt and Dave Thomas isn't limited to preventing duplication of code. It also advocates code generation and any automation processes. Ironically, the results of code generation could even be duplicate code ...

The reason why has already been explained thoroughly in the other answers, but Falcon's comment sums it up well enough IMHO:

A single point of change is easier to maintain.

Title: Why is DRY important?


问:
Why is it unrealistic to expect all browsers to support the same standards?
Ideally, we would have different browsers supporting the same standards and same code producing the same result on all browsers.

That hasn't happened yet. What are the reasons why?

答:
Ideally, we would have different browsers supporting the same
  standards and same code producing the same result on all browsers.

That raises the question why we need different browsers. If all do basically the same thing then one browser will be enough for all. That would indeed be ideal. No more useless duplication of effort and no more browser-specific code. People finally could start building on a solid foundation.


问:
Scrum: how to handle backlog-items that are longer than one sprint
I'm starting with SCRUM and I have a problem understanding one thing. How does SCRUM handle backlog items that take longer than one sprint?</p>

答:
You don't have such items. If you have, then the backlog item isn't specific enough and hasn't been properly broken down into smaller items. Some people call them not backlog, but fatlog items and in Scrum they are considered a anti-pattern.

The cake analogy user story:
As a cake-eater, I want to eat cake in the afternoon. I can't eat a whole cake in one afternoon, so it needs to be sliced to fit the amount I can eat.


答:
You can remap ESC to whatever key combination you want :

I have the following code in my .vimrc :

```<code>" remap ESC to ii to avoid leaving home row to leave insert mode
" i to enter insert mode, ii to leave
inoremap ii <Esc>
vnoremap ii <Esc>
snoremap ii <Esc>
</code>```

When you are in Insert, Visual or Select mode you can use 'ii' instead of ESC.

As long as you are not editing a file with variables containing 'ii' it works fine.

If I remember correctly, when Vi was developed the ESC key was at the same place that the CAPS lock on current keyboards. It was much easier to reach. As a consequence some people are using CAPS lock to switch mode.

Title: How frequently do you switch mode?

Body:
I tried VIM and liked it but something stopped from using it: I had to type ESC to often, very often, something like each 5 seconds, and it was highly uncomfortable, so I stopped using it as a primary text editor (now I use emacs, nice for programmer as I am).

After my sad experience with VIM, I could get why some much intensive users love vim. But now I suppose that maybe, after a bigger training, the frequency of mode switching could decrease dramatically.

So, to verify this hypothesis, I am asking to you, old vim users, how frequently do you switch the mode?

Body:
You can remap ESC to whatever key combination you want :

I have the following code in my .vimrc :

" remap ESC to ii to avoid leaving home row to leave insert mode
" i to enter insert mode, ii to leave
inoremap ii <Esc>
vnoremap ii <Esc>
snoremap ii <Esc>

When you are in Insert, Visual or Select mode you can use 'ii' instead of ESC.

As long as you are not editing a file with variables containing 'ii' it works fine.

If I remember correctly, when Vi was developed the ESC key was at the same place that the CAPS lock on current keyboards. It was much easier to reach. As a consequence some people are using CAPS lock to switch mode.


答:
When Scrum was first "invented", the default sprint was normally 4 weeks.

According to what I have been told, the reason for this very long sprint size was simply because people at that time had a very hard time imagining that you could possibly accomplish anything in shorter sprints.

As teams got more confident with scrum, they learned how to better divide backlog items into smaller items of more manageable size, and the development teams got better at not overdoing the up-front design, but just doing enough.

Today, I believe most teams would consider 4 weeks to be very long sprint duration. I am of the impression that 2 weeks is quite normal. XP teams do only 1 week iterations, and they finish complete user stories in each iteration.

So you need to be better at dividing the backlog items into smaller items, that each give a small increment in business value to the final product. It is possible, that has been proven. (though I will not rule out that there could be very specialized domains where it would be difficult)

Title: Scrum: how to handle backlog-items that are longer than one sprint

Body: I'm starting with SCRUM and I have a problem understanding one thing. How does SCRUM handle backlog items that take longer than one sprint?</p>


问:
Is it possible for a one-man start-up to follow agile methods like Scrum?
For a small start-up with only one or two programmers, is it possible to implement agile methods like Scrum? If NO, what is the minimum team size required?

I guess Scrum needs few programmers to be onsite as well?

 Edited **
I think the Agile methods are meant for team collaboration and improve workflow so a single man may not benefit much.

答:
I think taking an entire process like Scrum is overkill. But that doesn't mean that you should adapt some of the practices.

In particular, story based planning would be a great thing to adapt. Because even if you are only one man, you would probably still do planning - and with relatively little work, it gives you a relatively good prediction of when each feature could be completed.


答:
Such items are either called Epic and must be divided into smaller user stories which are shorter then a single sprint and because of that can be planned, or Theme which will be divided into Epics and those into common stories. Epics and Themes share the main characteristic - high level of uncertainty = they cannot be properly estimated (estimate is usually very high and because of that they do not fit into a single sprint).

So it is good to start with such stories but you cannot plan them until the product owner breaks them into smaller specific stories. These stories are used only to make note of some bigger requested features (Epic) or whole feature sets (Theme). Breaking these stories will make the feature specific.

It also follows Iceberg structure of the product backlog.