答:
Every paradigm, (not just necessarily the one you cited) to be followed require some discipline, and thus -reducing the "freedom of speech"- result in an initial overhead (at least just because you have to learn it!).
In this sense every paradigm can become harmful when the cost of that overhead is not overcompensated by the advantage the paradigm is designed to keep with itself.

The true answer to the question, thus, requires a good capability to "foreseen" the future, like:

I am right now required to do A and B

What is the probability, in a near future I will required to do also A- and B+ (i.e. something that looks like A and B, but just a bit different)?

What is the probability in a more far future, that A+ will become A* or A*- ?

If that probability is relatively hight, it will be a good chance if -while thinking about A and B- I also think about their possible variants, thus to isolate the common parts so that I will be able to reuse them.

If that probability is very low (whatever variant around A is essentially nothing more than A itself), study how to decompose A further will most likely result in wasted time.

Just as an example, let me tell you this real story:

During my past life as a teacher, I discovered that -on the most of student's projects- practically all of them provide their own function to calculate the length of a C string.

After some investigation I discovered that, being a frequent problem, all the student come to the idea to use a function for that. After told them that there is a library function for that (strlen), many of them answered that since the problem was so simple and trivial, it was more effective to them write their own function (2 lines of code) than seeking the C library manual (it was 1984, forgot the WEB and google!) in strict alphabetic order to see if there was a ready function for that.

This is an example where also the paradigm "don't reinvent the wheel" can become harmful, without an effective wheel catalog!


问:
Understanding the bridge design pattern
I do not understand the "bridge" design pattern at all. I have gone through various web sites, but they haven't helped.

Can anybody help me in understanding this?

答:
While most design patterns have helpful names, I find the name "Bridge" to be non-intuitive in regards to what it does.

Conceptually, you push the implementation details used by a class hierarchy into another object, typically with its own hierarchy.  By doing so, you are removing a tight dependency on those implementation details and allowing the details of that implementation to change.

On a small scale, I liken this to the use of a strategy pattern in the way you can plug in a new behavior.  But instead of just wrapping an algorithm as is often seen in a strategy, the implementation object is usually more feature filled.  And when you apply the concept to an entire class hierarchy the larger pattern becomes a Bridge.  (Again, hate the name).

It is not a pattern that you will use every day, but I have found it helpful when managing a potential explosion of classes that can happen when you have an (apparent) need for multiple inheritance.

Here is a real-world example:

I have a RAD tool that lets you drop and configure controls on a design surface, so I have an object model like this:

```<code>Widget // base class with design surface plumbing
+ Top
+ Left
+ Width
+ Height
+ Name
+ SendToBack
+ BringToFront
+ OnPropertyEdit
+ OnSelect
+ Validate
+ ShowEditor
+ Paint
+ Etc

TextboxWidget : Widget // text box specific
+ Text
+ MaxLength
+ Font
+ ShowEditor // override base to show a property editor form specific to a Textbox
+ Paint // override to render a textbox onto the surface
+ Etc

ListWidget : Widget // list specific
+ Items
+ SelectedItem
+ ShowEditor // override base to show a property editor form specific to a List
+ Paint // override to render a list onto the surface
+ Etc
</code>```

And so on, with perhaps a dozen controls.

But then a new requirement is added to support multiple themes (look-n-feels).  Let's say we have the following themes:  Win32, WinCE, WinPPC, WinMo50, WinMo65.  Each theme would have different values or implementations for rendering-related operations  like DefaultFont, DefaultBackColor, BorderWidth, DrawFrame, DrawScrollThumb, etc.

I could create an object model like this:

```<code>Win32TextboxWidget : TextboxWidget

Win32ListWidget : ListWidget
</code>```

etc., for one control type

```<code>WinCETextboxWidget : TextboxWidget

WinCEListWidget : ListWidget
</code>```

etc., for each other control type (again)

You get the idea—you get a class explosion of the # of widgets times the # of themes.  This complicates the RAD designer by making it aware of each and every theme.  Plus, adding new themes forces the RAD designer to be modified.  Further, there is a lot of common implementation within a theme that it would be great to inherit, but the controls are already inheriting from a common base (Widget).

So instead what I did is create a separate object hierarchy that implements the theme.  Each widget would hold a reference to the object that implements the rendering operations.  In many texts, this class is suffixed with an Impl but I deviated from that naming convention.

So now my TextboxWidget looks like this:

```<code>TextboxWidget : Widget // text box specific
+ Text
+ MaxLength
+ Font
+ ShowEditor
+ Painter // reference to the implementation of the widget rendering operations
+ Etc
</code>```

And I can have my various painters inherit my theme-specific base, which I could not do before:

```<code>Win32WidgetPainter
+ DefaultFont
+ DefaultFontSize
+ DefaultColors
+ DrawFrame
+ Etc

Win32TextboxPainter : Win32WidgetPainter

Win32ListPainter : Win32WidgetPainter
</code>```

One of the nice things is that I can dynamically load the implementations at run-time, allowing me to add as many themes as I want without changing the core software.  In other words my "implementation can vary independent of the abstraction".

ContentLicense: CC BY-SA 3.0

Title: Understanding the bridge design pattern

Body:
While most design patterns have helpful names, I find the name "Bridge" to be non-intuitive in regards to what it does.

Conceptually, you push the implementation details used by a class hierarchy into another object, typically with its own hierarchy.  By doing so, you are removing a tight dependency on those implementation details and allowing the details of that implementation to change.

On a small scale, I liken this to the use of a strategy pattern in the way you can plug in a new behavior.  But instead of just wrapping an algorithm as is often seen in a strategy, the implementation object is usually more feature filled.  And when you apply the concept to an entire class hierarchy the larger pattern becomes a Bridge.  (Again, hate the name).

It is not a pattern that you will use every day, but I have found it helpful when managing a potential explosion of classes that can happen when you have an (apparent) need for multiple inheritance.

Here is a real-world example:

I have a RAD tool that lets you drop and configure controls on a design surface, so I have an object model like this:

Widget // base class with design surface plumbing
+ Top
+ Left
+ Width
+ Height
+ Name
+ SendToBack
+ BringToFront
+ OnPropertyEdit
+ OnSelect
+ Validate
+ ShowEditor
+ Paint
+ Etc

TextboxWidget : Widget // text box specific
+ Text
+ MaxLength
+ Font
+ ShowEditor // override base to show a property editor form specific to a Textbox
+ Paint // override to render a textbox onto the surface
+ Etc

ListWidget : Widget // list specific
+ Items
+ SelectedItem
+ ShowEditor // override base to show a property editor form specific to a List
+ Paint // override to render a list onto the surface
+ Etc

And so on, with perhaps a dozen controls.

But then a new requirement is added to support multiple themes (look-n-feels).  Let's say we have the following themes:  Win32, WinCE, WinPPC, WinMo50, WinMo65.  Each theme would have different values or implementations for rendering-related operations  like DefaultFont, DefaultBackColor, BorderWidth, DrawFrame, DrawScrollThumb, etc.

I could create an object model like this:

Win32TextboxWidget : TextboxWidget

Win32ListWidget : ListWidget

etc., for one control type

WinCETextboxWidget : TextboxWidget

WinCEListWidget : ListWidget

etc., for each other control type (again)

You get the idea—you get a class explosion of the # of widgets times the # of themes.  This complicates the RAD designer by making it aware of each and every theme.  Plus, adding new themes forces the RAD designer to be modified.  Further, there is a lot of common implementation within a theme that it would be great to inherit, but the controls are already inheriting from a common base (Widget).

So instead what I did is create a separate object hierarchy that implements the theme.  Each widget would hold a reference to the object that implements the rendering operations.  In many texts, this class is suffixed with an Impl but I deviated from that naming convention.

So now my TextboxWidget looks like this:

TextboxWidget : Widget // text box specific
+ Text
+ MaxLength
+ Font
+ ShowEditor
+ Painter // reference to the implementation of the widget rendering operations
+ Etc

And I can have my various painters inherit my theme-specific base, which I could not do before:

Win32WidgetPainter
+ DefaultFont
+ DefaultFontSize
+ DefaultColors
+ DrawFrame
+ Etc

Win32TextboxPainter : Win32WidgetPainter

Win32ListPainter : Win32WidgetPainter

One of the nice things is that I can dynamically load the implementations at run-time, allowing me to add as many themes as I want without changing the core software.  In other words my "implementation can vary independent of the abstraction".

OwnerDisplayName: tcarvin


问:
Is it good practice to catch a checked exception and throw a RuntimeException?
I read some code of a colleague and found that he often catches various exceptions and then always throws a 'RuntimeException' instead. I always thought this is very bad practice. Am I wrong?</p>

答: No, you are not wrong. His practice is extremely misguided. You should throw an exception that captures the issue that caused it. RunTimeException is broad and over reaching. It should be a NullPointerException, ArgumentException, etc. Whatever accurately describes what went wrong. This provides the ability to differentiate issues that you should handle and let the program survive versus errors that should be a "Do not pass go" scenario. What he is doing is only slightly better than "On Error Resume Next" unless there is something missing in the info provided in the question.</p>


问:
What's a good approach to adding debug code to your application when you want more info about what's going wrong?
When our application doesn't work the way we expect it to (e.g. throws exceptions etc.), I usually insert a lot of debug code at certain points in the application in order to get a better overview of what exactly is going on, what the values for certain objects are, to better trace where this error is triggered from. Then I send a new installer to the user(s) that are having the problem and if the problem is triggered again I look at the logs and see what they say.

But I don't want all this debug code to be in the production code, since this would create some really big debug files with information that is not always relevant.

