答:
Generally you want to get the connection via a method from a source such as a config file. Within 1 transaction, you may want to use 1 connection. and you may also want to make sure that after a connection error, a message is logged or displayed and no further processing takes place. Connection errors are frequent during development and deployment and you may want to make sure they are identified separately from other rare errors.

There are many ways to write a code that satisfies your requirement, here is one way:

```<code>    string sqlconnection=getCnString(); //getConnection obtains and formats cn string
    using (SqlConnection connection = new SqlConnection(sqlconnection)
    {
    try
    {
         connection.Open();
         //...do stuff with the open connection

         // for command 1
         try
         {
         //...create a command and do stuff with it.
         }
         catch ...
         {
         // send message or log message then exit via finally block
         }
         // for command 2
         try
         {
         //...create a command and do stuff with it.
         }
         catch ...
         {
         // send message or log message then exit via finally block
         }
       }
    catch (Exception as ex)
    {

          MessageBox.Show("Connection open Error:"+ex.Message);
          //don't code return here

    }
    finally
    {
      connection.Close();
      connection.Dispose();
    }
  } //automatic dispose could take care of the connection implicitly as well
  return;
</code>```

Title: Do more object declarations affect the program?

Body:
Generally you want to get the connection via a method from a source such as a config file. Within 1 transaction, you may want to use 1 connection. and you may also want to make sure that after a connection error, a message is logged or displayed and no further processing takes place. Connection errors are frequent during development and deployment and you may want to make sure they are identified separately from other rare errors.

There are many ways to write a code that satisfies your requirement, here is one way:

    string sqlconnection=getCnString(); //getConnection obtains and formats cn string
    using (SqlConnection connection = new SqlConnection(sqlconnection)
    {
    try
    {
         connection.Open();
         //...do stuff with the open connection

         // for command 1
         try
         {
         //...create a command and do stuff with it.
         }
         catch ...
         {
         // send message or log message then exit via finally block
         }
         // for command 2
         try
         {
         //...create a command and do stuff with it.
         }
         catch ...
         {
         // send message or log message then exit via finally block
         }
       }
    catch (Exception as ex)
    {

          MessageBox.Show("Connection open Error:"+ex.Message);
          //don't code return here

    }
    finally
    {
      connection.Close();
      connection.Dispose();
    }
  } //automatic dispose could take care of the connection implicitly as well
  return;


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

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

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

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

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

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

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

答:
From the telerik website

To support the Open Source community, we are providing the Telerik Extensions for ASP.NET MVC with the widely adopted GNU GPLv2 license. This option is appropriate for developers creating Open Source applications under a license compatible with GPLv2.

This means you can use it for free if and only if you are developing Opensource application. Or else you should always buy the commercial license.

For example NopCommerce uses the telerik controls for free since its an opensource application

OwnerDisplayName: Giedrius

ContentLicense: CC BY-SA 3.0


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

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

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

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

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

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

            cmbo_division.Items.Clear();

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

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

答:
Here are some rules that are almost always correct:

You should never reuse a variable for two different purposes.

The case when you need to, is a very specific one, and when you see it, you will know it (the flyweight pattern).

You should keep your methods very short.

The code you've shown can be logically contained in 3-5 methods at least.

You should not have duplicate code. (DRY = Don't Repeat Yourself)

Any similarly looking lines of code are most likely same functionality repeated in several places. Extract this in a single method.


问:
Why do we have postfix increment?
Disclaimer: I know perfectly well the semantics of prefix and postfix increment. So please don't explain to me how they work.

Reading questions on stack overflow, I cannot help but notice that programmers get confused by the postfix increment operator over and over and over again. From this the following question arises: is there any use case where postfix increment provides a real benefit in terms of code quality?

Let me clarify my question with an example. Here is a super-terse implementation of strcpy:

```<code>while (*dst++ = *src++);
</code>```

But that's not exactly the most self-documenting code in my book (and it produces two annoying warnings on sane compilers). So what's wrong with the following alternative?

```<code>while (*dst = *src)
{
    ++src;
    ++dst;
}
</code>```

We can then get rid of the confusing assignment in the condition and get completely warning-free code:

```<code>while (*src != '\0')
{
    *dst = *src;
    ++src;
    ++dst;
}
*dst = '\0';
</code>```

(Yes I know, src and dst will have different ending values in these alternative solutions, but since strcpy immediately returns after the loop, it does not matter in this case.)

It seems the purpose of postfix increment is to make code as terse as possible. I simply fail to see how this is something we should strive for. If this was originally about performance, is it still relevant today?

答:
Perhaps you should think about cosmetics too.

```<code>while( i++ )
</code>```

arguably "looks better" than

```<code>while( i+=1 )
</code>```

For some reason, the post-increment operator looks very appealing. Its short, its sweet, and it increases everything by 1.  Compare it with prefix:

```<code>while( ++i )
</code>```

"looks backwards" doesn't it?  You never see a plus sign FIRST in math, except when someone's being silly with specifying something's positive (+0 or something like that).  We're used to seeing OBJECT + SOMETHING

Is it something to do with grading? A, A+, A++?  I can tell you I was pretty cheesed at first that the Python people removed operator++ from their language!

OwnerDisplayName: FredOverflow

ContentLicense: CC BY-SA 2.5

Title: Why do we have postfix increment?

Body:
Perhaps you should think about cosmetics too.

while( i++ )

arguably "looks better" than

while( i+=1 )

For some reason, the post-increment operator looks very appealing. Its short, its sweet, and it increases everything by 1.  Compare it with prefix:

while( ++i )

"looks backwards" doesn't it?  You never see a plus sign FIRST in math, except when someone's being silly with specifying something's positive (+0 or something like that).  We're used to seeing OBJECT + SOMETHING

Is it something to do with grading? A, A+, A++?  I can tell you I was pretty cheesed at first that the Python people removed operator++ from their language!


问:
Sharing buffer between multiple threads part 2
This is a follow up to my previous not answered question, so I try to make it more clear: last  question.

I have a n-size buffer that is filled up from an external source, it has 2 main methods get() and add(), get() blocks (via wait()) if buffer is empty and add() blocks if buffer is full.

This buffer object reference  is available  to multiple consumers (threads).

Each consumer reads data  from buffer independently from other consumers .

All Consumers must read ALL data from the buffer.

As someone suggested, I have created A hashmap where key is an id of the consumer  and value is the index within the buffer that was read by this consumer.

The problem is that every consumer continues to request data from buffer. I need somehow to block it until next dataitem get available for it in buffer.

Where and how should I block it?

(I can't use wait() in consumers object, because the producer can't call notify()
since producer and consumer are different objects)

答:
Sounds pretty much like Disruptor. There you have a ring buffer with several consumers reading from it. Writer can't write next element until it was read by all consumers and consumer knows where writer is so wont overtake it.

Have a look here for a better explanation than my one :) Source code is available, I heard that there is also C++ implementation of the pattern.

http://martinfowler.com/articles/lmax.html

http://code.google.com/p/disruptor/


答:
I'm not aware of any ready-made data structure that will enable this - the issue is that you need to track the read positions of every consumer so that they all receive their own full copy of the buffered data.

I suspect you are better off using one queue for each reader and have a writer write to all of these queues (in a way that blocks if any of the reader queues are full). I think this will get you the same effect overall.

Also be aware that you get a nasty case when one reader falls behind and all other readers / writers move fast - everything will block on the last reader since the buffer will be holding n items that are only still needed for that reader.

Title: Sharing buffer between multiple threads part 2

Body:
This is a follow up to my previous not answered question, so I try to make it more clear: last  question.

I have a n-size buffer that is filled up from an external source, it has 2 main methods get() and add(), get() blocks (via wait()) if buffer is empty and add() blocks if buffer is full.

This buffer object reference  is available  to multiple consumers (threads).

Each consumer reads data  from buffer independently from other consumers .

All Consumers must read ALL data from the buffer.

As someone suggested, I have created A hashmap where key is an id of the consumer  and value is the index within the buffer that was read by this consumer.

The problem is that every consumer continues to request data from buffer. I need somehow to block it until next dataitem get available for it in buffer.

Where and how should I block it?

(I can't use wait() in consumers object, because the producer can't call notify()
since producer and consumer are different objects)


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

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

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

答:
One of the benefits of making code available for employers is that you can use it to screen your opportunities.

A job interview is bidirectional; Not only is the employer assessing the candidate, the candidate should also be deciding if they actually want to work for the employer.

When an employer makes an offer without first having actually seen the programmer's work, there's a very good chance that the same process was used before, to hire everyone else.  A job seeker should probably be very wary of accepting offers when there is no obvious reason why a non-programmer should have been unable to qualify for the same position (because there surely have been)

Of course, most employers do ask for the candidates to produce some code; and it seems to usually be in the form of "write a function on this whiteboard" or if you're lucky "write a function on this unfamiliar workstation".  Though this can do a reasonable job of separating out the candidates that really can't even write "Hello World!", it becomes much less informative about the difference between who can write good code from who can keep their cool in an interview.

And so many (though far from most) employers are eager to also take a look at the kind of code a programmer can produce when they are in their ideal setting, working on what they want to work on, and without any particular guidance.

To make the best of it, it's a good idea to offer the code even before an employer asks for it;  If they just aren't interested, find another opportunity.  If they are interested, tell them which projects you'd like them to look at and why (and also explain why you don't think some of the other projects are as representative, for instance you were learning the framework out of a book).  Then ask them what they thought about what they saw when you next talk to them.


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

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