The other problem is that our code base changes, and the next time, the same debug code might have to go in different parts of the application.

Questions

Is there a way to merge this debug code within the production code only when needed and have it appear at the correct points within the application?

Can it be done with a version control system like git so that all would be needed is a git merge?

P.S. The application I'm talking about now is .NET, written in C#.

答:
I would advise against having production versions with debugging built-in, and others without. Build your debugging into the production code and either:

choose a way of turning it on and off at start-up from the various suggestions above.

make it turn on on-demand.

You could perhaps do the latter by using property grids and reflection to inspect your objects at run time, activated by a secret hot-key.

If you're worried about spewing out large debug files, you could write it all to memory, and only output it to file or screen if you need to (e.g. at user's command, on Exception, or if a switch is on for that particular feature etc...)

A final throw in about debugging is that you can often save a lot of time by simply asserting whether conditions are true or false inside your methods and properties, instead of writing to a debug file which you'll have to physically read to determine what the condition was.


问:
For what types of applications is Python a bad choice?
I just started learning Python, and I'd like to get some more context on the language.

I realize that, in many cases, Python is a slow language relative to C or C++.  Thus, Python is probably not the best choice for applications that need to run as quickly as possible.

Outside of this, it seems like Python is a great general purpose language that is easy to read and write.  The available libraries give it a huge amount of functionality.  Outside of performance critical applications, where is it a bad choice to use Python (and why)?

答:
If the main focus is windows GUI development, then I'd recommend against CPython as there's a shortage of good form designers (compared to using .Net).

However, IronPython runs on .Net and you there are two IDEs with Form designers to choose from: Visual Studio and SharpDevelop. In fact the Python Tools for Visual Studio can be used for CPython as well as IronPython, which is pretty neat though I haven't tried it yet...


问:
Modern programming language with intuitive concurrent programming abstractions
I am interested in learning concurrent programming, focusing on the application/user level (not system programming). I am looking for a modern high level programming language that provides intuitive abstractions for writing concurrent applications. I want to focus on languages that increase productivity and hide the complexity of concurrent programming.

To give some examples, I don't consider a good option writing multithreaded code in C, C++, or Java because IMHO my productivity is reduced and their programming model is not intuitive. On the other hand, languages that increase productivity and offer more intuitive abstractions such as Python and the multiprocessing module, Erlang, Clojure, Scala, etc. would be good options.

What would you recommend based on your experience and why?

EDIT: Thanks everybody for your interesting answers. It's hard to make a conclusion without actually trying since there are many good candidates: Erlang, Clojure, Scala, Groovy, and perhaps Haskell. I voted the answer with the most convincing arguments, but I'll try all the good candidates before deciding which one to pick :)

答:
I would suggest Groovy/Java/GPars if you can be JVM based since it allows for actors, dataflow, communicating sequential processes (CSP), data parallelism, software transactional memory (STM), agents, ... The point here is that there are many high-level concurrency and parallelism models each of which has different "sweet spots".  You do not want to use a model that is not in harmony with the solution to a problem you are trying to construct.  Languages and frameworks with only one model coerce you into algorithm hacking.

Of course I might be seen as biased as I am contributor to Groovy and GPars.  On the other hand I do work with CSP and Python, cf. Python-CSP.

A further point is that the original question is about learning, not about writing a production system.  So the Groovy/Java/GPars combination is a good way of learning even if the eventual production work is done in C++ using something like Just::Thread Pro or TBB rather than being JVM based.

(Some perfectly reasonable URL links had to be removed because of some panic about spamming by the host site.)


答:
Google's GO language has some interesting tools for concurrency - that would be another fun thing to try.  See: http://golang.org/doc/effective_go.html#concurrency and read down a bit for examples.

Concurrent programming is a large topic and there is space only for some Go-specific highlights here.

Concurrent programming in many environments is made difficult by the subtleties required to implement correct access to shared variables. Go encourages a different approach in which shared values are passed around on channels and, in fact, never actively shared by separate threads of execution. Only one goroutine has access to the value at any given time. Data races cannot occur, by design. To encourage this way of thinking we have reduced it to a slogan:

Do not communicate by sharing memory; instead, share memory by communicating.

This approach can be taken too far. Reference counts may be best done by putting a mutex around an integer variable, for instance. But as a high-level approach, using channels to control access makes it easier to write clear, correct programs.

One way to think about this model is to consider a typical single-threaded program running on one CPU. It has no need for synchronization primitives. Now run another such instance; it too needs no synchronization. Now let those two communicate; if the communication is the synchronizer, there's still no need for other synchronization. Unix pipelines, for example, fit this model perfectly. Although Go's approach to concurrency originates in Hoare's Communicating Sequential Processes (CSP), it can also be seen as a type-safe generalization of Unix pipes...

Title: Modern programming language with intuitive concurrent programming abstractions

Body:
I am interested in learning concurrent programming, focusing on the application/user level (not system programming). I am looking for a modern high level programming language that provides intuitive abstractions for writing concurrent applications. I want to focus on languages that increase productivity and hide the complexity of concurrent programming.

To give some examples, I don't consider a good option writing multithreaded code in C, C++, or Java because IMHO my productivity is reduced and their programming model is not intuitive. On the other hand, languages that increase productivity and offer more intuitive abstractions such as Python and the multiprocessing module, Erlang, Clojure, Scala, etc. would be good options.

What would you recommend based on your experience and why?

EDIT: Thanks everybody for your interesting answers. It's hard to make a conclusion without actually trying since there are many good candidates: Erlang, Clojure, Scala, Groovy, and perhaps Haskell. I voted the answer with the most convincing arguments, but I'll try all the good candidates before deciding which one to pick :)


问:
When does the "Do One Thing" paradigm become harmful?
For the sake of argument here's a sample function that prints contents of a given file line-by-line.

Version 1:

```<code>void printFile(const string & filePath) {
  fstream file(filePath, ios::in);
  string line;
  while (std::getline(file, line)) {
    cout << line << endl;
  }
}
</code>```

I know it is recommended that functions do one thing at one level of abstraction. To me, though code above does pretty much one thing and is fairly atomic.

Some books (such as Robert C. Martin's Clean Code) seem to suggest breaking the above code into separate functions.

Version 2:

```<code>void printFile(const string & filePath) {
  fstream file(filePath, ios::in);
  printLines(file);
}

void printLines(fstream & file) {
  string line;
  while (std::getline(file, line)) {
    printLine(line);
  }
}

void printLine(const string & line) {
  cout << line << endl;
}
</code>```

I understand what they want to achieve (open file / read lines / print line), but isn't it a bit of overkill?

The original version is simple and in some sense already does one thing - prints a file.

The second version will lead to a large number of really small functions which may be far less legible than the first version.

Wouldn't it be, in this case, better to have the code at one place?

At which point does the "Do One Thing" paradigm become harmful?

答:
Your example is fine to be used in a throw-away tool that is needed yesterday to do some specific task. Or as an administration tool that is directly controlled by an administrator. Now make it robust to be suitable for your customers.

Add proper error/exception handling with meaningful messages. Maybe you need parameter verification, including decisions that must be made, e.g. how to handle not existing files. Add logging functionality, maybe with different levels like info and debugging. Add comments so that your team colleagues know what's going on there. Add all the parts that are usually omitted for brevity and left as an exercise for the reader when giving code examples. Don't forget your unit tests.

Your nice and quite linear little function suddenly ends in a complex mess that begs to be splitted into separate functions.

OwnerDisplayName: Petr


答:
Of course, this just begs the question "What is one thing?" Is reading a line one thing and writing a line another one? Or is copying a line from one stream to the other to be considered one thing? Or copying a file?

There is no hard, objective answer to that. It's up to you. You can decide. You have to decide. The "do one thing" paradigm's main goal is probably to produce code that's as easy to understand as possible, so you can use that as a guideline. Unfortunately, this isn't objectively measurable either, so have to rely on your gut feeling and the "WTF?" count in code review.

IMO a function consisting of only a single line of code is rarely ever worth the trouble. Your printLine() has no advantage over using std::cout << line << '\n'1 directly. If I see printLine(), I have to either assume it does what its name says, or look it up and check. If I see std::cout << line << '\n', I know immediately what it does, because this is the canonical way of outputting the content of a string as a line to std::cout.

However, another important goal of the paradigm is to allow code reuse, and that's much more objective a measure. For example, in your 2nd version printLines() could easily be written so that it is an universally useful algorithm that copies lines from one stream to another:

```<code>void copyLines(std::istream& is, std::ostream& os)
{
  std::string line;
  while( std::getline(is, line) );
    os << line << '\n';
  }
}
</code>```

Such an algorithm could reused in other contexts as well.

You can then put everything specific to this one use case into a function which calls this generic algorithm:

```<code>void printFile(const std::string& filePath) {
  std::ifstream file(filePath.c_str());
  printLines(file, std::cout);
}
</code>```

1 Note that I used '\n' rather than std::endl. '\n' should be the default choice for outputting a newline, std::endl is the odd case.

Title: When does the "Do One Thing" paradigm become harmful?

Body:
For the sake of argument here's a sample function that prints contents of a given file line-by-line.

Version 1:

```<code>void printFile(const string & filePath) {
  fstream file(filePath, ios::in);
  string line;
  while (std::getline(file, line)) {
    cout << line << endl;
  }
}
</code>```

I know it is recommended that functions do one thing at one level of abstraction. To me, though code above does pretty much one thing and is fairly atomic.

Some books (such as Robert C. Martin's Clean Code) seem to suggest breaking the above code into separate functions.

Version 2:

```<code>void printFile(const string & filePath) {
  fstream file(filePath, ios::in);
  printLines(file);
}

void printLines(fstream & file) {
  string line;
  while (std::getline(file, line)) {
    printLine(line);
  }
}

void printLine(const string & line) {
  cout << line << endl;
}
</code>```

I understand what they want to achieve (open file / read lines / print line), but isn't it a bit of overkill?

The original version is simple and in some sense already does one thing - prints a file.

The second version will lead to a large number of really small functions which may be far less legible than the first version.

Wouldn't it be, in this case, better to have the code at one place?

At which point does the "Do One Thing" paradigm become harmful?

Body:
Of course, this just begs the question "What is one thing?" Is reading a line one thing and writing a line another one? Or is copying a line from one stream to the other to be considered one thing? Or copying a file?

There is no hard, objective answer to that. It's up to you. You can decide. You have to decide. The "do one thing" paradigm's main goal is probably to produce code that's as easy to understand as possible, so you can use that as a guideline. Unfortunately, this isn't objectively measurable either, so have to rely on your gut feeling and the "WTF?" count in code review.

IMO a function consisting of only a single line of code is rarely ever worth the trouble. Your printLine() has no advantage over using std::cout << line << '\n'1 directly. If I see printLine(), I have to either assume it does what its name says, or look it up and check. If I see std::cout << line << '\n', I know immediately what it does, because this is the canonical way of outputting the content of a string as a line to std::cout.

However, another important goal of the paradigm is to allow code reuse, and that's much more objective a measure. For example, in your 2nd version printLines() could easily be written so that it is an universally useful algorithm that copies lines from one stream to another:

void copyLines(std::istream& is, std::ostream& os)
{
  std::string line;
  while( std::getline(is, line) );
    os << line << '\n';
  }
}

Such an algorithm could reused in other contexts as well.

You can then put everything specific to this one use case into a function which calls this generic algorithm:

void printFile(const std::string& filePath) {
  std::ifstream file(filePath.c_str());
  printLines(file, std::cout);
}

1 Note that I used '\n' rather than std::endl. '\n' should be the default choice for outputting a newline, std::endl is the odd case.


问:
Would you use UML if it kept stakeholders from requesting changes frequently?
As much as programmers hate to document their code/system and draw UML (especially, Sequencing, Activity and State machine diagrams) or other diagramming notation, would you agree to do it if it kept managers from requesting a "minor change" every couple of weeks?

IOW, would you put together visual models to document the system if it helped you demonstrate to managers what the effect of changes are and why it takes so long to implement them?

(Edited to help programmers understand what type of answer I'm looking for.)

2nd edit: Restating my question again, "Would you be willing to use some diagramming notation, against your better nature as a programmer, if it helped you manage change requests?"

This question isn't asking if there might be something wrong with the process. It's a given that there's something wrong with the process. Would you be willing to do more work to improve it?

答:
Changing requirements is something that you need to deal with in the process, and the techniques from the agile methods help with that. As far as UML, or any other diagram or document produced, is concerned, the purpose is to document the system. There's very little relationship between managing change and the system documentation, aside from the fact that having accurate and useful documentation makes it easier to understand the system, analyze the change request, and come up with estimates on the work needed to be done.

Depending on your organizational structure, the business managers probably don't care about the design or implementation details of the system (and therefore don't care about having UML or any type of design documentation). They see feature requests and defect reports and assess the value added to the system by fixing these defects or adding those features, and prioritize based on the business objectives. The technical managers might be more interested in the system architecture, design, and some implementation details in as much as it affects utilization and assignments of engineers.

Typically, there should be some kind of change control process that involves team members responsible for business/project management, technical management, and quality assurance. It doesn't matter what they use for making decisions, but the business/project manager should be prioritizing requests based on value added/marketing needs, the technical manager should be pushing back on requests that are not feasible due to engineering constraints (current design, implementation, people are already assigned to higher priority tasks, lack of resources).

In such a scenario, having a formal, consistent design notation (such as UML) would assist the technical manager (and perhaps software quality engineers) understand the system and be able to present their argument and rationale for pushing back on the changes, but they wouldn't show the UML models to non-technical stakeholders. I would recommend using UML and other standardized modeling techniques to simplify and streamline communication between technical stakeholders and within the team, but showing UML to business and non-technical stakeholders is most likely futile.

ContentLicense: CC BY-SA 2.5


问:
Are there studies about the disadvantages of using issue tracking systems?
I don't like issue tracking systems because:

It takes too much time to describe issues in it. This discourage its usage.

You create a place to keep your bugs. And if there is a place for them, people usually don't care too much about fixing a bug cause they can put it there so that someday someone can fix it (or not).

With time, the bug lists gets so long that nobody can deal with it anymore, taking up a lot of our time.

I prefer handling issues using post-its on a white board, face-to-face conversations and killing important bugs as soon as they appear. I don't care too much to keep track of bug history because I don't think that it is worth the overhead.

Am I alone here? Are there studies (book/article/whatever) about the disadvantages (or great advantages) of using issue tracking systems?

答:
It takes too much time to describe issues in it. This discourage its usage.

If you can't even describe a bug how can you begin fix it?

You create a place to keep your bugs. And if there is a place for them, people usually don't care too much about fixing a bug cause they can put it there so that someday someone can fix it (or not).

That is a problem with your team not with the software.

With time, the bug lists gets so long that nobody can deal with it anymore, taking a lot of our time.

Again your describing a problem with your team.

The point of bug tracking software is not to help you motivate your team to fix bugs, it's to keep a record so you can trace the cause of bugs and stop them happening again. No software will ever be a replacment for good managment.


答:
IMO your starting point is biased. If the developers fail to fix the bugs, the project is doomed to fail, whether they track bugs using a proper bug tracking tool, post-its, stone carvings, or not at all. It's not the tool's fault if it is not used or misused. (That said, there are of course bad bug/issue trackers out there... I worked on a project using a totally inadequate tool for this job, so I think I know how bad it can be. But there are good ones too, which require minimal ceremony and overhead, allowing you to focus on the relevant information.)

If, however, the developers do care, and the project is larger than trivial in size, and there is more than a single developer on it, and there is some sort of management involved (all of which are pretty common in real-world projects), soon there will arise questions like:

Which of the open bugs should be fixed first? (note: in a sane project, this should be decided by the product owner and/or management, NOT by a developer - for which they must be aware of all open bugs first of all!)

How many open bugs we have, and of what severity?

Which of these must be fixed before we are ready to release?

How much time to plan for these fixes - often leading to: how much time it takes to fix a bug on average?

how many bugs have been reported by clients in the last release?

who did fix this-and-this bug, when, and what (code / configuration / data) changes did the fix involve?

what bug fixes are included in the release we are just about to publish?

...

Can you answer such questions [update] repeatably, reliably and efficiently [/update] based on your post-it notes?

Yes, entering bug data into an issue tracker entails some overhead. However, it is more than compensated by the time and effort saved in looking up, and creating reports like the above, from the stored bug data.

Title: Are there studies about the disadvantages of using issue tracking systems?

Body:
I don't like issue tracking systems because:

It takes too much time to describe issues in it. This discourage its usage.

You create a place to keep your bugs. And if there is a place for them, people usually don't care too much about fixing a bug cause they can put it there so that someday someone can fix it (or not).

With time, the bug lists gets so long that nobody can deal with it anymore, taking up a lot of our time.

I prefer handling issues using post-its on a white board, face-to-face conversations and killing important bugs as soon as they appear. I don't care too much to keep track of bug history because I don't think that it is worth the overhead.

Am I alone here? Are there studies (book/article/whatever) about the disadvantages (or great advantages) of using issue tracking systems?


答:
Your methodology may work for very small projects with a limited number of programmers. Once a project gets bigger, having a issue tracking system becomes much more important for coordination between different teams, particularly if fixes will be going out in different code releases. Complex projects will have many moving parts/components, and ensuring that problems are scheduled and fixed is a big part of a good issue tracking implementation

Some articles/studies that might interest you include this article discussing Zend's use of Jira and this French study discussing the use of bug tracking systems.


答:
I would like to get comments on this, but I find there are times when this isn't necessarily bad practice. (Or terribly bad). But maybe i am wrong.

Often times an API you are using will throw an exception that you can't imagine actually being thrown in your specific usecase. In this case, it seems perfectly fine to throw a RuntimeException with the caught exception as the cause.
If this exception is thrown, it'll likely be the cause of programming error and isn't inside the bounds for correct specification.

Assuming the RuntimeException isn't later caught and ignored, it's no where near an OnErrorResumeNext.

The OnErrorResumeNext would occur when someone catches an exception and simply ignores it or just prints it out. This is terribly bad practice in almost all cases.

Title: Is it good practice to catch a checked exception and throw a RuntimeException?

Body: I read some code of a colleague and found that he often catches various exceptions and then always throws a 'RuntimeException' instead. I always thought this is very bad practice. Am I wrong?</p>


答:
There may be studies, but even better are the hard earned experiences of people in the field. Most issue tracking systems suffer from the processes that drive their design. Issue trackers often need to support 2 distinct classes of users:

The development team

The users of the system

Cal Henderson (formerly of Flickr) has a great post on the design of many issue trackers and why he prefers the GitHub issue tracker (as do I). Also, Garrett Dimon covered the design of Sifter and illustrated a way to simplify the process for more effective issue tracking. I've adopted some of the ideas from both os these posts to help simplify my team's issue tracking workflow.

All that said, it still comes down to people over process and tools. My general thinking is that issue trackers tend to create this backlog that you have to manage. During triage, people are more likely to rationalize what is or is not a bug. In our process, we make decisions almost as soon as the bug is filed about whether or not it is an issue. Once that decision is made, the bug goes into Pivotal Tracker. The difference here is that we use Tracker for prioritization, not as a holding pen for things we don't want to do. In fact when the Icebox starts getting too big I actively delete items, including bugs. If an issue is big enough that it needs to be handled, it will come up again.

We rarely need bug history. Occasionally, someone may mention a symptom of a bug and we may do a search to see if it is related to some issue we already handled. But, that is rare.

TL;DR Focus on your process, pick simple tools and address issues as they come up.


问:
What is the difference between requirements and specifications?
I've been tasked with developing requirements and specifications for a project our group is starting.

I realized that I don't know the difference; a Google search just confused me more -- it seems some people say that specifications are requirements, but at a lower level.

答:
I am a systems engineer in the aerospace field, where both terms are used extensively. The distinction is clear and not as complex as the others are making it.

A specification is a document that specifies a system or product, e.g. a prime-item development specification for an F-14. There are lots of sections/content in a spec: requirements, definitions, reference documents, glossary, verification information, etc.

A requirement is a single statement of something the product or system must do. A  spec may have hundreds of requirements in it. Old school methodology says the requirement statement must use the word "shall", to separate requirements from statements of facts, or definitions. (Not sure if the new-fangled agile kids keep to all this or not; the fastidiousness has it's use but is a little fussy at times.)

So a spec is a document full of requirements, plus some other supporting and ancillary information.


问:
Which of these algorithms is best for my goal?
I have created a program that restricts the mouse to a certain region based on a black/white bitmap. The program is 100% functional as-is, but uses an inaccurate, albeit fast, algorithm for repositioning the mouse when it strays outside the area.

Currently, when the mouse moves outside the area, basically what happens is this:

A line is drawn between a pre-defined static point inside the region and the mouse's new position.

The point where that line intersects the edge of the allowed area is found.

The mouse is moved to that point.

This works, but only works perfectly for a perfect circle with the pre-defined point set in the exact center. Unfortunately, this will never be the case. The application will be used with a variety of rectangles and irregular, amorphous shapes. On such shapes, the point where the line drawn intersects the edge will usually not be the closest point on the shape to the mouse.

I need to create a new algorithm that finds the closest point to the mouse's new position on the edge of the allowed area. I have several ideas about this, but I am not sure of their validity, in that they may have far too much overhead.

While I am not asking for code, it might help to know that I am using Objective C / Cocoa, developing for OS X, as I feel the language being used might affect the efficiency of potential methods.

My ideas are:

Using a bit of trigonometry to project lines would work, but that would require some kind of intense algorithm to test every point on every line until it found the edge of the region... That seems too resource intensive since there could be something like 200 lines that would have each have to have as many as 200 pixels checked for black/white....

Using something like an A* pathing algorithm to find the shortest path to a black pixel; however, A* seems resource intensive, even though I could probably restrict it to only checking roughly in one direction. It also seems like it will take more time and effort than I have available to spend on this small portion of the much larger project I am working on, correct me if I am wrong and it would not be a significant amount of code (>100 lines or around there).

Mapping the border of the region before the application begins running the event tap loop. I think I could accomplish this by using my current line-based algorithm to find an edge point and then initiating an algorithm that checks all 8 pixels around that pixel, finds the next border pixel in one direction, and continues to do this until it comes back to the starting pixel. I could then store that data in an array to be used for the entire duration of the program, and have the mouse re-positioning method check the array for the closest pixel on the border to the mouse target position.

That last method would presumably execute it's initial border mapping fairly quickly. (It would only have to map between 2,000 and 8,000 pixels, which means 8,000 to 64,000 checked, and I could even permanently store the data to make launching faster.) However, I am uncertain as to how much overhead it would take to scan through that array for the shortest distance for every single mouse move event... I suppose there could be a shortcut to restrict the number of elements in the array that will be checked to a variable number starting with the intersecting point on the line (from my original algorithm), and raise/lower that number to experiment with the overhead/accuracy tradeoff.

Please let me know if I am over thinking this and there is an easier way that will work just fine, or which of these methods would be able to execute something like 30 times per second to keep mouse movement smooth, or if you have a better/faster method.

I've posted relevant parts of my code below for reference, and included an example of what the area might look like. (I check for color value against a loaded bitmap that is black/white.)

```<code>//
// This part of my code runs every single time the mouse moves.
//

CGPoint point = CGEventGetLocation(event);

float tX = point.x;
float tY = point.y;

if( is_in_area(tX,tY, mouse_mask)){

    // target is inside O.K. area, do nothing
}else{

CGPoint target;

//point inside restricted region:
float iX = 600; // inside x
float iY = 500; // inside y

// delta to midpoint between iX,iY and tX,tY
float dX;
float dY;

float accuracy = .5; //accuracy to loop until reached

do {
    dX = (tX-iX)/2;
    dY = (tY-iY)/2;

    if(is_in_area((tX-dX),(tY-dY),mouse_mask)){

        iX += dX;
        iY += dY;
    } else {

        tX -= dX;
        tY -= dY;
    }

} while (abs(dX)>accuracy || abs(dY)>accuracy);

    target = CGPointMake(roundf(tX), roundf(tY));
    CGDisplayMoveCursorToPoint(CGMainDisplayID(),target);

}
</code>```

Here is "is_in_area(int x, int y)" :

```<code>bool
is_in_area(NSInteger x, NSInteger y, NSBitmapImageRep *mouse_mask){

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSUInteger pixel[4];
    [mouse_mask getPixel:pixel atX:x y:y];

    if(pixel[0]!= 0){
        [pool release];
        return false;
    }
    [pool release];
    return true;
}
</code>```

答: I have another idea. You could use a variant of your third approach. Map the border of the shape and use all this points to calculate the balance point of the figure. Once you have the balance point you can easily use it to create a line between the balance point and the mouse point to create a line. From this line you calculate the intersection with the shape.</p>


问:
Stuff every programmer needs while working
I've been tasked with creating a fun and relaxing environment, one thing I know that I want is ergonomic mice and keyboards, others have suggested exercise balls and bands.

What is it that every programmer needs while working? What might not be necessary but would be nice to have anyway?

Note: this question was asked previously, but has been recommended to be posted here. See this link for the previous responses: https://stackoverflow.com/questions/3911911/stuff-every-programmer-needs-while-working-closed

答: Color laser printer (can be shared, but should be no more than 20' or so from one's desk).


答:
Requirements are what the application DOES

Specifcations are HOW the application does what it does.

They must be orthogonal !

Product managers write the requirements, head engineers write the specs.

Title: What is the difference between requirements and specifications?

Body:
I've been tasked with developing requirements and specifications for a project our group is starting.

I realized that I don't know the difference; a Google search just confused me more -- it seems some people say that specifications are requirements, but at a lower level.


问:
What naming convention for C# file that contains multiple classes?
In C# projects, we frequently group small and tightly related classes into the same .cs file. This practice reduces the friction of dealing with a myriad of files containing close to no actual code. Yet, is there an established practice to name the file that contains multiple classes?

答:
My advice: avoid files containing multiple classes and name files==classes even if you mean there are too many files. Try to organize them in folders.
In very special cases you might have nested classes. In this case it makes sense separating the main class and a nested class into different files having one partial class. In this case I use following naming convention.

```<code>MyEnumerable.cs
MyEnumerable.MyEnumerator.cs
</code>```

Probably you can also use multipart file names in your case.

OwnerDisplayName: Joannes Vermorel

Body:
My advice: avoid files containing multiple classes and name files==classes even if you mean there are too many files. Try to organize them in folders.
In very special cases you might have nested classes. In this case it makes sense separating the main class and a nested class into different files having one partial class. In this case I use following naming convention.

MyEnumerable.cs
MyEnumerable.MyEnumerator.cs

Probably you can also use multipart file names in your case.

OwnerDisplayName: achitaka-san


答:
Try to avoid having more than one class in a file, not more than one public class atleast. While naming class files with multiple classes, choose a descriptive filename.

Refrences:

http://weblogs.asp.net/lhunt/pages/CSharp-Coding-Standards-document.aspx. (2.2 Name Usage & Syntax)

Link (2.8 File Organization)

Title: What naming convention for C# file that contains multiple classes?

Body: In C# projects, we frequently group small and tightly related classes into the same .cs file. This practice reduces the friction of dealing with a myriad of files containing close to no actual code. Yet, is there an established practice to name the file that contains multiple classes?

OwnerDisplayName: giftcv

ContentLicense: CC BY-SA 4.0


问:
Is COBOL still worth learning?
Does learning COBOL still make sense?</p>

答:
I just did a search for "cobol" on Australia's largest job website. It returned 87 results, and (from a quick skim) they mostly seem to be legacy maintenance positions in banks and financial institutions. Mostly distinctly better paid than more "modern" language based jobs - presumably due to the rarity of Cobol experience.

So yeah, it seems like Cobol would be worth learning if you 1) don't mind doing legacy maintenance and 2) you want to get into a niche which is well paid and probably not very competitive since it's something few people are learning anymore.

(I'm assuming the Cobol market would be similar in most First World economies, but could be wrong?)

Title: Is COBOL still worth learning?


答:
I used to be all for having multiple classes in one file, but ever since I started actually working as a programmer (rather than being on my own), I have found that it can be a maintenance nightmare with many classes in a single file. Although, admittedly, Visual Studio can help a lot by using F12 (go to definition).

What I have started doing is using a naming convention as follows: namespace.classname.cs That way I know exactly what is in each file and it also provides some sort of overall context of the file. If the class is going to be in the default namespace, then I go ahead and just use the classname.cs (similar to Java).


问:
what is the object oriented counterpart to haskell / coq
I have detailed information on the latest developments in functional programming.

I think haskell is quite an advanced and high level programming language. With coq and agda this gets even more complex and advanced.

With "advanced" and "high level" I mean many distinct features, that can only be found in the respective languages.

Like for haskell

everything is pure and lazy per default

support for advanced concepts like GADTs, Monads, Functors, etc.

For coq / agda

a dependent type system

And both haskell and coq are used in academics, a good sign that they are 'state-of-the art'.

However I have no clue what comparable developments in object oriented programming are.

What are some of the latest developments in object oriented programming?

What would be a state-of-the-art OOP language counterpart to haskell / coq?

(I even search for advanced programming language on google, but I found mostly haskell related information. The only language I could think of is D 2.0. Scala is for me mainly a java compatible version of haskell.)

答:
I find it funny most people are answering you back with programming languages :-) In the world of OO, most advances in the "state-of-the-art" are published at OOPSLA and ECOOP conferences.

You have to understand that in terms of "formal proof" (as with Coq/Adga/etc...), there are fundamental problems yet to be solved in the OO formulation of programs. Subtyping (which SK-logic mentioned), overriding, etc, they are all far from being "tractable" in terms of providing suitable structures than can then be manipulated and reasoned upon. Even so, you can find projects such as ESC-Java or Spec# that are paving the road for that type of research.

In terms of "what's new" in this areas, there are several "trends" that you may find:

DSL's and DSL construction

Model-Driven OO systems

Refactoring

Increasing the strength of type-systems (see Scala)

Incorporating functional aspects into OO (again, Scala and C#)

Tackling the parallelism problems

Meta-Programming and Reflection

...


问:
Getting from a user-story to code while using TDD (scrum)
I'm getting into scrum and TDD and I think I have some confusion which I'd like to get your feedback about. Let's assume I have a user-story in my backlog, in order for me to start developing it as part of TDD I need to have requirements, right so far?

Is it true to say that the product manager and the QA should be responsible for taking the user-story and breaking it down to acceptance tests?

I think the above is true since the acceptance tests need to be formal, so they can be used as tests, but also human readable so that the product can approve they are the requirements, right?

Is it also true that I later take these acceptance tests and use them as my requirements, i.e. they are a set of use-cases which I implement (through TDD)? I hope I'm not making too much of a mess but that's the current flow I have in mind right now.

Update

I think my initial intentions were unclear so I'll try to rephrase. I want to know more details about the scrum flow of turning a user-story into code while using TDD.

The starting point is obvious, a user surfaces a need (or the user's representative as the product) which is a short 1-2 lines description in the known format and that is added to the product backlog.

When there is a spring planning meeting user-stories are taken from the backlog and assigned to developers.

In order for a developer to write code they need requirements (especially in TDD since the requirements are what the tests are derived from).

When, by whom and to which format are the requirements compiled?

What I had in mind was that the product and QA define the requirements via acceptance tests (I'm thinking of automatic using FitNesse or the sort but that's not the core I think) which help to serve 2 purposes at the same time:

They define "Done" properly.

They give a developer something to derive tests from.

I wasn't sure when these were written (before the sprint they're picked then that might be a waste since additional information will arrive or the story won't be picked, during the iteration then the developer might get stuck waiting for them...)

答:
Is it true to say that the product manager and the QA should be responsible for taking the user-story and breaking it down to acceptance tests?

Mostly.  They may not actually write the actual acceptance test.  They may approve something you wrote.  But they approve the acceptance tests.  Yes.

the acceptance tests need to be formal, so they can be used as tests, but also human readable so that the product can approve they are the requirements, right?

Irrelevant.  They may be formalized as automated tests.  Or they may be informal and it may be your job to create automated tests from the informal acceptance test criteria.

Also.  The "requirements" are the user story.  There's no real need to create yet another version of the story called "requirements."  Some folks to like to elaborate on the story before they code.  You can call this requirements, but "design" is a better word.  "Elaboration" is the best word.

Is it also true that I later take these acceptance tests and use them as my requirements, i.e. they are a set of use-cases which I implement (through TDD)?

Yes.  The story leads to acceptance tests.  The story is required behavior (i.e., "requirements").  The story leads to tests which drive software design and development.

that's the current flow I have in mind right now.

There isn't really a lot of "flow" to this.

Story -> acceptance tests.

Story -> elaboration ("design", "requirements") -> unit tests -> code.

Story -> User being able to do something of value.

Story -> Story points -> velocity calculation.

Note the pattern.  The story largely drives everything.

When, by whom and to which format are the requirements compiled?

First.  Define "requirements". How are the different from the story itself?

What I had in mind was that the product and QA define the requirements via acceptance tests

Not usually.

during the iteration then the developer might get stuck waiting for them.

Incorrect.  The developer can (and often does) help write these.  That's the point of "development": elaborate the story to a well-defined "done".

Again.  When you have doubts or questions, you must actually read the Agile Manifesto.  The Manifesto is quite clear: developers must talk with product owners, users, QA, and everyone else who is a stakeholder.  The interaction is actually the most important thing that can happen.


答: From a personal perspective I would say that there are better things to learn first.  However, many large companies have very large investments in their COBOL code base which they'll probably never really be able to leave behind, creating an industry for COBOL programmers to maintain the code base as well as write new code.  The company I work for is a large financial company and our technology split for developers is roughly 30% COBOL, 40% Java and 30%C#.</p>

Title: Is COBOL still worth learning?

Body: Does learning COBOL still make sense?</p>


答:
Consider that by asking a question about how to name such files, you have already identified a code smell that is problematic for you, and this is a problem that will not go away easily.

Regardless of the reasoning, you'll find that it is difficult to choose sensible names when you have more than one class in a file, because even if the files are related in some way, there will always be the temptation to throw in something that doesn't quite fit the group name that you assign to a set of classes.

The short answer therefore is that there is no recognized or established standard for naming these sorts of files.  My suggestion would be to sit down with your team and look to the organization of your code, and apply a bit of a refactoring effort to tidy things up a bit.

However, to make things a little easier to begin with I'd ask if the additional classes are nested, or independent.  If independent, then these classes can be more easily split out into their own files, with each file named for the single class contained within.  If nested, then further decisions may need to be made about how such classes should be organised, however the nested classes may not need to be removed immediately, and the files would therefore be named for the outermost class.  As far as nesting is concerned, there are lots of arguments against, and a few reasonable ones for nesting under some circumstances, and my advice would be to ask if sensible namespacing and creating a more organized source code structure might be a better way to tackle the problem.

Realistically however, you will find that by the end of the lifetime of your project, you will have wished your files all had contained only a single class and a nice directory/namespace structure to go with it.

Cheers,


答:
I do not know enough context to know whether your colleague is doing something incorrectly or not, so I am going to argue about this in a general sense.

I do not think it is always an incorrect practice to turn checked exceptions into some flavor of runtime exception. Checked exceptions are often misused and abused by developers.

It is very easy to use checked exceptions when they are not meant to be used (unrecoverable conditions, or even control flow). Especially if a checked exception is used for conditions from which the caller cannot recover, I think it is justified to turn that exception to a runtime exception with a helpful message/state. Unfortunately in many cases when one is faced with an unrecoverable condition, they tend to have an empty catch block which is one of the worst things you can do. Debugging such an issue is one of the biggest pains a developer can encounter.

So if you think that you are dealing with a recoverable condition, it should be handled accordingly and the exception should not be turned into a runtime exception. If a checked exception is used for unrecoverable conditions, turning it into a runtime exception is justified.


答:
It depends.

This practice may be even wise. There are many situations (for example in web developement), where if some exception happens, you are unable to do anything (because you cannot for example repair inconsistent DB from your code :-), only developer can do it). In these situations, it is wise to wrap the thrown exception into a runtime exception a rethrow it. Than you can catch all these exceptions in some exception handling layer, log the error and display the user some nice localized error code + message.

On the other hand, if the exception is not runtime (is checked), the developer of the API indicates, that this exception is resolvable and should be repaired. If its possible, than you should definitely do it.

The other solution might be to rethrow this checked exception into the calling layer, but if you were unable to solve it, where the exception occured, you will be likely unable to solve it here also...


问:
Best free UML authoring tool
What free UML authoring tools do you use and why is it better than others?</p>

答: There's yuml which is pretty cool as it allows you to create UML diagrams online, with no tools and so easily embeddable in blogs, wikis, emails, etc.</p>

Title: Best free UML authoring tool


问:
Is Silverlight only for eye-candy, or does it have a use in business?
Granted that Silverlight may make eye-popping websites of great beauty, is there any justification for using it to make practical web applications that have serious business purposes?  I'd like to use it (to learn it) for a new assignment I have, which is to build a web-based application that keeps track of the data interfaces used in our organization, but I'm not sure how to justify it, even to myself.

Any thoughts on this?  If I can't justify it then I will have to build the app using the same old tired straight ASP.NET approach I've used (it seems) a hundred times already.

答:
I've been working on Silverlight recently, and have to say that I consider Silverlight to be only for business. (excluding Silverlight for Windows Phone, which is another kettle of fish)

I am aware of a locally based, national retailing company who have their online presence - comprising their online store to which they hope to drive a large portion of their business - completely written in Silverlight. They think it's great! It does look fairly good, and is better than a Flash site in my opinion, but they are missing the elephant in the room: the Silverlight install base is dismal. As more people upgrade to Windows 7 / Windows 8, and IE8 and above, then the install base will increase - but for the guy at home still running XP or Vista and IE7, why would you install some program just so you can view one website?

I think using Silverlight on your external website is a significant fail. It won't run on mobile devices, and won't run on a huge proportion of desktops and laptops. It's like advertising in a foreign language.

The opposite is true in business. Users don't pick and choose which browser they use - it's typically determined by the business. Everyone uses the same software. You can roll out Silverlight to the entire business. At the same time, business loves intranet (go figure) and adore Sharepoint and various other 'online collaboration tools'.

So where does Silverlight fit in? It's a no brainer. Silverlight provides a much better user experience (in terms of looking nice) than ASP.NET WebForms, and isquicker to develop with than ASP.NET MVC. Admittedly you can do amazing things with web technologies these days, but .NET has always been about balancing the end product with speed of development. Silverlight is WPF that can run in your browser. That has a huge business use.


问:
What is the best way for an experienced developer to work on a WordPress blog
I'm beginning to work on my first WordPress blog, however I've noticed most tutorials just have you do modifications (such as theme changes, installing plugins) on the production site. This worries me for a few reasons:

No backups

No version control

If you make a mistake, your production site is affected

Developing remotely is slower than local development, especially when tweaking css files.

I understand why WordPress works like this - it allows people with no development experience to manage their WordPress installation (or the one provided by their service provider). It also allows you to work on the WordPress installation without having ssh access to the server. However as I am confortable working with tools like git and ssh, and am using a virtual server for the blog, this isn't very important to me.

So I was wondering what techniques experienced developers use when working on a WordPress blog. For example:

Do you develop locally, then push the changes to the live site? How do you do this?

How do you manage database changes and backups?

What do you store under version control (if anything)?

If a plugin changes the database, do you somehow track the changes it does in version control, so you can rollback the changes done by the plugin if you need to?

Or maybe I'm just overcomplicating everything if working on the production site isn't as risky as I am thinking it would be. I would appreciate any answers either way.

答:
Great question. WordPress makes it hard to implement the best programming practices you describe- I've wrestled with this myself.

You can work through the manual SQL dump procedures as Murilo describes, but if you're looking for a much easier way then check out the Automatic WordPress Backup plugin. It requires an Amazon S3 account (easy and cheap) but makes it trivial to do backups, ports, and pushes from your local dev machine to your prod server. In essence it's a backup and restore plugin, and it takes care of the database and files in one step.

This is how I work:

I do all my work on a MAMP setup on my Mac, using git for my codebase.

When I'm ready to publish, I backup the local version to S3 using the plugin.

If it's a new site, I'll install a vanilla WordPress site on the prod server, and install the same plugin.

I do a restore on the production site, pointing to the backup of the local version.

For future updates, just repeat steps 2 and 4.

So far it's been foolproof. I've used this process for many sites without a single fail. And the plugin does an automatic backup before every restore, just in case.


问:
When defining Product Backlog items, is it s a bad idea to describe what will be part of the user experience?
First, I am using the TFS 2010 SCRUM template.

I am wondering if this is a bad idea...

I started defining a PBI for User Interface Elements. Basically, this will hold all the tasks that developers will be assigned when developing UI elements for a web application. Since this has to do with user interaction and usability I was thinking it may be OK, however my struggle is that it also can be considered functionality and may not fit as a PBI.

答:
In Scrum, User Stories or PBIs as they are called in this template (and some others) are supposed to be vertical slices of functionality. This means that they describe features or other tangible benefits that the system provides. An example for some such benefit would be something like In order to reduce the amount of spam sent from my system, as a service administrator, I want to limit access to the send mail to registered users only.

This describes a change in the system that is end to end. It will include all of the associated tasks: adding UI for signing in, adding a single-sign-on service, modifying the DB schema to support the feature, etc. When all of the tasks are completed, the user will have a complete new feature added to the app.

What you described is actually a horizontal slice of functionality. If all the (UI) tasks are completed, and the PBI is done, the user hasn't gained anything. There is no value to the user / customer.

Therefore you should try to think in "vertical" slices - functionality, rather than "horizontal" slices which are technical layers.

Hope this helps,

Assaf

OwnerDisplayName: DDiVita

OwnerDisplayName: Assaf Stone


答: Assaf, I think defining the user experience is an essential part of defining a PBI. Without it, you are encouraging developers to ignore the user experience which will inevitably create results that are of poor performance and unintuitive in nature.</p>

Title: When defining Product Backlog items, is it s a bad idea to describe what will be part of the user experience?

Body:
First, I am using the TFS 2010 SCRUM template.

I am wondering if this is a bad idea...

I started defining a PBI for User Interface Elements. Basically, this will hold all the tasks that developers will be assigned when developing UI elements for a web application. Since this has to do with user interaction and usability I was thinking it may be OK, however my struggle is that it also can be considered functionality and may not fit as a PBI.

OwnerDisplayName: Hamid Shojaee


问:
Why can we delete some built-in properties of global object?
I'm reading es5 these days and find that [[configurable]] attribute in some built-in properties of global object is set to true which means we can delete these properties.

For example:

the join method of Array.prototype object have attributes

```<code>{[[Writable]]:true, [[Enumerable]]: false, [[Configurable]]: true}
</code>```

So we can easily delete the join method for Array like:

```<code>delete Array.prototype.join;
alert([1,2,3].join);
</code>```

The alert will display undefined in my chromium 17,firefox 9 ,ie 10,even ie6;

In Chrome 15 & safari 5.1.1 the [[configurable]] attribute is set to true and delete result is also true but the final result is still function(){[native code]}. Seems like this is a bug and chromium fix it.

I haven't notice that before. In my opinion, delete built-in functions in user's code is dangerous, and will bring out so many bugs when working with others.So why ECMAScript make this decision?

答: I would tend to agree with you, but on the other hand I just found a situation where I needed to delete JSON.stringify in certain circumstances because of a bug in Firefox 3.5. I certainly was glad of the ability to monkey-patch builtins there.

OwnerDisplayName: demix


问:
I'm graduating with a Computer Science degree but I don't feel like I know how to program
I'm graduating with a Computer Science degree but I see websites like Stack Overflow and search engines like Google and don't know where I'd even begin to write something like that. During one summer I did have the opportunity to work as a iPhone developer, but I felt like I was mostly gluing together libraries that other people had written with little understanding of the mechanics happening beneath the hood.

I'm trying to improve my knowledge by studying algorithms, but it is a long and painful process. I find algorithms difficult and at the rate I am learning a decade will have passed before I will master the material in the book. Given my current situation, I've spent a month looking for work but my skills (C, Python, Objective-C) are relatively shallow and are not so desirable in the local market, where C#, Java, and web development are much higher in demand. That is not to say that C and Python opportunities do not exist but they tend to demand 3+ years of experience I do not have. My GPA is OK (3.0) but it's not high enough to apply to the large companies like IBM or return for graduate studies.

Basically I'm graduating with a Computer Science degree but I don't feel like I've learned how to program. I thought that joining a company and programming full-time would give me a chance to develop my skills and learn from those more experienced than myself, but I'm struggling to find work and am starting to get really frustrated.

I am going to cast my net wider and look beyond the city I've grown up in, but what have other people in similar situation tried to do? I've worked hard but don't have the confidence to go out on my own and write my own app. (That is, become an indie developer in the iPhone app market.) If nothing turns up I will need to consider upgrading and learning more popular skills or try something marginally related like IT, but given all the effort I've put in that feels like copping out.

答: Remember that the science of computing is not the same as developing software and so for most comp-sci degrees I would expect there to be a large discrepancy between what you learn and what you apply (and how) in the real world.  But its not that important.  You'll learn what you need to on the job, and, if motivated, off the job.  One of the things I love most about programming is that I'll never run out of stuff to learn.</p>


问:
Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?
I asked this question on SO but was suggested to try here. So here it goes:

My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page dynamic.

But on reading the comparison between MongoDB and CouchDB I noticed that both are using Javascript. This makes me wonder the reason behind the choice of JavaScript over other conventional languages.

I guess I am trying to understand the role of JavaScript and its advantages over other languages.

Update: I am not asking about the languages / drivers supported by the two databases. The comparison says:

Both CouchDB and MongoDB make use of Javascript. CouchDB uses Javascript extensively including in the building of views.

MongoDB also supports running arbitrary javascript functions server-side and uses javascript for map/reduce operations.

My lack of understanding pertains to why is Javascript being used at all for the backend work. Why is it preferred for building views in CouchDB, or for using map/reduce operations? Why C/C++ or Java were not used? What are the advantages in using Javascript for such back-end work?

答:
Because JavaScript is a scripting language.

It's a flexible and dynamic language that's familiar to people.

The other reason JavaScript is used is because it aligns well with the JSON format that these databases use.

And finally these databases need a language that can be interpreted. Because the code for these queries is send over the network.

So you need an

dynamic

flexible

familiar

interpreted

language. I don't think JavaScript is a bad choice here. It's probably chosen for having C style syntax.

Now why JavaScript was chosen over another scripting language is a good question.


答:
Mobile code & Cross-platform

JavaScript is what called mobile code, the code is transported from the server (MongoDB and CouchDB in this case) to the client (the web browser) and executed on the client without an installation process.

JavaScript runtime environments (web browsers) are also widely available on many platforms. That makes JavaScript a good cross-platform language.

JavaScript is not used as primary back-end language

The MongoDB backend is implemented in C++ and the CouchDB is implemented in Erlang. So JavaScript is not used as the primary language for the backend for theses systems.

From mongodb.com:

Written in C++

From couchdb.apache.com:

CouchDB is written in Erlang, a robust functional programming language ideal for building concurrent distributed systems. Erlang allows for a flexible design that is easily scalable and readily extensible.

Title: Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?

Body:
I asked this question on SO but was suggested to try here. So here it goes:

My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page dynamic.

But on reading the comparison between MongoDB and CouchDB I noticed that both are using Javascript. This makes me wonder the reason behind the choice of JavaScript over other conventional languages.

I guess I am trying to understand the role of JavaScript and its advantages over other languages.

Update: I am not asking about the languages / drivers supported by the two databases. The comparison says:

Both CouchDB and MongoDB make use of Javascript. CouchDB uses Javascript extensively including in the building of views.

MongoDB also supports running arbitrary javascript functions server-side and uses javascript for map/reduce operations.

My lack of understanding pertains to why is Javascript being used at all for the backend work. Why is it preferred for building views in CouchDB, or for using map/reduce operations? Why C/C++ or Java were not used? What are the advantages in using Javascript for such back-end work?


问:
How can I move from Java and ColdFusion to Ruby on Rails?
Currently I work with ColdFusion 9+ and some Java in a Windows environment. Prior to ColdFusion, my background was in Java and JSP.

I'm considering a move towards Ruby on Rails, as I think it would be a real challenge, keep things fresh, and provide more job opportunities.

In order to get into it, I started to build my personal website in Rails 3.0. But what else can I do to make this transition from what I know now to Ruby and Rails? Are there specific or idiomatic aspects of Ruby or Rails I should keep in mind when switching over from a ColdFusion and Java mindset?

答:
I have actually made this exact transition (from Windows C++/C#/PHP/Perl) to Ubuntu/Rails.

I am not too sure about remuneration, because it depends on your geographic location. In Silicon Valley Rails is very popular, and developers get paid well. I suppose some areas have more demand for .NET(C#) or LAMP(w/PHP). It also depends if you want to work remotely.

It seems to me you might want to think about the future: the world is changing fast, and there are millions of people learning programming who will compete with you. Which technology has a brighter future? Which is likely to be in high demand with low supply of good coders? How can you create value for your employer that will not be outsourced to someone who works for 1/4 of your salary?

My experience is that Linux is not very popular with good Rails developers. If you watch http://railscasts.com, you'll see that they use Macs. I went to a few Rails meetups, and everyone seems to be working on Macs. Ubuntu is sort of the poor man's Rails Dev machine. It works fine, but costs 1/4th as much as a Mac.

By the way, I find editing the files on my PC (for now!) using Notepad++ and sharing the files from the Ubuntu machine works very well. You get all the benefits of working on your normal Dev machine and all the benefits of working in Ubuntu. I tried an IDE on Ubuntu, but it was slower than hell and didn't work for me. I love Visual Studio, but it's not really necessary if you do TDD.

I would suggest doing some freelance Rails projects. Working remotely is good because it is not obvious that you aren't really sure about what to do. Then you can gain real world experience and get better faster. And do all your development TDD, because you will improve and it will become a good habit.

Don't expect it to be quick and easy. I found Rails and particularly Unit::Test to be very difficult to learn. Much more difficult that C++, for example.

As far as areas to get up to speed with, TDD is the only one I can think of. You may want to learn the popular TDD tools, like RSpec, Cucumber and I think there is one very popular tool for stubs/mocks. (That would be a great Stack Overflow question.)

It also depends on your personality. Do you want to learn new (and exciting) tools and technologies? Or do you want to stick with what you know and become an expert? I'm not saying one is better than the other. But if you hate learning new things you would probably not be very happy as a Rails developer because it is changing so fast.

I don't think there are any real clear answers to this question. But it is a great question to ask (and most people don't even think of it -- +1 for Programmers.StackExchange). Hopefully this will help clarify your ideas and lead towards a solution.


答:
Configurable is not about deletion.

It's about the ability to replace a read only value.

It's a very powerful tool, and non-configurable values are frustrating if you cannot delete them.

I've had quite a few cases where I needed to fix an obscure bug or inject slightly different functionality (interception, logging). Doing that requires replacing the value.

Example:

```<code>Object.defineProperty(Object.prototype, "foo", {
  value: 42,
  configurable: true
});

var o = {};
o.foo = 50; // fails. foo is not writable
delete Object.prototype.foo;
o.foo = 50; // succeeds
/* optionally put Object.prototype.foo back */
</code>```

The whole idea is that if you can delete properties you have more meta programming control. If you couldn't delete them then you would just get annoyed at the language.

There's no good reason to make properties non deletable other then to annoy people.

Title: Why can we delete some built-in properties of global object?

Body:
I'm reading es5 these days and find that [[configurable]] attribute in some built-in properties of global object is set to true which means we can delete these properties.

For example:

the join method of Array.prototype object have attributes

```<code>{[[Writable]]:true, [[Enumerable]]: false, [[Configurable]]: true}
</code>```

So we can easily delete the join method for Array like:

```<code>delete Array.prototype.join;
alert([1,2,3].join);
</code>```

The alert will display undefined in my chromium 17,firefox 9 ,ie 10,even ie6;

In Chrome 15 & safari 5.1.1 the [[configurable]] attribute is set to true and delete result is also true but the final result is still function(){[native code]}. Seems like this is a bug and chromium fix it.

I haven't notice that before. In my opinion, delete built-in functions in user's code is dangerous, and will bring out so many bugs when working with others.So why ECMAScript make this decision?

Body:
Configurable is not about deletion.

It's about the ability to replace a read only value.

It's a very powerful tool, and non-configurable values are frustrating if you cannot delete them.

I've had quite a few cases where I needed to fix an obscure bug or inject slightly different functionality (interception, logging). Doing that requires replacing the value.

Example:

Object.defineProperty(Object.prototype, "foo", {
  value: 42,
  configurable: true
});

var o = {};
o.foo = 50; // fails. foo is not writable
delete Object.prototype.foo;
o.foo = 50; // succeeds
/* optionally put Object.prototype.foo back */

The whole idea is that if you can delete properties you have more meta programming control. If you couldn't delete them then you would just get annoyed at the language.

There's no good reason to make properties non deletable other then to annoy people.


问:
When does the "Do One Thing" paradigm become harmful?
For the sake of argument here's a sample function that prints contents of a given file line-by-line.

Version 1:

```<code>void printFile(const string & filePath) {
  fstream file(filePath, ios::in);
  string line;
  while (std::getline(file, line)) {
    cout << line << endl;
  }
}
</code>```

I know it is recommended that functions do one thing at one level of abstraction. To me, though code above does pretty much one thing and is fairly atomic.

Some books (such as Robert C. Martin's Clean Code) seem to suggest breaking the above code into separate functions.

Version 2:

```<code>void printFile(const string & filePath) {
  fstream file(filePath, ios::in);
  printLines(file);
}

void printLines(fstream & file) {
  string line;
  while (std::getline(file, line)) {
    printLine(line);
  }
}

void printLine(const string & line) {
  cout << line << endl;
}
</code>```

I understand what they want to achieve (open file / read lines / print line), but isn't it a bit of overkill?

The original version is simple and in some sense already does one thing - prints a file.

The second version will lead to a large number of really small functions which may be far less legible than the first version.

Wouldn't it be, in this case, better to have the code at one place?

At which point does the "Do One Thing" paradigm become harmful?

答:
Even in your simple case, you are missing details that the Single Responsibility Principle would help you manage better. For example, what happens when something goes wrong with opening the file. Adding in exception handling to harden against file access edge cases would add 7-10 lines of code to your function.

After you've opened the file, you're still not safe. It could be yanked from you (especially if it's a file on a network), you could run out of memory, again a number of edge cases can happen that you want to harden against and will bloat your monolithic function.

The one-liner, printline seems innocuous enough. But as new functionality gets added to the file printer (parsing and formatting text, rendering to different kinds of displays, etc.) it will grow and you'll thank yourself later.

The goal of SRP is to allow you to think about a single task at a time. It's like breaking a big block of text into multiple paragraphs so that the reader can comprehend the point you are trying to get across. It takes a little more time to write code that adheres to these principles. But in doing so we make it easier to read that code. Think of how happy your future self will be when he has to track down a bug in the code and finds it neatly partitioned.


问:
Would you use UML if it kept stakeholders from requesting changes frequently?
As much as programmers hate to document their code/system and draw UML (especially, Sequencing, Activity and State machine diagrams) or other diagramming notation, would you agree to do it if it kept managers from requesting a "minor change" every couple of weeks?

IOW, would you put together visual models to document the system if it helped you demonstrate to managers what the effect of changes are and why it takes so long to implement them?

(Edited to help programmers understand what type of answer I'm looking for.)

2nd edit: Restating my question again, "Would you be willing to use some diagramming notation, against your better nature as a programmer, if it helped you manage change requests?"

This question isn't asking if there might be something wrong with the process. It's a given that there's something wrong with the process. Would you be willing to do more work to improve it?

答:
Gernerally speaking if minor changes required updates to UML diagrams then I would consider the diagrams to be too detailed. I have found the best use of UML diagrams is to succinctly convey the design of a system. It's incredibly beenficial to be able to look at a class diagram or a deployment diagram and get a feel for the software compared to trawling through code or trying to suck the information out of other distracted devs.

I think the mistake a lot of people make - including me when I first started modelling - is to think that the model has to be of 100% complete. For example class diagrams can very quickly get unwieldy if they include every single class in a big project but often there are a lot of utility classes for logging, loading configuration settings etc. that don't really add a lot to the picture and can be ommitted.

However there are also cases where more detailed UML diagrams may be useful. In particular activity or state diagrams can help clarify how a particularly tricky piece of business logic is working. In those cases it is a very good idea to change the diagram for every small change as a way of keeping track of the business process.

UML and modelling are a balancing act. If the incorporating the changes your manager is making into the diagrams make them more useful then add them. If on the other hand it takes you longer to make the changes to the models than it does to write the code then perhaps your UML is too low level.


问:
Why is Conway's "Game of Life" used for code retreats?
Code Retreat is an all-day training event that focuses on the fundamentals of software development. There's a "global" code retreat day coming up, and I'm looking forward to it. That said, I've been to one before and have to say there was a huge amount of chaos... which is fine.

One thing that I still don't get is why the "Game of Life" is a good problem for TDD, and what good and bad TDD for it feels like.

Realize this is a pretty open ended question, so feel free to comment.

答:
Originally, Conway's Game of Life was chosen because we had a java applet on hand to work on at the very first coderetreat in January of 2009. The goal of the day was to experiment with some ideas around time-boxed practice, and we just chose the GoL applet because we had it.

After that, though, as a couple of active facilitators (notably me during my journeyman tour in 2009 and Alex Bolboaca in Bucharest) investigated the uses of GoL as a learning tool. At the same time we were evolving the coderetreat format to what it has become today. In 2009, Alex tried at least one other problem (poker hand scoring), but didn't find it as useful as GoL. You can find more about the history at http://coderetreat.org/history

Coderetreat focuses on improving our understanding of simple design (specifically the 4 rules of simple design), test-driven development and other fundamental aspects of software development. GoL has the benefit of being a very simple problem to understand while still being very rich from a structural perspective. It readily provides parts of the system that can be used as examples of all the topics we practice at coderetreat. For example, a common implementation that takes (x,y) parameters in multiple methods is a great opportunity to talk about the DRY principle (every piece of knowledge should have one and only one representation in your system) with regards to the topology of the system. There are a lot of other aspects which can be used as examples of building a design that minimizes the cost of change.

There are quite a few people now who have done multiple coderetreats, and they still find interesting aspects of the problem to use as practice.


答: The whole reason that there are books devoting chapters to the virtues of "do one thing" is that there are still developers out there that write functions that are 4 pages long and nest conditionals 6 levels. If your code is simple and clear you've done it right.</p>


问:
How much C/C++ knowledge is needed for Objective-C/iPhone development?
First, a little background. I'm a .Net developer (C#) and have over 5 years experience in both web development and desktop applications. I've been wanting to look into iPhone development for some time now, but for one reason or another always got side tracked. I finally have a potential project on the horizon, and I'm now going full steam ahead learning this stuff.

My question is this: I haven't done any C/C++ programming since my schooling days, I've been living in managed land ever since. How much knowledge if any is needed to be successful as an iOS developer? Obviously memory management is something that I'll have to be conscious about (although with iOS 5 there seems to be something called ARC which should make my life easier), but what else? I'm not just talking about the C API (for example, in order to get the sin of a number, I call the sin() function), that's what Google is for. I'm talking about fundamental C/C++ idioms that the average C# developer is unaware of.

答:
Don't worry about it. If you know enough C to be able to write function calls, understand and write arithmetic expressions, and deal with pointers, you'll probably be fine. You'll still need to learn Objective-C, of course, but much of the code that you'll write will be more Objective-C than plain old C. Getting used to Objective-C style and learning Cocoa Touch will consume much more of your time than brushing up on C.

I usually tell people who are starting from zero to learn C before jumping into Objective-C. I stand by that advice -- learning C will teach you basic knowledge that you need in order to work effectively in Objective-C. You need to know what a function is, how to use control structures like loops and conditional statements, how the various basic data types work, what a struct is and so on. And since all of C is fair game in Objective-C, the more C you know the better you'll be prepared to understand code you might run across. That said, many tasks are done differently in Objective-C, so standard C idioms aren't necessarily standard Objective-C idioms. NSString and NSArray take the place of C-style arrays. Pointers are ubiquitous, but they're used mainly to refer to objects -- pointer arithmetic doesn't come up very often. Instead of allocating memory directly, you create objects.

The same goes for C++... you won't need much C++ to get along fine in Objective-C. At some point in the future you might need to increase your C++ knowledge in order to integrate some existing C++ code into an app, and at that point you might need to spend some time learning, but don't let a lack of C++ knowledge stop you from trying your hand at iOS programming.


问:
How to document and teach others "optimized beyond recognition" computationally intensive code?
Occasionally there is the 1% of code that is computationally intensive enough that needs the heaviest kind of low-level optimization. Examples are video processing, image processing, and all kinds of signal processing, in general.

The goals are to document, and to teach the optimization techniques, so that the code does not become unmaintainable and prone to removal by newer developers. (*)

(*) Notwithstanding the possibility that the particular optimization is completely useless in some unforeseeable future CPUs, such that the code will be deleted anyway.

Considering that software offerings (commercial or open-source) retain their competitive advantage by having the fastest code and making use of the newest CPU architecture, software writers often need to tweak their code to make it run faster while getting the same output for a certain task, whlist tolerating a small amount of rounding errors.

Typically, a software writer can keep many versions of a function as a documentation of each optimization / algorithm rewrite that takes place. How does one make these versions available for others to study their optimization techniques?

Related:

Clean readable code vs fast hard to read code. When to cross the line?

答:
Specifically since you have take the example of Video and Image processing one can keep the code as part of the same version but active or inactive depending on the context.

While you haven't mentioned, i am assuming C here.

The simplest way in C code, one does optimization (and also applies when trying to make things portable) is to keep

```<code>
#ifdef OPTIMIZATION_XYZ_ENABLE
   // your optimzied code here...
#else
   // your basic code here...
</code>```

When you enable #define OPTIMIZATION_XYZ_ENABLE during compilation in Makefile, everything works accordingly.

Usually, cutting a few lines of code in the middle of functions could become messy when there are too many functions are optimized. Hence, in this case one defines different function pointers to perform a specific function.

the main code always executes through a function pointer like

```<code>
   codec->computed_idct(blocks);
</code>```

But the function pointers are defined depending on type of example (e.g. here idct function is optimized for different CPU architecture.

```<code>

if(OPTIMIZE_X86) {
  codec->computed_idct = compute_idct_x86;
}
else if(OPTIMZE_ARM) {
  codec->computed_idct = compute_idct_ARM;
}
else {
  codec->computed_idct = compute_idct_C;
}
</code>```

you should see libjpeg code and libmpeg2 code and may be ffmpeg for such techniques.

Body:
Specifically since you have take the example of Video and Image processing one can keep the code as part of the same version but active or inactive depending on the context.

While you haven't mentioned, i am assuming C here.

The simplest way in C code, one does optimization (and also applies when trying to make things portable) is to keep

#ifdef OPTIMIZATION_XYZ_ENABLE
   // your optimzied code here...
#else
   // your basic code here...

When you enable #define OPTIMIZATION_XYZ_ENABLE during compilation in Makefile, everything works accordingly.

Usually, cutting a few lines of code in the middle of functions could become messy when there are too many functions are optimized. Hence, in this case one defines different function pointers to perform a specific function.

the main code always executes through a function pointer like

   codec->computed_idct(blocks);

But the function pointers are defined depending on type of example (e.g. here idct function is optimized for different CPU architecture.

if(OPTIMIZE_X86) {
  codec->computed_idct = compute_idct_x86;
}
else if(OPTIMZE_ARM) {
  codec->computed_idct = compute_idct_ARM;
}
else {
  codec->computed_idct = compute_idct_C;
}

you should see libjpeg code and libmpeg2 code and may be ffmpeg for such techniques.


问:
Is it good practice to catch a checked exception and throw a RuntimeException?
I read some code of a colleague and found that he often catches various exceptions and then always throws a 'RuntimeException' instead. I always thought this is very bad practice. Am I wrong?</p>

答:
In my opinion,

In the framework level, we should be catch runtime exceptions to reduce more block of try catch to the invoker in the same place.

In the application level, we rarely capture runtime exceptions and i think this practice was bad.


答: It is the same way as with a drivers licence.  Mastery takes much much longer....</p>

Title: I'm graduating with a Computer Science degree but I don't feel like I know how to program

Body:
I'm graduating with a Computer Science degree but I see websites like Stack Overflow and search engines like Google and don't know where I'd even begin to write something like that. During one summer I did have the opportunity to work as a iPhone developer, but I felt like I was mostly gluing together libraries that other people had written with little understanding of the mechanics happening beneath the hood.

I'm trying to improve my knowledge by studying algorithms, but it is a long and painful process. I find algorithms difficult and at the rate I am learning a decade will have passed before I will master the material in the book. Given my current situation, I've spent a month looking for work but my skills (C, Python, Objective-C) are relatively shallow and are not so desirable in the local market, where C#, Java, and web development are much higher in demand. That is not to say that C and Python opportunities do not exist but they tend to demand 3+ years of experience I do not have. My GPA is OK (3.0) but it's not high enough to apply to the large companies like IBM or return for graduate studies.

Basically I'm graduating with a Computer Science degree but I don't feel like I've learned how to program. I thought that joining a company and programming full-time would give me a chance to develop my skills and learn from those more experienced than myself, but I'm struggling to find work and am starting to get really frustrated.

I am going to cast my net wider and look beyond the city I've grown up in, but what have other people in similar situation tried to do? I've worked hard but don't have the confidence to go out on my own and write my own app. (That is, become an indie developer in the iPhone app market.) If nothing turns up I will need to consider upgrading and learning more popular skills or try something marginally related like IT, but given all the effort I've put in that feels like copping out.