```<code>public class DataClass {

private int i;
private int j;

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

public int getI(){
    return i;
}

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

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

```<code>public class WorkerClass {

private DataClass data;

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

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

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

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

```<code>public class TestClass {

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

{
    workerClass.setData(data);
}

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

}

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

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

答:
The problem I believe with using initialization for setting test data is that you will encounter problems when an individual test changes the state of the object you are testing. All other tests executing after that specific test would be using the wrong data and may produce a false success/failure result if the test assume a specific inital state or data.

If there are common tasks before each test is run and you don't want to keep writing them down for each test (which is appropriate), they probably should be put in a setUp function.

```<code>@Before public void setUp() {
    workerClass = new WorkerClass();
    workerClass.setData(data);
}
</code>```

Your setUp function is automatically called before each test so you do not need to explicitly call it.

See http://junit.sourceforge.net/doc/cookbook/cookbook.htm

Title: Am I misusing instance initialization?

Body:
The problem I believe with using initialization for setting test data is that you will encounter problems when an individual test changes the state of the object you are testing. All other tests executing after that specific test would be using the wrong data and may produce a false success/failure result if the test assume a specific inital state or data.

If there are common tasks before each test is run and you don't want to keep writing them down for each test (which is appropriate), they probably should be put in a setUp function.

@Before public void setUp() {
    workerClass = new WorkerClass();
    workerClass.setData(data);
}

Your setUp function is automatically called before each test so you do not need to explicitly call it.

See http://junit.sourceforge.net/doc/cookbook/cookbook.htm


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

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

So here are the constraints:

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

we are and will be using Subversion;

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

it must be free;

it must allow at least 2 users.

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

答:
For really really simple issue tracking, you can always use a spreadsheet like Excel, or an MS Access database. These are basically toys compared to real issue trackers, but they have the advantages of low learning curve and low barrier to entry: just make a spreadsheet and add columns as you need them!

Excel is nice for this since you can sort and filter by column, and easily generate charts and graphs to track progress. See this article for more: http://chandoo.org/wp/2009/09/08/issue-trackers/

A nice MS Access Issue Tracker template is available here: http://office.microsoft.com/en-us/templates/issue-tracking-database-TC001225348.aspx

Title: Simple issue tracker for 1-2 developers


答:
My vote is for Redmine. It is completely free and integrates well with Subversion.

project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database.

Redmine is open source and released under the terms of the GNU General Public License v2 (GPL)...

Some of the main features of Redmine are:

Multiple projects support

Flexible role based access control

Flexible issue tracking system

Gantt chart and calendar

News, documents & files management

Feeds & email notifications

Per project wiki

Per project forums

Time tracking

Custom fields for issues, time-entries, projects and users

SCM integration (SVN, CVS, Git, Mercurial, Bazaar and Darcs)

Issue creation via email

Multiple LDAP authentication support

User self-registration support

Multilanguage support

Multiple databases support...

Title: Simple issue tracker for 1-2 developers

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

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

So here are the constraints:

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

we are and will be using Subversion;

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

it must be free;

it must allow at least 2 users.

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


答: For most situations, AGPL is the only GPL license that requires releasing the source code of hosted web applications. Under vanilla GPLv2, if you're not distributing the modified and compiled binaries to end users you do not need to release the source code. You're not distributing the software, you're allowing remote access to it.

Title: Telerik ASP.NET MVC components licensing

Body:
There's thread on stackoverflow about this
https://stackoverflow.com/questions/5524046/is-telerik-extensions-for-asp-net-mvc-free

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

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

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

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

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

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


答:
My recommendation:

A file named bugs.txt in the repository root.

Advantages:

It's a .txt. Means you aren't tied to a particular system/software

It's dead simple.

You get to decide what works for you with this method - my example one goes something like this:

filename.ext.class/method: refactor when I get the chance, that regex is really screwed up.

filename2.ext.class/method: got a lovely UI bug with that, doesn't work in Mac Chrome. Screenshot: imgur.com/foobar

Cross platform. As soon as you do a svn checkout <url>, you have your bugtracker there - you also can use $IDE-of-choice - to it, it's just another text file.

Disadvantages:

gets unwieldy after more than 2-3 developers.

No way to really assign it to a person.

No way to embed images of UI bugs and such.

Title: Simple issue tracker for 1-2 developers


答:
For my small team (mostly just me alone), I've been using CodeTrack. It works really great for me, because it only needs PHP on the server, not even a database.

You can just download it, extract it on your web server and it works almost instantly. Moreover, the code is really simple, so you can easily customize it for your exact needs.

Title: Simple issue tracker for 1-2 developers


问:
How should I organize the Presenters/Views for model view presenter?
We have several hundred ASPX files (could be more than that, into the thousands, I haven't actually counted) that currently use no architecture and have all the logic/data access in code-behind files.  Moving forward I want to push using Model-View-Presenter (probably the "Supervising Controller" version) to try and get some clean separation.

What would be the best approach to logically lay out these files in my Presentation library?  Most of the aspx files aren't organized and just thrown into the main directory, but some are grouped (or are misgrouped e.g. having customer-related files in a folder called "orders").  Should I try to group presenters and views by modules (e.g. have Presentation.Views.Customers and/or Presentation.Customers)?  The correct approach does not seem to be just have hundreds of XPresenter and XView files thrown into the class library.

答:
I would sort them by logical grouping first, then by category second

So all your Login objects would be in one area, all your Customer Management stuff in another, etc

Some examples would be

MyApplication.Login.Views

MyApplication.Customers.Presenters

MyApplication.Customers.Views

MyApplication.Orders.Models


问:
How do you test a data load?
I'm working on a project that involves loading batches of 3000+ files to several dozen tables.  There is no user interface, and the tables are simply available for querying.  What are the best practices for testing this type of process?

Loading a small set of data and validating each and every member?

Loading all the data and validating a subset?

Loading all the data and validating counts, averages, and other metrics?

Are there other types of testing that can be done, or is some combination best?

答:
The way to test the data integrity is very simple:

Load the file using whatever method you choose.

Using queries reconstitute the file.

Compare the 2 files. (md5sum as a simplest measure)

Since you are loading 3000+ files into about a dozen tables you will need a way to identify the set you have just loaded.  And simple formatting of the files would make the job easier but that is the only way I can see you verifying that the load was properly done.

Title: How do you test a data load?


问:
Is there a canonical resource on R programming?
Considering I have no programming background, Is there a resource out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on R programming? What about that resource makes it special?</p>

答: From a design perspective I would definitely recommend Programming with data by John Chambers. He is the designer of the S language, of which R is the open source implementation. Another more conceptual book seems to be The Art of R Programming: A Tour of Statistical Software Design. There are number of statistics books which use R (Modern Applied statistics with S (and R), Introductory statistics with R), but these are already more aimed at the statistics, while you are probably more looking for a programming and not a stats book.</p>


答:
I guess it depends on what other validation checks you have in the process that actually uses the data in these files

If it contains its own validation, then I'd just do a quick check on the first few lines of each file to verify it's in the right format.

If it has no validation, then I would do a full validation check on the files so that the process that uses the data can run without a problem.

Personally I prefer the first method of adding the validation in the process that will be using the data, and doing a quick validation on import.

Title: How do you test a data load?

Body:
I'm working on a project that involves loading batches of 3000+ files to several dozen tables.  There is no user interface, and the tables are simply available for querying.  What are the best practices for testing this type of process?

Loading a small set of data and validating each and every member?

Loading all the data and validating a subset?

Loading all the data and validating counts, averages, and other metrics?

Are there other types of testing that can be done, or is some combination best?


答:
YouTrack from JetBrains (the company behind IntelliJ IDEA and ReSharper) seems very promising, though I still have limited personal experience with it.

It's hosted in cloud and setting up your own instance is very quick (maybe 5 mins)

Free for <= 9 users. (Also, even the biggest plans covering 2000 users is free until Feb 29, 2012)

Supports Open ID login (e.g. from Google)

Has good keyboard shortcuts

From what I've used YouTrack so far, at least I much prefer it to JIRA.

Title: Simple issue tracker for 1-2 developers


答:
First of all, it is important to understand that R can be used for different purposes, each of which would have a particular book dedicated to it with some specific examples and applications.

The one I would definitely recommend for somebody who wants to understand R as a programming language is Software for Data Analysis: Programming with R. This book explains how the languages works in details. However, you will have few "concrete examples" of application. However, it is this book that made me feel completely fluent in R.

Then, I would suggest reading Data Manipulation with R which will explain you the different data structures which are quite different from one another and can be a pain during development if you haven't understood properly how they work.

Then you can find the book you want for the concretes examples on your field.

Title: Is there a canonical resource on R programming?

Body: Considering I have no programming background, Is there a resource out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on R programming? What about that resource makes it special?</p>


问:
What's the best place for a high school programmer to get his work noticed?
I'm a 16 year old high school student, with a passion for computer programming.
I'm in grade 11, and I've been learning it as part of the school syllabus for about 8 months.
I've gone beyond what's being taught at school, and witten a few (reasonably good) applications. The language that I program in is C++, on the windows platform.
Eventually I'd like to major in CS at a good college and then work as a programmer.

The specific questions that I have are:

What is a good place for me to get my work noticed ?

Are there any journals, or publications specifically for young programmers ?

If not publications, then are there any good blogs, or is it just better to start your own ?

Is there anything else, that would help me get noticed as a programmer ?

I've tried to be as objective as possible.

If all this was tl;dr:
What's the best way to get noticed as a young programmer ?

Edit:
I am not looking to get hired straight out of high school
The aim is not to impress the community as a professional programmer.
This is with intent towards college applications where having your work seen and critiqued by other people will improve your application. I am not looking to earn money from what I've written (so far).

答:
Try to get a really high reputation on Stack Overflow. Almost the same topic was discussed here:

Will high reputation in Stack Overflow help to get a good job?


答: Have you thought about creating open source projects for the applications you have written and hosting them online? SourceForge.net or GitHub.com are good open source project hosts. This will help gain visibility for your applications.</p>

Title: What's the best place for a high school programmer to get his work noticed?

Body:
I'm a 16 year old high school student, with a passion for computer programming.
I'm in grade 11, and I've been learning it as part of the school syllabus for about 8 months.
I've gone beyond what's being taught at school, and witten a few (reasonably good) applications. The language that I program in is C++, on the windows platform.
Eventually I'd like to major in CS at a good college and then work as a programmer.

The specific questions that I have are:

What is a good place for me to get my work noticed ?

Are there any journals, or publications specifically for young programmers ?

If not publications, then are there any good blogs, or is it just better to start your own ?

Is there anything else, that would help me get noticed as a programmer ?

I've tried to be as objective as possible.

If all this was tl;dr:
What's the best way to get noticed as a young programmer ?

Edit:
I am not looking to get hired straight out of high school
The aim is not to impress the community as a professional programmer.
This is with intent towards college applications where having your work seen and critiqued by other people will improve your application. I am not looking to earn money from what I've written (so far).


答:
Go to competitions like Imagine Cup or, at least, your school's contests (if any)

Put your applications online, maybe give the source code and, though not related to your question, listen to the feedback from others and learn from it

Try to contribute to different communities


答:
I'll follow on Bernard's answer and add a little more. There are so many OSS projects out there that it still can be hard to get noticed unless you create a popular project, which isn't going to be easy for a programmer just starting out.

Assuming you are trying to get noticed in the programming community, I'd suggest publishing (either OSS or closed source) add-ons for tools that programmers use. Imagine going into a job interview and being able to say that the company is already using software that you wrote. Lots of developer tools have APIs for creating add-ons and several even host "App Stores" where you can get some exposure for your tool without worrying quite so much about marketing it.

Here are some examples off the top of my head:

Programming IDES (Visual Studio, Eclipse, NetBeans, etc.)

Many of the source control tools (SourceGear, Mercurial, etc.)

FogBugz

jQuery

StackOverFlow API

WordPress (Get noticed by tech bloggers)

Paint.net

Beyond Compare

Depending on the tool you pick, you can target the specific enclave of the programming community you want to get noticed by.


答:
I'd like to give you some warning and some suggestions.

Warnings:

Don't over-estimate your knowledge: right now I can assume you know enough to write a simple application and more than what is actually taught in class. But that doesn't make you a "professional programmer"; it can make you a "freelancer" at most.

Don't under-estimate the value of what is taught in school. Even if something may seem obvious to you, study it as well: you'll see "new aspects" (I'll be more clear later) as you will proceed.

Suggestions:

Professional applications have typical life-cycle of 3-5 years and require thousands (up to millions) man-hour working. They cannot be deployed by a developer alone. Professional programmers have to work with others. It's not just a matter of good knowledge of tools (like languages, IDEs etc.) but also of techniques, methods and idioms.

While tools can be taught by formal samples and exercise, techniques and idioms can only be "described". To "learn" them you have to experience and share the experience with others. They are continuously invented and improved.

Companies, when hiring from school, check your understanding of tools and your ability with basic technics, but - most important - test your capability in rapidly learning new things and "capture the work" as it is needed.

When hiring for experienced people, they look at how many things they have done and what experience they got from those things.

Moral:

If you want to be more "evaluated" learn to work with others, by participating in other's problems (like on stackoverflow) or open projects (like on sourceforge)

Also, don't be too fast to ask for money; split your "code production" in "something to share" and "something to sell".  What you can share can be used by others but can also attract the participation of others to expand the initial project. What you can sell is what makes your app "unique" with respect to other similar projects, leading it to become a real commercial product.

To share code with others, you can refer to site codeproject or sourceforge. Their rating also gives an idea of how interesting what you did was to other people.


答:
I would create two (sets of) test cases. One that runs often, is fast and validates only statistically and another one that runs less often (depending on your project schedule - every week or month) but checks all the data.

The fast test would import all the data then check:

the number of records

take a number of records and check their integrity (pick every K records where K could be something like number of records / 100)

if you have columns that support aggregate operations which execute fast you might want to check those too in the fast tests.

For the test that is executed less often just do a full integrity check either by doing 1-1 comparisons or by computing hashes.

Title: How do you test a data load?


答:
A few things you might want to try:

Write software that solves real problems, ideally problems that haven't been solved before (or at least not satisfyingly so). If nobody uses your software despite your best promotional efforts, chances are they simply don't need it that desperately.

Announce your work on relevant mailing lists, IRC channels and internet forums. If your program makes extensive use of some library, consider posting to the library's community; if it complements other existing pieces of software, announce to their communities, etc.

If it's a serious enough project, set up a dedicated web site for it. The web site should provide a feature summary, links to downloads and documentation, and (if applicable) a few screenshots. Make sure it's a proper website, not some ad-ridden cheapo geocities-style abomination - you want to be taken seriously, so act upon it. Adding a news section, a wiki and / or a bug tracker gives potential user an indication how active the project is, which can work for you or against you (if the project is not very active after all).

If it's an open source project, host it on one of the popular FOSS hubs (github, bitbucket, sourceforge if you have to), and (see above) expose the wiki and the bug tracker (but only if you use them regularly).

Whatever you do, provide good documentation. You need both a short "getting started" and a full reference. If you don't have the first, people will find your program too hard to use. If you don't have the second, people will stop using it because they can't find the information they need.


答:
First of all, let's be clear: most of the 16 YO programmers will not really impress the community.

There is a reason for that in my opinion. Being a good programmer does not only rely on programming skills. As you hopefully see during your CS major, programming is only a subset of computer science, and most of the people winning prizes (academic prizes at least) will have done so because they proved something new (a new theorem for example), or discovered a new way to achieve some kind of task (design patterns). In order to do so, you need to (at least):

Get a good background in math, it is required to understand algorithmics and hence master the different data structures.

Understand that a good programmer first understands the paradigms (object-oriented, functional, ...) before being interested by a "concrete" language.

Understand that good programming often also comes for code modelling, and learn the existing design-patterns.

If you feel you have already mastered all that, then yes, you will probably impress the community.

You can always try to contribute to an open-source project, but you might be also quite surprised how much you have to catch up before actually being able to contribute.

Finally, have a look around on StackOverflow and see how much you can answer there in your favorite language... you'll have a good proxy of your level.


问:
How to write manageable code with functional programming?
I just started with functional programming (with JavaScript and Node.js) and from the look of things it looks as if the code I am writing would grow to be one hell of a code base to manage, when compared to programming languages that have a sort of object oriented paradigm.

With OOP I am familiar with practices that would ensure your code is easily managed and extensible. But am nore sure of similar convention with functional programming.

答: Rather than abandoning OOP for FP, try augmenting it with some FP patterns. Any time you need to process a collection is a good candidate and points to a common set of FP methods like map, fold and reduce. Take a look at underscore.js and backbone, an MVC framework that makes extensive use of the former.</p>


答: I find Matloff's R for programmers a pretty good read (despite the title, it's perfectly suitable for non-programmers, such as myself and covers more or less everything, including the S4 class types), especially in conjunction with The R Inferno by Patrick Burns (teaches you about "gotcha's" in R). Both are freely available resources.</p>


答:
To directly answer your question: No, but see the main project website and official R manuals.

To indirectly answer your question: R is a pain in the butt to learn, because I've found that there are fifty ways to accomplish any single task, and that's pretty confusing for the new user. I'm going through this right now and I'm finding it as difficult as anyone.

The technique I found most useful was to learn the very basics of R by going through the first chapter or two of any R tutorial to get the language syntax, and then to go through homework problems from an R course. This way, instead of reading through the fifteen ways to sort a data frame, you can learn one way, try it out in the homework, and if it works, great, that's how you do it. If not, keep searching until you find a technique that does work.


答: If you think of it as a portfolio then yes, I'd recommend putting that link in your CV. I do.

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

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

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

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


问:
Publishing an internal web app on the internet to a much larger group of users than before
My company has developed a web application based on GWT (Google Web Toolkit) and Ext GWT in the browser, JBoss application server and Oracle in the backend. The app
allows users of different departments of the same company, working in
different locations, to collaborate in order to employ a fairly complex
approval process for really expensive technical equipment. Let's call this app app 1. The app is dialog-based, using Ext GWT's Desktop component to provide an MDI app within a browser window. It's been used productively for more than a year now.

Another app, app 2, also has been developed which offers a specific
subset of the functionality of App 1. By subset I mean that
- some dialogs are not provided (like those for administration of master
data or system settings)
- some dialogs are reused but some input or display fields are missing
- some data are filtered (users will only see a subset of the
information that is available to users of app 1)
- some dialogs are completely identical

Currently, app 2 is there but nobody uses it, because it has not been
officially published to anyone and nobody has an account to log in. The
goal for 2012 is to open app 2 to a host of new users. These will be
working at different companies in different locations all over Germany
and potentially neighboring countries (Austria, Switzerland, France,
...) as well. It is not possible to get all new users together and give
them a training of several days in order to learn how to use the app and
the process. The documentation that exists so far is a user manual, a
PDF file of more than 100 pages, to be found through a "?" menu.

Both apps have been developed by my company for another company. None of
these two have very much experience with providing and supporting a
public web application for the rest of the world.

So, what can we do in order to provide people with information and
assistance on how to use this app? Here are the measures that I've come
up with so far:

Provide a start page (just static HTML) before the login screen that
describes (shortly!) what this app is and why users would want to log in
and use it. Also, how to obtain a login and where to find support

Create a guided tour of short videos (created with Camtasia Studio) of
at most 3 minutes each. Those will guide through the most important use
cases step by step. I'm thinking of something like this
https://sourcing.thyssenkrupp.info/lvportal/external/guidedtour/tk_uk_files/uk_html.html
which was created a couple years ago in a very similar situation

A start screen, which will pop up immediately after login. It will
show a list of command links with a short explanatory text for the most
frequent use cases. Also, it will provide a direct link to the guided
tour and the user manual

A task-oriented list of item counts for the user (like on every line
something like "Items on which you have to do X", "Items on which you
have to do Y" etc). This list will be either integrated into the
background of the desktop-in-a-browser-window or put into a docked area
to the left of the desktop itself

I'm also considering an FAQ page. But of course there haven't been any questions asked yet so we don't know what to put there. So the idea is to have ab easily updatable page of static HTML content. Or maybe a miniature CMS integrated into the app itself.

Any comments on those measures and any further suggestions are welcome.

答:
I like the suggestions that you have and think these are all great things to have assuming that the majority of your userbase are mostly ignorant or unfamiliar with the application.  A few suggestions though:

If your application has some "power user" features tailored to educated users on the run, you might want to also consider adding a Tip-of-the-Day dialog or dashboard message after the user logs in.  These tips can include lesser known or utilized power user features that are not necessary to know or include in a tutorial, but may be helpful in teaching users better and more efficient ways to use the application.  Of course given them the option to disable the Tip-of-the-Day dialog for those that find those distracting.


答:
Don't put anything on your résumé that you don't feel comfortable having someone examine with a critical eye. Likewise, don't make a potential interviewer have to dig through the repository to have to find the good stuff, you are better off having a small repository with some well written libraries or code snippets then you are having a full blown application.

If you do provide the link to a repository, make sure that there is a clearly defined README file that can point people at the interesting parts of the code that you want to show off as well as a brief overview of exactly why things are the way the are. If you disclose the link early in the hiring process you may not be around to justify your design decisions so a README may be explaining things on your behalf.


问:
Does it make sense to use Kanban if all steps are done by the same person?
In our team all task's steps are always done by the same developer. I.e for task 1, person A does design, development, and testing; for task 2, person B does does design, development, and testing, etc. Does it make sense to use Kanban in this case?</p>

答:
I would suggest still using Kanban by slightly changing the process:

```<code>Person A does design            Person B does design
Person B Reviews A's Design     Person A Review's B's design
Person A does development and   Person B Does Development and Initial Testing.
initial testing
Person B QA's person A's work   Person A QA's Person B's work.
</code>```

Putting all tasks with 1 developer as Chad pointed out is a recipe for disaster while not in the initial stage but most certainly down the road when maintenance on the project would be required.

Body:
I would suggest still using Kanban by slightly changing the process:

Person A does design            Person B does design
Person B Reviews A's Design     Person A Review's B's design
Person A does development and   Person B Does Development and Initial Testing.
initial testing
Person B QA's person A's work   Person A QA's Person B's work.

Putting all tasks with 1 developer as Chad pointed out is a recipe for disaster while not in the initial stage but most certainly down the road when maintenance on the project would be required.


问:
What's a RESTful url for a linked item?
This is going to be a web service that returns a JSON object. Currently, I'm using C# technology and simply using ASP.Net MVC to create the calls. This is not a web page, so SEO is not a concern.

I've come across a number of instances where I want to get the "next" or "previous" item in a list.
For example, I've got a service that returns a featured photo.
http://myservice.com/photos/123
which returns a JSON

```<code>{"name": "At_The_Concert", "id": "123", "src": "http://myservice.com/photostore/123.jpg"}
</code>```

The client (Ajax, Mobile device, etc.) of this service wants to know what the “next” item is going to be. I’m struggling about what the url should be.

http://myservice.com/photos/123/next

http://myservice.com/photos/next/123

http://myservice.com/nextphotos/123

or maybe the id property should just be a parameter

http://myservice.com/photos/next?photoId=123

Or maybe this is entirely wrong and it should be like

http://myservice.com/photos/?method=getNextPhoto&photoId=123

though with .Net's routing, it might be easier to write it as
http://myservice.com/photos/method/getNextPhoto?photoId=123

I’m relatively new to web services and REST. I get the basic CRUD for REST, but I don’t know what is the best practice for creating more custom urls, in this case the “next” photo.
Is there an accepted RESTful practice?

答:
Do it this way:</p>

```<code>{"name": "At_The_Concert", "id": "123", "src": "http://myservice.com/photostore/123.jpg",
"next": "http://myservice.com/photos/345/",
"prev": "http://myservice.com/photos/901/"}
</code>```

Title: What's a RESTful url for a linked item?

Body:
Do it this way:

{"name": "At_The_Concert", "id": "123", "src": "http://myservice.com/photostore/123.jpg",
"next": "http://myservice.com/photos/345/",
"prev": "http://myservice.com/photos/901/"}


答:
Learn as much as you can.  This can be done by books, forums, classes, but most importantly by actually programming (and getting critiqued).  If you've outgrown the programming classes at your high school, see if a local (community) college has any good CS classes that you can take (maybe over a summer or as a night class); or try taking open course ware from MIT/Stanford types.

Demonstrate initiative.  Saying you know C++ will be totally disregarded.  Saying you have dozens of commits to a list of open source projects demonstrates you know something, etc (though be careful; don't just commit for the sake of committing).  Start your own open source projects.  This isn't going to be something you do in an afternoon; but something that becomes your baby over a period of months.  Write and publish an android/iphone app that does something useful and gets people to download it.

PS: Its been a long time since I've applied to college -- they still give you an opportunity to list things like this, right?  (E.g., a section about hobbies, or a essay question about your interests).


问:
What unit test frameworks exist for Java?
I've used TestNG and JUnit.  What other frameworks are out there? What makes them special and/or different from the rest?</p>

答:
Scala Specs gets my vote! :-)

Specs is a behavior-driven-development testing framework written in Scala. It can be used to write tests for Java and Scala. It was inspired by RSpec - a testing framework very popular in the Ruby world.

An example test written in Specs:

```<code>import org.specs._

object ElementSpecification extends Specification {
  "A UniformElement" should {
    "have a width equal to the passed value" in {
      val ele = elem('x', 2, 3)
      ele.width must be_==(2)
    }

    "have a height equal to the passed value" in {
      val ele = elem('x', 2, 3)
      ele.height must be_==(3)
    }

    "throw an IAE if passed a negative width" in {
      elem('x', 2, 3) must throwA(new IllegalArgumentException)
    }
  }
}
</code>```

Impressive, isn't it? :-)

Body:
Scala Specs gets my vote! :-)

Specs is a behavior-driven-development testing framework written in Scala. It can be used to write tests for Java and Scala. It was inspired by RSpec - a testing framework very popular in the Ruby world.

An example test written in Specs:

import org.specs._

object ElementSpecification extends Specification {
  "A UniformElement" should {
    "have a width equal to the passed value" in {
      val ele = elem('x', 2, 3)
      ele.width must be_==(2)
    }

    "have a height equal to the passed value" in {
      val ele = elem('x', 2, 3)
      ele.height must be_==(3)
    }

    "throw an IAE if passed a negative width" in {
      elem('x', 2, 3) must throwA(new IllegalArgumentException)
    }
  }
}

Impressive, isn't it? :-)


问:
Why does HTML TextArea have its own HTML tag?
```<code><input id='input1' type='text'></input>
<input id='input2' type='button'></input>
<input id='input3' type='checkbox'><input>
<textarea id='myTextArea'></textarea>
</code>```

In HTML markup, most places where the user can interact with the page are denoted with the <input> tag.  Why is it that textarea has its own tag, <textarea> as opposed so, say, <input type='textarea'>

答: Because <textarea> has the rows and cols attributes that are specific to it. If it were a type of <input>, these attributes would have to be part of the <input> tag even though they serve no purpose for the other types.


答:
I am a freelance programmer.  Programming has been my primary income since I have graduated high school 9 years ago.  I still intend to get my degree, but at the moment the time still isn't right for me.

My path to self driven recognition was as follows.  I'm not saying that these steps will make you recognized by the programming community, but it will help increase your credibility when it comes time to interview.

Even after I was fairly versed in programming IMO at the time, I went back to the basics and went through tutorials and built myself a portfolio based on inspired works from those.  I also began to force myself to comment my code in a JavaDoc-esque fashion.  The portfolio may not be filled with glitz and glamour right now, but it gives you a baseline that you can build off of and eventually replace what you have in there.  I then had a set of demos and code samples to show to prospective clients.  This is essential in getting your first job.  Nobody wants to hire someone that doesn't have any experience, however, there are a number of individuals who will give a chance to a promising looking programmer that doesn't have professional experience.

I later analyzed these programs and began to write libraries based on my commonly used tasks.  With my new libraries I began looking at CompSci problems on the internet and began timing myself on how long it would take me to build a solution with my libraries.  This would give me a baseline in the future as to what I should charge for a specific task.

It wasn't until then that I had discovered open source.  I looked through the projects on sourceforge in the language I was interested in and found applications I could make use of.  I installed these applications and began using them as a part of my every day computing experience.  I was able to see the strengths and weaknesses of these applications as far as my every day interaction was and I began to extend them to suit my needs.  I would submit my patches to the community developing to be reviewed, and after a few I would apply to become a member of the project.  This is where I learned to use the different tools used when working in a team that took my "vast experience", as I considered it at the time, and took it to the next level.

I adapted all of my practices that I had picked up working on open source projects and implemented comprable solutions when I was working as an individual.  I began seriously pursuing a career as a freelance developer and joined a number of freelance recruitment sites.  I looked at what the popular jobs were, and began applying.  For every job that I would get turned down, I would still complete it for myself as if I had obtained the job to expand my knowledge.  This would help build my portfolio and introduce me to some real world challenges.  When I finally did get that first interview I was straightforward, told them that I didn't have any professional experience.  I then began to tell them the open source projects that I had worked on, what I had accomplished there.  Some major hurdles I had come across, and how I addressed them.  I was able to offer a portfolio of working applications and example code based on my experience as an amateur, and they took in all of the information and provided me with the opportunity to step in to the freelance world.


答:
What is a good place for me to get my work noticed ?

Just about anywhere on the internet - if you write something worth mentioning, such as a utility that does something neat or unique, that a large number of people will use/download - then you've already accomplished the larger part of this task. Cool, useful, and available applications, advertise themselves.

Are there any journals, or publications specifically for young programmers ?

If not publications, then are there any good blogs, or is it just better to start your own ?

You're already here - this is just one, out of many communities, that out of the shear desire to share, and to be known for knowing - other people are more than happy to link topics of merit, to the current discussion.

Is there anything else, that would help me get noticed as a programmer ?

Just program for the sake of programming - as long as it's productive, creative, and useful - notice will be taken.

One point that I see mentioned in other replies, that I stand by as well, is contributions made towards open-source projects. The only way to get better at coding, is to code - and what better way to do that, than to solve current problems. Because, without a problem to solve, you're coding in vain... oh, one more thing, never mind the grumpy old guys, with their bloated, and intentionally discouraging, "young whipper snapper" comments - you're young and enthusiastic, that's all you need.


答:
Having the next function be an operation server-side requires state information, particularly if you are involving filtering.  This violates REST.

It seems more appropriate to provide a directory list at http://myservice.com/photos, and let the app call the appropriate http://myserivce.com/photos/id link when hitting next/previous.  With this method, the filtering logic would be on the client, and it could be modified/reset without having to call the service again.

Alternatively, you could have request parameters into the http://myservice.com/photos that returns a filtered list.  Naturally, this would require additional service calls if the filter changed, so you may wish to stick with the former suggestion.

The end result would be the same, however.  Your state would reside where it should - in the client app as opposed to the server.

Title: What's a RESTful url for a linked item?

Body:
This is going to be a web service that returns a JSON object. Currently, I'm using C# technology and simply using ASP.Net MVC to create the calls. This is not a web page, so SEO is not a concern.

I've come across a number of instances where I want to get the "next" or "previous" item in a list.
For example, I've got a service that returns a featured photo.
http://myservice.com/photos/123
which returns a JSON

```<code>{"name": "At_The_Concert", "id": "123", "src": "http://myservice.com/photostore/123.jpg"}
</code>```

The client (Ajax, Mobile device, etc.) of this service wants to know what the “next” item is going to be. I’m struggling about what the url should be.

http://myservice.com/photos/123/next

http://myservice.com/photos/next/123

http://myservice.com/nextphotos/123

or maybe the id property should just be a parameter

http://myservice.com/photos/next?photoId=123

Or maybe this is entirely wrong and it should be like

http://myservice.com/photos/?method=getNextPhoto&photoId=123

though with .Net's routing, it might be easier to write it as
http://myservice.com/photos/method/getNextPhoto?photoId=123

I’m relatively new to web services and REST. I get the basic CRUD for REST, but I don’t know what is the best practice for creating more custom urls, in this case the “next” photo.
Is there an accepted RESTful practice?


答:
To understand why the textarea is a unique tag compared to the other input fields you would have needed to be in the original message chains between Conolly and Berners-Lee in the years leading up to the release of the HTML 2.0 standard that came out in 1995.  Why it is not a standard input tag like everything else may have been because of a technical difficulty at the time or some general compromise that they had agreed upon.

For the original HTML 2.0 specification on HTML Forms see here: https://www.rfc-editor.org/rfc/rfc1866#section-8

At one point someone had found the original AOL message boards and posted them publicly where they were going back and forth discussing the various prototypes that led up to HTML as we know it today.  It was intensely interesting but I can't seem to find it anymore.

Title: Why does HTML TextArea have its own HTML tag?

Body:
```<code><input id='input1' type='text'></input>
<input id='input2' type='button'></input>
<input id='input3' type='checkbox'><input>
<textarea id='myTextArea'></textarea>
</code>```

In HTML markup, most places where the user can interact with the page are denoted with the <input> tag.  Why is it that textarea has its own tag, <textarea> as opposed so, say, <input type='textarea'>


答:
Check out ditz.

It's a very simple command-line-driven issue tracking tool whose database you can store in your code repository.

There are no fancy UIs, only a simple command-line tool. It's similar in spirit to @jrg's suggestion and the TODO.txt tool.

Title: Simple issue tracker for 1-2 developers


问:
Graduate expectations versus reality
When choosing what we want to study, and do with our careers and lives, we all have some expectations of what it is going to be like. Now that I've been in the industry for almost a decade, I've been reflecting a bit on what I thought (back when I was studying Computer Science) programming working life was going to be like, and how it's actually turning out to be.

My two biggest shocks (or should I say, broken expectations) by far are the sheer amount of maintenance work involved in software, and the overall lack of professionalism:

Maintenance: At uni, we were all told that the majority of software work is maintenance of existing systems. So I knew to expect this in the abstract. But I never imagined exactly how overwhelming this would turn out to be. Perhaps it's something I mentally glazed over, and hoped I'd be building cool new stuff from scratch a lot more. But it really is the case that most jobs are overwhelmingly maintenance, bug fixing, and support oriented.

Lack of professionalism: At uni, I always had the impression that commercial software work is very process-oriented and stringently engineered. I had images of ISO processes, reams of technical documentation, every feature and bug being strictly documented, and a generally professional environment. It came as a huge shock to realise that most software companies operate no differently to a team of students working on a large semester-long project. And I've worked in both the small agile hack shop, and the medium sized corporate enterprise. While I wouldn't say that it's always been outright "unprofessional", it definitely feels like the software industry (on the whole) is far from the strong engineering discipline that I expected it to be.

Has anyone else had similar experiences to this? What are the ways in which your expectations of what our profession would be like were different to the reality?

答:
I have heard it argued that all software engineering after the first line of code is maintainance. And that certainly seems to match my experience. The only code I have written that did not end up having most of its cost being maintaince was code that was so unsuccesful that it was never or only briefly used.

I think you can find disiplined engineering teams that develop and follow strong processes that lead to the release of robust code which the team can have a high level of confidence in (although I wouldn't convolute that with large amounts of documentation). I believe that I work in a team like that at the moment. Although I have certainly experienced the other kind of development.

The thing that I have come to appreciate though, is that the challenge is not always finding the perfect algorithm or the cleanest solution to the problem. But often trading off all sorts of constraints (resources, knowledge, money, time, skills, risk, pre-existing user training etc, etc) to achive the highest return for the available investment. That is building a system that is best suited to all those factors and not just the technical influences.

Title: Graduate expectations versus reality


问:
How to Write Unit Tests When One Fix Will Make Many Failing Tests Pass?
I have two test cases to test a fix to code that is using the wrong criteria for selecting objects from a collection:

Given one object in the collection matching the bad criteria, ensure that no object is returned.

Given two objects in the collection, with the later one matching the bad criteria, ensure that the earlier object is retrned.

Right now, both of these tests will fail.

The problem is, as soon as I make the fix, both tests will pass.

Is this ok? I thought we needed a single failing unit test before writing the code. I haven't heard it's ok to have multiple failing unit tests before writing code.

答: No, the point of the test suite is that (as far as you are able) it covers every conceivable thing that code changes might break. It isn't that important whether one or two tests fail - the point is, the change broke something, and it can't be allowed in before it passes all tests. There is absolutely no point going to contortions and trying to make the correction in two separate steps, just to fix exactly one test per commit - it's just extra effort, and I dare anyone to explain to me what it buys you.


答:
There is no rule that says you should make only a single test pass at a time.

Usually you don't write too many tests before any code, but you can.

Think of them as your specification.

Here are really great video tutorials on TDD:

Funq: screencast series on how to build a DI container using TDD

Title: How to Write Unit Tests When One Fix Will Make Many Failing Tests Pass?

Body:
I have two test cases to test a fix to code that is using the wrong criteria for selecting objects from a collection:

Given one object in the collection matching the bad criteria, ensure that no object is returned.

Given two objects in the collection, with the later one matching the bad criteria, ensure that the earlier object is retrned.

Right now, both of these tests will fail.

The problem is, as soon as I make the fix, both tests will pass.

Is this ok? I thought we needed a single failing unit test before writing the code. I haven't heard it's ok to have multiple failing unit tests before writing code.


答:
I thought we needed a single failing unit test before writing the
  code. I haven't heard it's ok to have multiple failing unit tests
  before writing code.

That's for writing new features, not for fixing bugs, and only if you want to practice ultra-orthodox TDD.

Secondly, an ideal test suite would be one where any bug causes exactly one test to fail, because that makes it easiest to pinpoint where the bug occurs. But this is an ideal that one can aspire to but hardly ever reach, and that's OK. Try to make your unit tests orthogonal if possible, but don't worry if you can't do it all the time.


答: If i were you i would make my knowledge known threw my work, you say you program in c so start making programs that's geared towards the everyday users Pc experience, make things like  youtube downloader and start your own dev team hey man im only 19 and i started programming 4 years ago and get this im a young black guy from the hood.... so i could understand the passion you may have for programming but at the same time programming could take alot of your time, and effort, give yourself time  to live... meaning all that time siting at a computer can be stressful on a young boy.


答:
basecamp.com - one project is free, the interface is very simple, and you can be up and running in about two minutes with nothing to install

now get back to work ;-)

Title: Simple issue tracker for 1-2 developers


答:
One answer I didn't read yet: Google Summer of Code.

From the website:

Google Summer of Code is a global program that offers student developers stipends to write code for various open source software projects. [...] Through Google Summer of Code, accepted student applicants are paired with a mentor or mentors from the participating projects, thus gaining exposure to real-world software development scenarios.

You have to be 18 to participate, but that isn't far off. I know some people who participated and had a great experience. Because all your contributions are to open-source programs, they are public, so they'll be noticed.

Since you are under 18, Google also has a GSOC-like program for pre-university students (13-17 year olds) called Google Code IN.


答: There are tons of places to put your work up to get recognized, but while you may consider your work top notch, it may just be a simple day at work for some. When I was 16, I thought my work was awesome, I was doing some cool stuff, but I am actually working in these fields now, and where I was then is nothing compared to where I am now, and I still am a long ways off from where I want to be.</p>


答:
Have a look at Asana.  It's a simple, free web-based project tracking tool.  I've been using it for projects and tasks at home.  You can create multiple projects, and assign them tasks.  For any given task, you can set:

Person assigned to

Due date

Any number of text tags

Attached files

Changes

Notes (one note field per task)

Comments (any number per task, chronologically arranged)

You can prioritize items with something called "priority headers".  You can also schedule items as "today", "upcoming", or "later" to get a basic idea of what needs to be worked on soonest.

It's still a work in progress, but it's got a very slick interface and it's easy to use.

Title: Simple issue tracker for 1-2 developers


答:
From my point of view, there are types of people who program.

"Programmers" - These include 16 year old self taught and 99% of the available "software developer" work force in china. They can get the job done... sort of.. in a minimal sense, but have little ideas of concepts such as design patters, maintainability, robust/defensive coding, algorithms/data-structures and other things that like efficient use of source control software. They have the ability to effectively read documentation and use most APIs.

"Average Electrical Engineer" - 80% Electrical, 10% computer science, 10% software engineer.
Proficiency with electronics, but just about as much programming as the typical "programmer". Logic and critical thinking, and management skills from the electrical side will help though.

"Average Computer science BS graduate" - 25% programmer, 25% software engineer, 25% computer scientist, 25% applied electronics (logic included).

"Average Computer Engineer" - These people are a mix of 50% electrical engineer, 50% computer science graduate.

Definitions:

"Computer Science" - Dijkstra once stated: "Computer Science is no more about computers than astronomy is about telescopes." Computer Science is more about math than it is about computers. This includes the ability to develop, understand, and classify complex algorithms and data structures.

"Software Engineering" - Design Pattern, diagrams representing programs (I can't remember what these are called). stuff like that. Defensive coding.. Source control use,

Notice, I used the word "Average" above. Depending on personal interests and job experience, these percentages can change drastically.
These are just over-generalized stereotypes. Don't judge a book by it's cover.
I am also just BSing percentages from my experience.


答:
I respectfully disagree with those who answered "don't overestimate yourself"!

If you have a love for programming at your age, go for it, you are probably great and greater than other kids your age, and by the time you are a veteran, you might be the next Brian Kernighan, Edsger Dijkstra or Doug Lea!

I would suggest learn IPhone or Android development, and build some real apps.

Get great at something and while you are getting there, speak at conferences and write articles, that will get you noticed, and will polish your skills.

I have been programming since the late 70's, and in Java since 1996. I can tell you the most important Java book I ever read was the Gang of Four Design Patterns, which was written a decade before Java was invented. Read it and be great!

The highest paying industry today is financial, but that is changing rapidly. I believe it will come back, but you never know!

Be a programmer and enjoy high employment and job satisfaction!

Good luck, you have a great career ahead of you!


问:
Struggling as a programmer. Need some advice
I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done".

But, there is a difference between "getting the job done" and "doing the job properly". Let's use an example.

Recently I developed a web site from scratch. The website runs fine and I've had no issues. Looking through the code I thought to myself that I could have done it better. I could have cut down on my MySQL queries. I could have used MVC making it easier to extend (it does need extending now).

I decided to rewrite the project using CodeIgniter. I like the framework. But I then got sidetracked because to cut down on my MySQL queries I had to learn advanced joins.

And this is the problem. Whenever I do a job properly I'm in a constant learning wheel. And topics such as advanced MySQL joins take time to learn, and then time to implement.

I don't work for a company. I do everything alone. So I'd imagine if I was working as a PHP developer for a company there would be separate teams handling the SQL.

Being solo it's difficult. And sometimes, although my knowledge is advanced I find myself asking question, after question. I probably have a lot of pride in my work. But if I had to work for a company handling complete projects I could imagine projects taking a while because I'd have to learn more and more to satisfy my pride and to ensure I'm doing things "correctly".

I do plan on getting a job after the new year. I need the job security. Which is why I'm asking this question.

What advice can you give in terms of self development and self improvement? Should I worry less? Or maybe look for a job as a PHP developer when I won't be handling SQL queries directly?

答: Advice: Don't be afraid of learning new things - you made a good First Step in acknowledging that you could do better and then made the effort to learn how you could do better. Yes, it takes more time up front, but the payoff is usually worth it in the long run. Now that you know CodeIgniter, you can use it for the next future project(s). You can put it on your resume. Now that you know advanced SQL techniques, your future projects will benefit. If you stop learning, you'll stagnate.


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

Form1:

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

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

Form2:

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

        public SettingsForm()
        {
            InitializeComponent();
        }

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

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

It's neither scalable nor OOP-like.

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

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

Now I'm left with some questions:

What are the implications of the procedure I used?

Why isn't it an object-oriented approach?

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

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

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

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

答:
To answer each of your questions:

What are the implications of the procedure I used?

In this instance, you are passing a reference from a parent object (the Main form) to the child object (the Settings form).  The result of this is that the Settings form must know a lot of things about the Main form in order to work properly.  Some not-so-desirable implications:

The Settings form must know the names of all the controls in the Main form in order to work properly.

You have to make a lot of things in the Main form public.  Making things public isn't a mortal sin by any stretch, however now your Main form is advertising a lot of functionality that it doesn't need to advertise to the outside world.  This is more of an issue when your project grows, or if you work with more than one developer, who will be poking around the public members of your objects to figure out how to work with your code from the outside.

Down the road, if for some reason the main form and the settings form were in two different assemblies (DLL files), you might run into trouble because you cannot create circular references.

Why isn't it an object-oriented approach?

Well, what you are doing is object-oriented, however because you have a child object depending on a parent object, you are going against the Dependency Inversion Principle and are thus causing tight coupling between objects.

When people on SO and other sites talk about how "object oriented" something is, they often are referring to S.O.L.I.D., which are five key principles of object oriented design.

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

I think in this instance the easiest way to accomplish this would be to create properties in your Settings form that represent the values that are modified within the settings window.

For example, this code would be in your Settings form:

```<code>public string UserName
{
   get { return txtUserName.Text; }
   set { txtuserName.Text = value; }
}
</code>```

And this code would be in your Main Form:

```<code>private void settingsToolStripButton_Click(object sender, EventArgs e)
{
    settingsForm = new miniDldMngr.SettingsForm() { UserName = lblUserName.Text };
    settingsForm.ShowDialog();
    lblUserName.Text = settingsForm.UserName;
}
</code>```

It is slightly more code, but now you are free to make as many changes as you want to the main form, and the settingsform won't need to be updated.

There are of course many other approaches you can take, which leads me to your last two questions:

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

Creating and raising an event is another way to avoid tight coupling between two classes.  Notice how the Windows Forms objects, such as ToolStrip are able to call methods in your code (settingsToolStripButton_Click), even though the Windows Forms code is not linked to your code.  That is the beauty of events.  My opinion is that it is overkill in this situation, since you are showing the form as a Dialog (where you can just read all of the values after the dialog closes), but nonetheless here is an example:

First, you would have code like this in your SettingsForm:

```<code>public string UserName
{
   get { return txtUserName.Text; }
   set { txtuserName.Text = value; }
}

public event EventHandler UserNameChanged;
protected void OnUserNameChanged(EventArgs e)
{
   if(UserNameChanged != null)
   {
       UserNameChanged(this, e);
   }
}

private void txtUserName_TextChanged(object sender, EventArgs e)
{
    OnUserNameChanged(EventArgs.Empty);
}
</code>```

Then, you would have code similar to this in your MainForm:

```<code>private void settingsToolStripButton_Click(object sender, EventArgs e)
{
    settingsForm = new miniDldMngr.SettingsForm() { UserName = lblUserName.Text };
    settingsForm.ShowDialog();

    lblUserName.UserNameChanged +=
        (sender, args) => lblUserName.Text = settingsForm.UserName;
}
</code>```

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

The MVVM pattern is a pattern championed by Microsoft, primarily for use in WPF.  You can read a nice description here:

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

You can use this pattern in Windows Forms, however I wouldn't recommend it, as WPF has more of the basic plumbing complete in order to actually make it work.

Happy coding!

Title: Implications of handles between forms

Body:
To answer each of your questions:

What are the implications of the procedure I used?

In this instance, you are passing a reference from a parent object (the Main form) to the child object (the Settings form).  The result of this is that the Settings form must know a lot of things about the Main form in order to work properly.  Some not-so-desirable implications:

The Settings form must know the names of all the controls in the Main form in order to work properly.

You have to make a lot of things in the Main form public.  Making things public isn't a mortal sin by any stretch, however now your Main form is advertising a lot of functionality that it doesn't need to advertise to the outside world.  This is more of an issue when your project grows, or if you work with more than one developer, who will be poking around the public members of your objects to figure out how to work with your code from the outside.

Down the road, if for some reason the main form and the settings form were in two different assemblies (DLL files), you might run into trouble because you cannot create circular references.

Why isn't it an object-oriented approach?

Well, what you are doing is object-oriented, however because you have a child object depending on a parent object, you are going against the Dependency Inversion Principle and are thus causing tight coupling between objects.

When people on SO and other sites talk about how "object oriented" something is, they often are referring to S.O.L.I.D., which are five key principles of object oriented design.

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

I think in this instance the easiest way to accomplish this would be to create properties in your Settings form that represent the values that are modified within the settings window.

For example, this code would be in your Settings form:

public string UserName
{
   get { return txtUserName.Text; }
   set { txtuserName.Text = value; }
}

And this code would be in your Main Form:

private void settingsToolStripButton_Click(object sender, EventArgs e)
{
    settingsForm = new miniDldMngr.SettingsForm() { UserName = lblUserName.Text };
    settingsForm.ShowDialog();
    lblUserName.Text = settingsForm.UserName;
}

It is slightly more code, but now you are free to make as many changes as you want to the main form, and the settingsform won't need to be updated.

There are of course many other approaches you can take, which leads me to your last two questions:

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

Creating and raising an event is another way to avoid tight coupling between two classes.  Notice how the Windows Forms objects, such as ToolStrip are able to call methods in your code (settingsToolStripButton_Click), even though the Windows Forms code is not linked to your code.  That is the beauty of events.  My opinion is that it is overkill in this situation, since you are showing the form as a Dialog (where you can just read all of the values after the dialog closes), but nonetheless here is an example:

First, you would have code like this in your SettingsForm:

public string UserName
{
   get { return txtUserName.Text; }
   set { txtuserName.Text = value; }
}

public event EventHandler UserNameChanged;
protected void OnUserNameChanged(EventArgs e)
{
   if(UserNameChanged != null)
   {
       UserNameChanged(this, e);
   }
}

private void txtUserName_TextChanged(object sender, EventArgs e)
{
    OnUserNameChanged(EventArgs.Empty);
}

Then, you would have code similar to this in your MainForm:

private void settingsToolStripButton_Click(object sender, EventArgs e)
{
    settingsForm = new miniDldMngr.SettingsForm() { UserName = lblUserName.Text };
    settingsForm.ShowDialog();

    lblUserName.UserNameChanged +=
        (sender, args) => lblUserName.Text = settingsForm.UserName;
}

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

The MVVM pattern is a pattern championed by Microsoft, primarily for use in WPF.  You can read a nice description here:

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

You can use this pattern in Windows Forms, however I wouldn't recommend it, as WPF has more of the basic plumbing complete in order to actually make it work.

Happy coding!


答: What you are going through sounds quite normal to me.  This is how we work on our craft and get better and better at what we do.</p>

Title: Struggling as a programmer. Need some advice

Body:
I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done".

But, there is a difference between "getting the job done" and "doing the job properly". Let's use an example.

Recently I developed a web site from scratch. The website runs fine and I've had no issues. Looking through the code I thought to myself that I could have done it better. I could have cut down on my MySQL queries. I could have used MVC making it easier to extend (it does need extending now).

I decided to rewrite the project using CodeIgniter. I like the framework. But I then got sidetracked because to cut down on my MySQL queries I had to learn advanced joins.

And this is the problem. Whenever I do a job properly I'm in a constant learning wheel. And topics such as advanced MySQL joins take time to learn, and then time to implement.

I don't work for a company. I do everything alone. So I'd imagine if I was working as a PHP developer for a company there would be separate teams handling the SQL.

Being solo it's difficult. And sometimes, although my knowledge is advanced I find myself asking question, after question. I probably have a lot of pride in my work. But if I had to work for a company handling complete projects I could imagine projects taking a while because I'd have to learn more and more to satisfy my pride and to ensure I'm doing things "correctly".

I do plan on getting a job after the new year. I need the job security. Which is why I'm asking this question.

What advice can you give in terms of self development and self improvement? Should I worry less? Or maybe look for a job as a PHP developer when I won't be handling SQL queries directly?


问:
What is the best IDE for Scala?
I tried programming Scala in Netbeans and Eclipse, but it is not what I'm looking for. In Netbeans suggestions for method names etc. are not working. In Eclipse I can't go to some classes sources by pressing F3. (e.g. scala List).

Is support in IntelliJ IDEA any better? Are there other IDE's supporting Scala?

答:
Emacs ENSIME

Emacs ENSIME is currently the most feature-rich development environment available for Scala.
(Watch this sneak-peak video on YouTube.)

Title: What is the best IDE for Scala?


答:
I have a slightly different viewpoint here.

If you want to get your software noticed, the best way is to have people using it. Although Bill Gates and Mark Zuckerberg were great young programmers, there were lots of better programmers. But these two gentlemen got lots of people to use their products and are therefore better known for their work.

To get people to use your code you could:

Sell your product to lots of people. For example put up a mobile app at an app store and track downloads, purchases and continuing usage.

Get lots of people to use your product, and make advertising revenue.

Get lots of developers to develop products which work with your product. This is hard.

Contribute to a popular open-source project so that your contributions will be used by lots of people.

In my opinion, software is almost irrelevant without providing benefit to users. And you will get noticed for solving problems which people care about, and that is a very rare skill.


答:
I think your concerns are valid, but you shouldn't loose any sleep over it. It's my belief that a being a technologist comes with the following baggage:

You must constantly learn new things. You either learn to love this, or you don't.

There's way more things that you will want to master than one could possibly ever know.

You will develop skills during a project that you wish you had during the project.

As a result, you will always want to go back and redo that project. It's so hard to release something you know could be better.

In the end, it sounds you care about building quality software, which is something that you can't learn. Know that you need to differentiate building a high quality solution with building something that is perfect. It sounds like you're like me, and will never feel like it's perfect. It would be more concerning if you didn't feel like you had a chance to improve yourself and your work.

It's tough to be a jack of all trades (master of none), but you really need to figure out how to identify the things that are most interesting and useful to you, and focus on them. Figure out how best to "outsource" other work to other people or tools.


答:
To be a professional in this field is to constantly smash yourself up against your own inadequacy. Do that 8-5 Monday through Friday, maybe more if there's a deadline coming up, have a nice weekend, and come back in for more on Monday. That's the job.

Making software requires a certain humility. If you're somebody who has to be right, and who has to prove that they already knew everything, this may not be the field for you.

I can't fathom not learning something every single day. I don't think I'd want that job.


答:
But, there is a difference between "getting the job done" and "doing
  the job properly".

No, there isn't, and I think thats the root of your problem here.  It seems to me you're too hung up on worrying about doing things 'correctly' because as an individual developer you arent seeing how others operate.  But correctly according to who?  Who is this magical person who gets to decree that what you are doing is 'correct'?  Take 100 of the worlds best programmers, and I guarantee no two will agree 100% on every programming topic.

Ultimately what matters is if your customers are happy.  If the programs you create are solving the problems they are supposed to, and doing it in a cost-effective way, you are doing it correctly.  It is not more inherently correct, for example, to use codeigniter than to use your own framework.  The corollary to that is if you produce a pile of crap, you are doing it 'wrong' regardless of the processes or 'best practices' followed.

That you are revisiting your code and seeing ways to improve it is a normal part of the development process.  It is not a sign that you arent doing things 'correctly'.  Its a sign that you are dedicated to learning and improving.  From everything I see in your post, you have no problem.

Now go kick some * * *


答:
...I decided to rewrite the project using CodeIgniter. I like the framework. But I then got sidetracked because to cut down on my MySQL queries I had to learn advanced joins.

And this is the problem. Whenever I do a job properly I'm in a constant learning wheel. And topics such as advanced MySQL joins take time to learn, and then time to implement...

Well given above I think it makes sense for you to focus on improving your ability to plan ahead, establish and prioritize work queue, manage your time - stuff like that.

Really, this seems to be the only thing missing in your attitude. What you call "sidetracking" is essentially another piece of work ("learn advanced joins") that has to be planned, prioritized and put into queue.


答:
The simplest bug tracker out there is a stack of 3x5 index cards (or 4x6 if you've got big handwriting), a box of push pins and your cubical wall, IMO.  If you don't have a distributed team (you don't since you're working alone), this is fine.  Keep in mind that you want to have the lowest impedance possible with a bug tracker - if it's hard to write up a bug or jot down an idea for an improvement, you're not going to do it.  When something is done, it comes off the wall and goes into a done pile.

Granted this fails the integration with Eclipse point, but for a solo developer, do you really need it?  If your adviser isn't going to be fixing bugs, then they don't need access to the cards (or they can stop by and take a look).  If they are writing up acceptance tests, you can jot down the gist of those tests on the card that it is applicable to.

I'd be interested to figure out what's driving you to look at a tool.  Do you need some sort of bug metrics (average time open, total open vs. closed, etc)?  Why is the integration into Eclipse important?

Title: Simple issue tracker for 1-2 developers