问:
How many developers before continuous integration becomes effective for us?
There is an overhead associated with continuous integration, e.g., set up, re-training, awareness activities, stoppage to fix "bugs" that turn out to be data issues, enforced separation of concerns programming styles, etc.

At what point does continuous integration pay for itself?

EDIT: These were my findings

The set-up was CruiseControl.Net with Nant, reading from VSS or TFS.

Here are a few reasons for failure, which have nothing to do with the setup:

Cost of investigation: The time spent investigating whether a red light is due a genuine logical inconsistency in the code, data quality, or another source such as an infrastructure problem (e.g., a network issue, a timeout reading from source control, third party server is down, etc., etc.)

Political costs over infrastructure: I considered performing an "infrastructure" check for each method in the test run. I had no solution to the timeout except to replace the build server. Red tape got in the way and there was no server replacement.

Cost of fixing unit tests: A red light due to a data quality issue could be an indicator of a badly written unit test. So, data dependent unit tests were re-written to reduce the likelihood of a red light due to bad data. In many cases, necessary data was inserted into the test environment to be able to accurately run its unit tests. It makes sense to say that by making the data more robust then the test becomes more robust if it is dependent on this data. Of course, this worked well!

Cost of coverage, i.e., writing unit tests for already existing code: There was the problem of unit test coverage. There were thousands of methods that had no unit tests. So, a sizeable amount of man days would be needed to create those. As this would be too difficult to provide a business case, it was decided that unit tests would be used for any new public method going forward. Those that did not have a unit test were termed 'potentially infra red'. An intestesting point here is that static methods were a moot point in how it would be possible to uniquely determine how a specific static method had failed.

Cost of bespoke releases: Nant scripts only go so far. They are not that useful for, say, CMS dependent builds for EPiServer, CMS, or any UI oriented database deployment.

These are the types of issues that occured on the build server for hourly test runs and overnight QA builds. I entertain that these to be unnecessary as a build master can perform these tasks manually at the time of release, esp., with a one man band and a small build. So, single step builds have not justified use of CI in my experience. What about the more complex, multistep builds? These can be a pain to build, especially without a Nant script. So, even having created one, these were no more successful. The costs of fixing the red light issues outweighed the benefits. Eventually, developers lost interest and questioned the validity of the red light.

Having given it a fair try, I believe that CI is expensive and there is a lot of working around the edges instead of just getting the job done. It's more cost effective to employ experienced developers who do not make a mess of large projects than introduce and maintain an alarm system.

This is the case even if those developers leave. It doesn't matter if a good developer leaves because processes that he follows would ensure that he writes requirement specs, design specs, sticks to the coding guidelines, and comments his code so that it is readable. All this is reviewed. If this is not happening then his team leader is not doing his job, which should be picked up by his manager and so on.

For CI to work, it is not enough to just write unit tests, attempt to maintain full coverage, and ensure a working infrastructure for sizable systems.

The bottom line: One might question whether fixing as many bugs before release is even desirable from a business prespective. CI involves a lot of work to capture a handful of bugs that the customer could identify in UAT or the company could get paid for fixing as part of a client service agreement when the warranty period expires anyway.

答: One. Yes, one is enough to start using continuous integration.</p>


问:
Is musical notation Turing-Complete?
I'm wondering, is music notation language Turing-Complete?

My first thought is that there are loops in musical notation, but there is no way to write conditional branches, right?

I'm not a musician, so perhaps someone can help fill in the gaps?

答:
Yes, if you admit a few instructions for transposition—uncommon but not unknown.

You can then interpret a piece as Choon, which is Turing-complete. The performer is the memory: they must remember the number of notes by which the piece is currently transposed, and all of the notes they have played thus far. Obviously it’s feasible only for a computer, or perhaps a savant.

From the Choon manual:

Transpositions

There are three transposition instructions, up (+), down (-) and cancel (.). A transposition instruction transposes all subsequent notes played by the amount of the last note played. The cancel instruction (.) sets the transposition back to zero.

Transpositions are cumulative, so the Choon code to transpose future notes up by 2 is b+, and by 4 would be b++. Also, the value used is the value of the previous note after transpositions have been applied, so b+b+ transposes future notes up by 6, not by 4.

John Cage

The John Cage instruction (%) causes a one note silence in the output stream. The transposition value of a John Cage is zero - %- and %+ are no-ops (except that a single silence is added to the output).

Repeat Bars

The Repeat Bars instructions (||: and :||) enclose a loop. The loop will execute the number of times indicated by the most recent note played before the ||: was encountered. A zero or negative value will mean Choon will immediately jump to start playing from the matching :||. A John Cage means repeat forever - %||::|| is an infinite loop.

Tuning Fork

The Tuning Fork instruction ~ provides a way to break out of loops. If a tuning fork is encountered in a loop, and the last note played was a note of value A, then Choon will immediately jump to start playing from after the next :|| instruction. If there is no further :|| instruction (meaning ~ has been used outside any repeat bars), then the performance will immediately terminate.

Markers

Markers provide marvellous programming convenience. A marker is a lower case letter or word that remembers a point in the output stream. Referring to a marker (see below) will cause the note played after the Marker occurred to be played again. Note that transpositions will affect this newly played note.

Where two or more markers occur sequentially, or a marker follows a play-from-marker instruction, they must be seperated by whitespace.

Play From Output

The Play From Output instruction (=) allows you to play again notes that have already been played in the output stream. You can refer to the notes by number - the 5th note played since the program began would be =5, by relative number - the 3rd most recent note played would be =-3 or by marker - the note played after marker x would be =x.

It is a common idiom to re-use a marker and immediately then refer to it, like this: x=x. This is akin to saying x=x+y in a conventional programming language (where y represents the currently effective transposition value).

A John Cage is just a rest, a Tuning Fork is (roughly) dal segno, and a marker is a segno. I suppose the tuning fork could be played by an additional performer to whom the primary performer responds, but the principle is the same.

ContentLicense: CC BY-SA 3.0

Title: Is musical notation Turing-Complete?

ContentLicense: CC BY-SA 4.0


问:
(Why) Should I learn a new programming language?
I'm quite proficient with Java, C/C++, JavaScript/jQuery and decently good at Objective-C. I'm quite productive with the languages and their corresponding frameworks too and do produce enterprise level systems (and also small scale ones) with sufficient ease all the while keeping code 'clean' and maintainable (yes, I can read my own code after six months :)

Unless mandated by the platform (iPhone, iPad, etc.) or by the client/implementation organization, just "why" should I learn a new programming language? Just for "fun"? And do what with that fun if I'm not going to do anything worthwhile with it?

A lot of my peers are ready to dive in to learn the "next new thing/language" and it's usually Python, Ruby or PHP (just naming a few popular ones). Now, just knowing the language by itself is futile IMHO. You also need to know the frameworks, learn their usage/APIs as well as 'good implementation practices', etc.

So from an 'economic' sense, is there any benefit in learning a new programming language? If the language is learned in a quick and dirty fashion, it'll probably also be used for quick and dirty prototyping/implementation - but I don't see THAT as a justifiable investment of time/effort.

So just WHY should I (or anyone for that matter) learn a new programming language other than "it's fun so let's try it out" - if the investment of time may not be worth it in the long run?

答:
Alfred North Whitehead wrote a great essay called "The Importance of Good Notation"

It is interesting to note how important for the development of science
  a modest-looking symbol may be. It may stand for the emphatic
  presentation of an idea, often a very subtle idea, and by its
  existence make it easy to exhibit the relation of this idea to all the
  complex trains of ideas in which it occurs.

A programming language is a form of notation.  I can code OO in C; in fact that's how Stroustrup started with C++--as a series of C precompiler macros. However, it is far easier and quicker to write OO code in either Java, C++ or C# because they have language primitives present which support OO more easily.

All the reasons for learning new languages given so far are valid but I think the best reason to learn a new language is that a new notation may enable you to think in a new way which may help you to solve new problems.


答:
People learn new languages to...

expand their knowledge. If you know more you feel better and you're more confident.

                                      Confidence = Awesome Code!

have a bigger toolbox. Let's say you have to make an app. If you only know Java, you're going to make the program in Java. But if you know Java, Python, Scheme, and Lisp, chances are you're going to pick the best tool for the job.

get a job. Face it. If you know more languages, you have more job opportunities. That's pretty self-explanatory.

become a better all-around programmer. If you know the syntax of Perl, you know it can get a bit crazy. When writing long programs in Perl, you're basically forced to follow best practices, or you will not be a happy camper. Since you know Perl best-practices, this might help you write better PHP code (in one way or another).

So as you can see there are many reasons to learn a new language. My advice to you (and my only original quote that I think is good):

Write code frequently; Write code well; Write code in Scheme, PHP, Java, Python, Lisp, Perl, C, C++, C#, Visual Basic, Ruby...

Title: (Why) Should I learn a new programming language?

Body:
I'm quite proficient with Java, C/C++, JavaScript/jQuery and decently good at Objective-C. I'm quite productive with the languages and their corresponding frameworks too and do produce enterprise level systems (and also small scale ones) with sufficient ease all the while keeping code 'clean' and maintainable (yes, I can read my own code after six months :)

Unless mandated by the platform (iPhone, iPad, etc.) or by the client/implementation organization, just "why" should I learn a new programming language? Just for "fun"? And do what with that fun if I'm not going to do anything worthwhile with it?

A lot of my peers are ready to dive in to learn the "next new thing/language" and it's usually Python, Ruby or PHP (just naming a few popular ones). Now, just knowing the language by itself is futile IMHO. You also need to know the frameworks, learn their usage/APIs as well as 'good implementation practices', etc.

So from an 'economic' sense, is there any benefit in learning a new programming language? If the language is learned in a quick and dirty fashion, it'll probably also be used for quick and dirty prototyping/implementation - but I don't see THAT as a justifiable investment of time/effort.

So just WHY should I (or anyone for that matter) learn a new programming language other than "it's fun so let's try it out" - if the investment of time may not be worth it in the long run?


答:
In a word: Marketability.

You open up your employment prospects when you can display that you have the ability to adapt and learn new things.  Sure, you could keep writing applications using the one language you have become really proficient at, but what happens when you learn that your favorite language of choice becomes irrelevant for the industry that you have been working in.  I actually remember a time when we used to write our own web services from scratch in C or C++, nowadays we use tools that do all the underlying "webbiness" for us (Think Rails, etc...).

The point is, you end up like those actors who do a TV series, and then can't easily move onto anything else because they are forever seen as their original character.  "Who on Earth wants Captain Kirk to be Indiana Jones?!!".  The same with programmers who have only ever used the one product.  Sure, you'll know it like nobody else, but that won't help you when you're treated like you've been boxed up as a Fortran who cant move on to working with C#.

If you want to be able to move jobs easily and keep your options open, you need to broaden your experience.  Work on many different projects in many different languages, and preferably on at least 2 or more platforms, and keep yourself marketable for more than just being what you are today.

Of course, there are lots of other reasons to learn a new language, sometimes even just for the hell of it.  It opens your mind to other possibilities, so when your boss comes up to you and says "can we do something", you can say Yes with a choice of tools available to you.


问:
Problem and Requirements Definition
I was recently hired to redesign a management system from scratch. This is my first  business-scale project. I have assisted with business applications in the past, but I am the only one dedicated to redesigning and programming the system with the assistance of a company employee. This employee built the previous version of the management system.

We all agree that we want this done, and done right.  I am willing to put in the time upfront to define the problem and requirements so I do not have to reap bad seeds during testing.

At the moment, I am trying to capture the problem and gather the requirements for this management system. What questions should I ask this employee to be able to move forward with some documentation? I realize these requirements can change constantly, but I would like a starting point to work with.

Here are a few questions I have come up with:

What is the purpose of the management system?

  What is the problem we are trying to solve?

  What will be the features of this system?

  Who will be using the system? (Employees? Outside Entities?)

  What are the means of security for this system? (Can an outside entity see what an employee can see? etc.)

答:
As I have stated in my comment, requirements analysis and capturing has a wide scope. Many books are out there. The real problem, is that there is no agreed upon way to get it right for all projects. There are at least 2 major approaches, the water-fall method and the agile method. You got to pick one.

Here are 2 examples of books that you may want to consider:

Requirements Analysis: From Business Views to Architecture

Getting It Right: Business Requirement Analysis Tools and Techniques

During requirements analysis, you tend to use tools (not necessarily software packages) such as UML, Data Flow, Prototyping tools for front end design and such. I suggest you use UML if you are building an OO application. For UML, you need to know Class Diagrams and Use Case at a minimum. Whatever the tools and methods you use make sure you describe in your language the details. Diagrams alone are not always enough. Not all users like them and so they can't verify them.

It is important that you understand why the current system is not working, what it is good at and what it can't do. It is important to consider what is the customer expectation about migration of current data.

To be successful, make sure you structure your project plan around real tangible milestones/sub-projects. For example:

Project Step A - Requirements Analysis

A1- Current system analysis

A2- Capturing new system's requirements

A3- Analyzing external systems interfaces (may also be part of A1, A2)

A4- Identifying Data Gaps and Migration Needs

A5- Procedural requirements and data requirements for New system

A6- Release and sign-off final requirements documentation and models

Project Step B - Application Design

Bn- Application interface prototyping (some times this is included in the original requirements...)

Project Steps C,D,... - Other activities

The most important step is to ensure that the project scope is very well defined and to make your customer agree on the fact that the scope will not keep on changing during the project. It is also vital to know that requirements gathering is not about documentation or customer signing, it is about really understanding the business.

I hope this helps.

Title: Problem and Requirements Definition


问:
TRS-80 Color BASIC as an inspiration for a new programming language
For a time now I have been wanting to make my own programming language.

I'm 17 and the only language I know is Color BASIC. I know that compared to today's complicated languages, it's pretty weak.

But I was wondering if it would be hard to create a language that is kinda like color BASIC/BASIC and how would I start it?

What to do or what do I need to do to learn how to make my own programming language?

答:
I recommend that you learn Python, and do not try to write a compiler until your skill set includes C and C++.

Python is a modern language, easy to learn, and if you can do BASIC you can do PYTHON. It's easy.


问:
How serious is losing the source code?
If a software company loses the source code to one of the products they are selling, how serious would that be, in terms you could explain to a layman?  Would the term "gross negligence" be too strong?  Or "gross incompetence"?  Obviously no one got killed but isn't it as serious as some financial negligence that people get jail time for?

EDIT:
Let's say it's not a case of a disk drive crashing, natural disaster or anything like that.  Just they misplaced it.

答:
For a company this is like losing the crown jewels.  If it is a product with an embedded processor then they can continue to make the product "as is" but they lose the ability to improve it or to fix any problems.

In today's markets a company IS it's IP.  Lose that and it goes out of business.

ContentLicense: CC BY-SA 2.5

Title: How serious is losing the source code?


问:
How Would I Start With Prolog?
If I wanted to start learning Prolog on Windows, is there any package that would integrate Prolog into Visual Studio 2010?  That is, a compiler and templates and so forth for working with Prolog on Windows?

Assuming there is no flavor of Prolog targeting the .Net platform, is there a GCC Prolog compiler for Windows?

答: After using Google for two seconds, I found the Prolog.NET project. Have a look at that. There is also this question on Stack Overflow that points to this project.</p>

Title: How Would I Start With Prolog?


答:
Questions like this

What is the purpose of the management system?
What will be the features of this system?

Are too abstract.  They're very difficult to answer, even for IT professionals.

Questions like this

What are the means of security for this system? (Can an outside entity see what an employee can see? etc.)

Are too technical.  They're very difficult to answer, and should be left only to IT professionals.

Questions like this are practical and simple.

Who will be using the system? (Employees? Outside Entities?)

What is the problem we are trying to solve?

You'll find that this is the essence of user stories.  http://en.wikipedia.org/wiki/User_story

Stick to practical, simple, focused things that users actually know.  Avoid the big picture (it's too abstract).  Avoid implementation details (it's too technical).

Title: Problem and Requirements Definition

Body:
I was recently hired to redesign a management system from scratch. This is my first  business-scale project. I have assisted with business applications in the past, but I am the only one dedicated to redesigning and programming the system with the assistance of a company employee. This employee built the previous version of the management system.

We all agree that we want this done, and done right.  I am willing to put in the time upfront to define the problem and requirements so I do not have to reap bad seeds during testing.

At the moment, I am trying to capture the problem and gather the requirements for this management system. What questions should I ask this employee to be able to move forward with some documentation? I realize these requirements can change constantly, but I would like a starting point to work with.

Here are a few questions I have come up with:

What is the purpose of the management system?

  What is the problem we are trying to solve?

  What will be the features of this system?

  Who will be using the system? (Employees? Outside Entities?)

  What are the means of security for this system? (Can an outside entity see what an employee can see? etc.)


答:
There's an excellent Prolog environment for windows. It's called Ubuntu on VirtualBox. I decided to stop swimming upstream when I started learning Erlang and installed Ubuntu. It's been a pleasant journey of rediscovery for me. Linux has come a long way to simplify the process of getting up and running.

I'm assuming you're going through the 7 languages in 7 weeks. While you're at it spend the time to get comfortable with Linux and Virtualization. Both can become good friends.

Title: How Would I Start With Prolog?

Body:
If I wanted to start learning Prolog on Windows, is there any package that would integrate Prolog into Visual Studio 2010?  That is, a compiler and templates and so forth for working with Prolog on Windows?

Assuming there is no flavor of Prolog targeting the .Net platform, is there a GCC Prolog compiler for Windows?


答:
The value of learning a new programming language is, roughly, the reciprocal of the number of programming languages you already know.

This is because there are a finite number of paradigms and learning a new language will usually introduce you to at least one or two, making you more experienced and capable as a programmer. Some may turn your programming world upside-down. But when you learn a new language which features paradigms you already know, you already know them and you're used to them.


答:
As long as they're still able to sell the product, I don't think they're in trouble.  Now, if they're under contract to a client to extend the product and provide certain new features in the next version, that's a lot more serious because it's setting them up for breach of contract penalties.  But I don't think there's a legal problem with losing the code itself.

This doesn't mean that it isn't an absolute disaster for the company.  But it's a financial disaster; not a legal one.  I'd probably start with the term "gross incompetence" and work my way up from there.

Title: How serious is losing the source code?

Body:
If a software company loses the source code to one of the products they are selling, how serious would that be, in terms you could explain to a layman?  Would the term "gross negligence" be too strong?  Or "gross incompetence"?  Obviously no one got killed but isn't it as serious as some financial negligence that people get jail time for?

EDIT:
Let's say it's not a case of a disk drive crashing, natural disaster or anything like that.  Just they misplaced it.


问:
Use Theme/Skin or CSS in Asp.Net
I am working on a website which is using Skin templates everywhere in the page. Because of this all the controls, even labels, are server controls. I was wondering if it is worth changing at least labels to HTML controls and create CSS for them. Is there any advantage of using Skin over CSS?</p>

答:
I would stick with all CSS or all theme/skins. The reason is that when they are used together it's ambiguous which is actually going to be displayed to the user if both attempt to modify the same things. Also adding another language to work with for no real reason is a bad idea, it's unneeded complexity. There is not going to be any significant difference in performance between having HTML controls or server controls for labels, and there is no difference between having CSS that works or themes/skins that work.

remember KISS(keep it simple stupid) and "if it aint broke don't fix it", you are attempting to violate both.

OwnerDisplayName: Asdfg

Title: Use Theme/Skin or CSS in Asp.Net


问:
Are there any statistics that show the popularity of Git versus SVN?
I'm writing an essay, and would like to have some empiric evidence, perhaps longitudinal data where the popularity of these technologies is compared over a period of some years.

Are there any statistics that show the popularity of Git versus SVN?

答:
To add to Jan's answer, Ohloh has been crawled (only) three times by the Internet Archive's Wayback Machine, but July 2011 is unreadable, so that gives three data sets including today (plus future edits):

August 2010

Git: 26,485 repositories (11.3% of total)

SVN: 25,336 repositories (10.8% of total)

SvnSync: 117,326 repositories (50.0% of total)

Note: Unlike later dates, August 2010 has separate values for Subversion and SvnSync (a Subversion read-only mirroring tool). It's fair to surmise the later Subversion figures also include the large SvnSync share.

May 2011

Git: 116,224 repositories (35% of total)

SVN: 145,917 repositories (44% of total)

February 2012

Git: 124,000 repositories (26% of total)

SVN: 265,883 repositories (57% of total)

June 2012

Git: 134,459 repositories (27% of total)

SVN: 267,499 repositories (54% of total)

October 2013

Git: 238,648 repositories (38% of total)

SVN: 291,920 repositories (46% of total)

April 2014

Git: 247,103 repositories (37% of total)

SVN: 324,895 repositories (48% of total)

July 2016

Git: 274,605 repositories (39% of total)

SVN: 326,540 repositories (46% of total)

May 2018

Git: 397,653 repositories (51% of total)

SVN: 325,684 repositories (41% of total)

November 2018

Git: 600,724 repositories (61% of total)

SVN: 325,733 repositories (33% of total)

March 2019

Git: 842,966 repositories (69% of total)

SVN: 324,589 repositories (26% of total)

August 2019

Git: 913,378 repositories (70% of total)

SVN: 324,629 repositories (25% of total)

This appears to show that, of the open source repositories registered on Ohloh, there's been a huge growth in both Git and Subversion. Whereas they were about level in 2010, there were double the number of Subversion repositories in 2012  (...indexed by Ohloh), but Git has now easily taken the lead.


问:
Should QA find reproducible scenarios?
Sometimes my QA team reports bugs, but neither I or them have any idea on how to reproduce them. This leads to very long and frustrating debugging sessions which sometimes do not even yield results.

My software is tied heavily with proprietary hardware so bugs can come from many directions at once.

Should I expect more from them than "your software crashed when I pressed a button" or should I figure myself what happened?

EDIT:

One of my coworker pointed out that we are probably all developers here so the results might suffer a little bias

答:
A bug report should contain:

Steps to reproduce

Actual behaviour

Expected behaviour

E.g.:

I deleted all suppliers from the database (using DELETE * FROM tSuppliers), opened the supplier dialog, and clicked on the Supplier drop-down list.

The list contained the following message: GUPOS ERROR #0000000: SOMETHING WENT WRONG!. When I clicked on the message, the app disappeared from the screen, and the Task Manager.

I expected to see either an empty list or (preferably) a message such as "No suppliers found". Clicking on the empty list or the message should have no effect. The app obviously shouldn't disappear without warning under any circumstances.

So, yes - it should contains the steps to reproduce. The fact that they don't feel the need to include this would seem to indicate that they think their job is to "break the software", rather than to identify faults.

Title: Should QA find reproducible scenarios?


问:
Are testers considered low profile?
I happened to know some system admin and according to him, testing guys are not given preferences in an organization in comparison to developers. No doubt software releases are not possible without testers but I've never laid my hands on testing so not much aware of it. No offense intended. </p>

答: Yes. Like it or leave it they are equally important but are always less preferred. May be because they are easy to replace.</p>

Title: Are testers considered low profile?


答:
I agree with most of the answers posted already.  To append to these, check out the stats taken by the 2011 Stack Overflow User Survey.  There was a very high correlation between number of languages known and money earned.  They may not be directly tied to one another, but it is something to think about.

People who tend to learn more languages tend to make more money.

http://blog.stackoverflow.com/2012/02/survey-results/


问:
Networkx / Python : Is using a class for a node better practice than defining multiple attributes?
I've read through the NetworkX tutorial and documentation, but was unable to find real world answers for this question.

Usually when using NetworkX, I might use strings to define nodes, then set several attributes.

e.g.

```<code>G = nx.Graph()
G.add_node('John Doe', haircolor = 'brown')
G.node['John Doe'][age] = 22
</code>```

However, it seems like declaring a class with members instead of attributes is better in practice, especially when there are many attributes and readability might be an issue.

```<code>class Person:
     name = None
     age = None

Person p
p.name = 'John Doe'
p.age = 22
G.add_node(p)
</code>```

Could someone be kind enough to validate my reasoning?  I lack the foresight to see if Networkx node/edge attributes would be preferable.

答:
This doesn't answer your question.  However.  It seems necessary.

```<code>class Person:
     name = None
     age = None
</code>```

Doesn't do what you're suggesting.

Those are two class-level attributes.  They're emphatically not instance variables.

Also.  You don't "declare" attributes at all.  You don't declare them like that.

Person p isn't proper Python.

```<code>p= Person()
p.name = 'John Doe'
p.age = 22
</code>```

This emphatically does not set the class level attributes created as part of the class.  It creates additional instance-level attributes.

This may answer your question.

Networkx allows you to have any object associated with a node.

Feel free to do this

```<code>class Person( object ):
    def __init__( self, name, age ):
        self.name= name
        self.age= age

G.add_node('John Doe', data = Person( name='John Doe', age=22 ) )
</code>```

Now you have all of your node data in a single object associated with the 'data' attribute.

For trivial name-value kinds of things, this is not obviously creating any real value.

But, if you have some node-specific method (rare in graph problems, but possible) then you'd have method functions associated with a node.

In graph theory problems, many of the algorithms work on the graph -- as a whole -- and you'll rarely find a use for a class with method functions.

Since the change is a trivial piece of syntax, it's probably simpler to start with

```<code>    G.add_node('John Doe', age=22 )
</code>```

And migrate to

```<code>    G.add_node('John Doe', data = Person( name='John Doe', age=22 ) )
</code>```

when you absolutely need to.

Body:
This doesn't answer your question.  However.  It seems necessary.

class Person:
     name = None
     age = None

Doesn't do what you're suggesting.

Those are two class-level attributes.  They're emphatically not instance variables.

Also.  You don't "declare" attributes at all.  You don't declare them like that.

Person p isn't proper Python.

p= Person()
p.name = 'John Doe'
p.age = 22

This emphatically does not set the class level attributes created as part of the class.  It creates additional instance-level attributes.

This may answer your question.

Networkx allows you to have any object associated with a node.

Feel free to do this

class Person( object ):
    def __init__( self, name, age ):
        self.name= name
        self.age= age

G.add_node('John Doe', data = Person( name='John Doe', age=22 ) )

Now you have all of your node data in a single object associated with the 'data' attribute.

For trivial name-value kinds of things, this is not obviously creating any real value.

But, if you have some node-specific method (rare in graph problems, but possible) then you'd have method functions associated with a node.

In graph theory problems, many of the algorithms work on the graph -- as a whole -- and you'll rarely find a use for a class with method functions.

Since the change is a trivial piece of syntax, it's probably simpler to start with

    G.add_node('John Doe', age=22 )

And migrate to

    G.add_node('John Doe', data = Person( name='John Doe', age=22 ) )

when you absolutely need to.


答: To be honest, I think it depends on the language used. If you lose a C# codebase, it can be decompiled extremely easily, but if you lose a C++ codebase, that's far worse.</p>

Title: How serious is losing the source code?


问:
How to Determine Frequency (In Hertz, Real Time) with Java Sound
I've been looking around and I've found some questions similar to mine but have never been quite satisfied with the answers. I'm more or less a Java n00b, although I am moderately proficient with C++ and I would consider myself intermediate to advanced, as a programmer in general. I'm looking to write a program in Java that functions similarly to a tuner - what I want to do is record an instrument's pitch over about a 3 second time frame, and to measure the average deviation. (This is for a band class.)

What I'm thinking is that I'll have a big array of numbers, and each entry in the array will be a number in terms of frequency. I want to be able to loop through the array, and calculate the average Hertz for displaying it on screen or something. So what I want to do is have some way of "polling" (for lack of a better word) the microphone to see what frequency is being inputted right that instant.

Is there a simple way to accept audio input from a microphone in terms of Hertz? This will be in Java, under a Windows platform.

答:
it depends on what format you get your data, the most efficient way is direct PCM which is really just samples of the sound stream (and what you'll likely be getting from most mice API's).

To get frequencies from this you'll need to fourier transform the samples. This will result in a set of values (one for each frequency).


问:
Can I re-license Academic Free License code under 2-Clause BSD / ITC?
I want to fork a piece of code licensed under the Academic Free License. For the project, it would be preferable to re-license it under the ISC License or the 2-Clause BSD license, which are equivalent.

I understand that the AFL grants me things such as limitation of liability, but licensing consistency is much more important to the project, especially since we're talking about just 800 lines of code, a quarter of which I've modified in some way.

And it's very important for me to give these changes back to the community, given the fact that this is software relevant to security - I need the public scrutiny that I'll get by creating a public fork.

In short:

At the top of the file I want to say this, or something like it:

```<code># Licensed under the Academic Free License, version 3
# Copyright (C) 2009 Original Author

# Licensed under the ISC License
# Copyright (C) 2012 Stefano Palazzo
# Copyright (C) 2012 Company
</code>```

Am I allowed to do this?

My research so far indicates that it's not clear whether the AFL is GPL-Compatible, and I can't really understand any of the stuff concerning re-licensing to other permissive licenses. As a stop gap, I would also be okay with re-licensing under the GPL, however: I can find no consensus (though I can find disagreement) on whether this is allowed at all, and I don't want to risk it, of course.

Wikipedia: ISC License

Wikipedia: Academic Free License

答: Ask the original author for permission. Then anything is possible and allowed. </p>


问:
Open Source Licenses
I'm independently developing a physics-based game using HTML5 canvas and JavaScript; I've used no external code at all (including physics or game engines), and my code is about 5000 lines in length. The development is almost complete, and now I want to release it.

I am planning to release the game as a paid app on the Chrome, Android, and Apple app stores, but I also want to release the code under an open source license - one which allows free reading and gleaning of ideas from my code, but does not allow more than a couple lines to be copied. Basically I want people who know where to look and how to use to find free code, and the general public to buy it, while preventing piracy or the development of a near copy.

Is this possible with an open source license?

What license should I use?

答:
You are probably looking for a Creative Commons license.

Something like Creative Commons Attribution NonCommercial ShareAlike

OwnerDisplayName: mndoftea

Title: Open Source Licenses

OwnerDisplayName: Mimisbrunnr


问:
Sprint Backlog Task Estimates - What Are the Hours Made Of?
For the sprint backlog, I read that the stories are broken into tasks, and estimated.  Are these estimates typically development hours only, or development + QA?  What are these hours typically consisting of?

Thanks.

答:
The sprint backlog tasks to complete a user story should contain everything that required to complete the story. This may include:

Design

Technology selection

Studies for trying out different approaches

Implementation

Unit testing

QA

Bug fixing

Acceptance tests

Documentation

Legal

Finance

Of course, you'll never capture everything during planning (teams I've been on tend to miss between 20% and 30% of the hours required)... but that doesn't mean you shouldn't try!


答:
The AFL says:

1) Grant of Copyright License. Licensor grants You a worldwide,
  royalty-free, non-exclusive, sublicensable license, for the duration
  of the copyright, to do the following:

...

c) to distribute or
  communicate copies of the Original Work and Derivative Works to the
  public, under any license of your choice that does not contradict the
  terms and conditions, including Licensor's reserved rights and
  remedies, in this Academic Free License;

So as long as you choose a license that does exactly that, you're good.  Seriously, though, changing a fork to a different license can often upset the original authors, who usually choose a license for a reason.  One should generally honor their wishes.

Title: Can I re-license Academic Free License code under 2-Clause BSD / ITC?

Body:
I want to fork a piece of code licensed under the Academic Free License. For the project, it would be preferable to re-license it under the ISC License or the 2-Clause BSD license, which are equivalent.

I understand that the AFL grants me things such as limitation of liability, but licensing consistency is much more important to the project, especially since we're talking about just 800 lines of code, a quarter of which I've modified in some way.

And it's very important for me to give these changes back to the community, given the fact that this is software relevant to security - I need the public scrutiny that I'll get by creating a public fork.

In short:

At the top of the file I want to say this, or something like it:

```<code># Licensed under the Academic Free License, version 3
# Copyright (C) 2009 Original Author

# Licensed under the ISC License
# Copyright (C) 2012 Stefano Palazzo
# Copyright (C) 2012 Company
</code>```

Am I allowed to do this?

My research so far indicates that it's not clear whether the AFL is GPL-Compatible, and I can't really understand any of the stuff concerning re-licensing to other permissive licenses. As a stop gap, I would also be okay with re-licensing under the GPL, however: I can find no consensus (though I can find disagreement) on whether this is allowed at all, and I don't want to risk it, of course.

Wikipedia: ISC License

Wikipedia: Academic Free License


答:
If you mean should QA include the steps to reproduce the bug if they can, then the answer is yes.  If you mean should they only record bugs they are able to reproduce, then absolutely not.  Bugs are bugs, whether they only happen at midnight on a full moon, or every time you look at it.  Some bugs are non-deterministic (classic example is uninitialized variable, where the value picked up is semi-random), that doesn't mean they shouldn't be recorded, investigated, and if possible fixed.

Non reproducible bugs should generally have a low priority, but they should definitely be recorded.

Title: Should QA find reproducible scenarios?

Body:
Sometimes my QA team reports bugs, but neither I or them have any idea on how to reproduce them. This leads to very long and frustrating debugging sessions which sometimes do not even yield results.

My software is tied heavily with proprietary hardware so bugs can come from many directions at once.

Should I expect more from them than "your software crashed when I pressed a button" or should I figure myself what happened?

EDIT:

One of my coworker pointed out that we are probably all developers here so the results might suffer a little bias


答:
While there are certainly cases where it could be cataclysmic, I think there are plenty where it's not (at least from the perspective of the software company).

I think that there are far too many variables to give a blanket answer as to whether there are any legal repercussions, but a handful of questions to consider in determining that would include:

What's the nature of the program? If it's something they lost because apps like it are a dime a dozen and it's not important, so what? If it's the company's flagship commercial product, they've only really harmed themselves. If it's custom software they've been contracted to build, that's where it could get interesting, but they you have to ask ...

Who owned the copyright of the code? (If the customer holds the copyright, then their property has been arguably lost/destroyed)

Is the customer being actively harmed by the code's disappearance?

Were there contracts in place regarding future development that will be breached as a result of the code's disappearance?

How important is it to be able to recreate the existing software? If it's something like a shell script to do maintenance tasks, the software company eats the time it takes to make a new one that does the same things. If it's an office suite, dust off the resume.

And I'm sure there are plenty of other factors that ought to be considered. Feel free to add on.

Now, I did say "from the perspective of the software company." It may still be catastrophic in the mind of the customer because of plans they had for changes, enhancements, or whatnot. A contract for such things or ownership of the copyright notwithstanding, though, it may seriously anger the customer, but without any obligation on the part of the developer aside from doing what they can to maintain good customer relations.

Title: How serious is losing the source code?


问:
Assigning development work effectively to enable parallel development
I am currently doing my 1st accademic project where we have to work in groups of 4 to develop an application (java ...). Anyways, how might work be assigned so that there is less dependencies on each other and we can work separately instead of waiting on one another?

I suggested 1 person develop 1 layer: Model, View, Controller, Data Access. I am working on Data Access but I find I need Model classes: For example

My EventsDataAccess has a findEventByName(String name) that returns an Event, which is developed by another person. How should I proceed? Here Event is a very small class so it shouldn't take long, but suppose its big, it might be a long wait?

How is work usually split up for developers in a small to medium sized team? Its so much easier to work in say a very small familiar team with, say 2 persons only

答:
I applaud your use of MVC architecture. This makes it easy to assign each member of your group to develop a different layer of the application. You still need to all meet together to discuss what belongs in each layer, but it's a good start. Explicitly defining the interface (i.e. interaction) between the different layers will make everyone's individual development easier.

In order to collaborate effectively, make sure you are all using source control. I cannot stress this enough. This way you will all be able to see each other's work and be up-to-date on each other's changes.

As far as individual development goes, you could always fake the objects you aren't responsible for developing so that you don't get stuck waiting on someone else. Define a simple interface you can use temporarily or if you've already defined your interfaces (as mentioned earlier) you can use these instead. Your fake objects implement these interfaces in a simple way to give you something to work with without having to fully implement the real objects that are someone else's responsibility.

Good luck!


答:
My advice is to read those bugs and give them a good old think. If you can't figure out a potential cause, forget about them for now.

QA should document every issue they find, even if they have no idea how it happened. It's QA's job to try and reproduce issues, but realistically this won't always be possible. Sometimes it doesn't have anything to do with what they did in the last 10 minutes. Something got into an invalid state a day ago, and it just became apparent because of one of the last 10 steps.

With these "1 in 1000" bugs, QA should try to reproduce them for a bit. If they don't have success, they should document the bug, then try a little more.

The reason why they should get the bug entered fairly early on is that the programmer knows the code a lot better than QA, and might immediately know the problem. It could be the code they refactored. It could be that function they half implemented then forgot about. They may have no idea, but there's no sense in the tester wasting a few hours trying to reproduce a problem that's obvious to the person who coded it. The tester can always add more details to the bug later.

The bug should include as much info as possible. Whatever the tester can remember about the lead-up to the issue should be written down in painful detail. Any Crash logs, database snapshots, or relevant screenshots should be attached as well.

If the bug is never reproduced, great! It doesn't hurt having it in the database. If the program is released and a user reports a similar bug later, you can compare their experience to what's in the report and look for any similarities.

In my experience, the juiciest bugs aren't found from following test plans. Sometimes you have to let things stew for a few weeks in order to have the moon and stars align that cause a nasty bug. If QA can do some detective work and find some possible causes, give them a pat on the back. But sometimes, who knows what happened?

Title: Should QA find reproducible scenarios?


答:
As most of them written already, I have good working knowledge on C. Recently, I was working on some problem for which I needed to cross check the results; it was mathematical. So what is the fastest way to get the answer gave me a kick to check around faster programming language to be learned.

And I found out that bc, an arbitrary precision calculator language, the utility almost available on every Unix platform.

I didn't think of Python, Perl or anything, but I found out this solved my problems in a snap. I checked it out on the factorial(20000) that one of the friend suggested, and it gave results in a snap without any crash.

It is important only to a certain point that you need to know a new language which will ease your job/problem at present.

Definitely, if I write this in my resume I guess nobody cares, but from my perspective it solves my problem before I attack it in my favorite language, 'C'.

And also if there is a need to learn a new language you will get the opportunity with different problems and n number of solutions.


问:
Usefull skills from a computer science degree
I did my degree in physics and moved later into programming. I have two and a half years experience under my belt and like to think I write good code. I am, however, concerned that not doing a compsci degree has left holes in my knowledge. I would like to fill those up now since I know I want to be doing programming for the rest of my career.

What skills/techniques did you learn in your compsci degree that one wouldn't pick up from on-the-job programming?

答: I understand why you might feel this way. I'm sure you've learnt a lot on your own in the two and a half years that you've been working, but I am also of the opinion that a computer science degree proves beneficial in more ways than one. For starters, having a professional qualification, or in this case, a computer science degree, from an accredited institution goes a long way in securing better jobs in the future, but it also covers the finer nuances of the field that you might otherwise overlook or not find important. A computer science degree not only teaches you about the programming, databases and networks but it also teaches you about entrepreneurship and management principles. Nowadays, in fact, colleges have started providing programs to suit your interest and needs so you can choose the area of computer science you like best and focus on that.    </p>


问:
Optimization as a branch: is that a thing?
My company has highly optimized scientific application which has become so big and complicated that new versions are literally taking t = infinity to produce.  (E.G. I have an email which pre-announces a late 2007 release for something that has not been released yet.)  New feature requests from the scientific team to the development team  leads to a lot of arguing.  This got me to thinking..

The application should be clearly written with good design, clear names and lots of automated tests.  New features are added to this application.  Run and pass the tests.  Then this application is branched for optimization a.k.a. a release or production version.  Again, run and pass the tests.

Am I missing something?  Is this a 'thing'?  I guess my question is, if I bludgeon the VP of Product Development with this, would I be right (about the idea, not the bludgeoning)?

答:
It's rare that the cost of (extreme)optimization is cheaper than the cost of hardware. If you had a feature announced in 2007 (5 years ago), by Moores law, computer hardware is now at least 10 times more powerful than when the feature was announced. I suggest looking carefully at the reasons this extreme optimization is done, and ensure it's for valid reasons rather than "because we have to". Alternately, (More likely?) 'Optimization' is being used as an excuse for writing crappy unmaintainable code.

What you still have however, is maintaining the code base, so even if you decide to abandon all performance concerns, a problem still exists.... However, maintenance of large, ugly legacy code bases is a field with there are known techniques.

What are you missing - most legacy code bases were not written with testing in mind, and the cost of retrofitting it is extreme. There are a few good (recent) questions on this topic that you should read up on - at the end of the day you problem is the same as everyone else's who works with legacy code.

The idea of "branching" an optimized code base is excellent. When your boss sees how much small speed improvement costs in time (and therefore money), he'll either buy faster hardware, or get off you case to do it quicker and cheaper with less programmers (Because the speed improvement is cheaper than the faster hardware).


问:
Does giving a developer a slower development machine result in faster/more efficient code?
Suppose I give my developers a screaming fast machine.  WPF-based VS2010 loads very quickly.  The developer then creates a WPF or WPF/e application that runs fine on his box, but much slower in the real world.

This question has two parts...

1) If I give a developer a slower machine, does that mean that the resulting code may be faster or more efficient?

2) What can I do to give my developers a fast IDE experience, while giving 'typical' runtime experiences?

Update:

For the record, I'm preparing my even-handed response to management. This isn't my idea, and you folks are helping me correct the misguided requests of my client.  Thanks for giving me more ammunition, and references to where and when to approach this.  I've +1'ed valid use cases such as:

- specific server side programming optimizations

- test labs

- the possibly buying a better server instead of top of the line graphics cards

答:
The answer is (I'll be bold and say) always

NO.

Develop on the best you can get with your budget, and test on the min-max spec range of equipment you'll deploy to.

There's emulators, virtual machines, actual machines with testers that can all test performance to see if it's a factor.


问:
Should we use JavaScript and CGI variables to weed out bots from our visitor reports?
I am using ColdFusion 8 and jQuery 1.7.

** This is a programming question, because the solution I am questioning requires programming. It may not be the right solution to the problem, but if it is, then I need to figure out how to best program the concept. **

When a user comes to our site, we track their session by writing various CGI variables to a database using a CFC and stored procures. First we filter out non human traffic by keywords in the user agent such as "bot". Unfortunately a lot of bots and spammers mask their user agents. Later, we try to exclude from our visitor reports the bad bots and a few other known entities that are scraping pages and such. But this is a manual process.

We are considering using an additional/alternate method of tracking usage. Once the user's page loads, we will use JavaScript to send the CGI variables from the client back to our server and store them. Specifically, we'll write the server variables to JavaScript on each page and then have JavaScript send them right back to us. If a bot or user doesn't fully view the page or have JavaScript enabled, the usage won't be counted is a real user.

Correct me if I am wrong, but this is the same method that Google Analytics uses to track user behavior.

Our goal is to eliminate good and bad bots from being counted as visitors in our reports. Does using JavaScript on a page like this minimize bots being counted? Is there a gaping hole in this plan?

答:
I have implemented a few tracking features and took the following approach.  Use an image tag that renders a dynamic file image.  Make the image a dynamic call that you can then track using whatever mechanism your backend provides (ColdFusion in this case).  Again it's not perfect, but most bots don't download your images etc.

Your dynamic call just returns a 0 byte image.

You can then capture everything that is available normally in the request, including the refer which is the page your image is embedded on.  You can even put query parameters on the image tag if you want to capture additional information about where the image tag is listed.


答:
What you describe ...

allows free reading and gleaning of ideas from my code, but does not allow more than a couple lines to be copied. Basically I want people who know where to look and how to use to find free code, and the general public to buy it, while preventing piracy or the development of a near copy."

... does not qualify as "open source" according to the OSI definition, violating the "free distribution" clause.

So I think the answer to your question is that what you ask is not possible, but you could have a liberal commercial license. Check out Microsoft's Shared Source licensing as a model, specifically Microsoft Reference Source License (Ms-RSL).

Title: Open Source Licenses

Body:
I'm independently developing a physics-based game using HTML5 canvas and JavaScript; I've used no external code at all (including physics or game engines), and my code is about 5000 lines in length. The development is almost complete, and now I want to release it.

I am planning to release the game as a paid app on the Chrome, Android, and Apple app stores, but I also want to release the code under an open source license - one which allows free reading and gleaning of ideas from my code, but does not allow more than a couple lines to be copied. Basically I want people who know where to look and how to use to find free code, and the general public to buy it, while preventing piracy or the development of a near copy.

Is this possible with an open source license?

What license should I use?


问:
What data structure should I use for this caching strategy?
I am working on a .NET 4.0 application, that performs a rather expensive calculation on two doubles returning a double. This calculation is performed for each one of several thousand items. These calculations are performed in a Task on a threadpool thread.

Some preliminary tests have shown that the same calculations are performed over and over again, so I would like to cache n results. When the cache is full, I would like to throw out the least-oftenrecently used item. (Edit: I realized least-often doesn't make sense, because when the cache is full and I would replace a result with a newly calculated one, that one would be least often used and immediately replaced the next time a new result is calculated and added to the cache)

In order to implement this, I was thinking of using a Dictionary<Input, double> (where Input would be a mini-class storing the two input double values) to store the inputs and the cached results. However, I would also need to keep track of when a result was used the last time. For this I think I would need a second collection storing the information I would need to remove a result from the dictonary when the cache was getting full. I am concerned that constantly keeping this list sorted would negatively impact performance.

Is there a better (i.e. more performant) way to do this, or maybe even a common data structure that I am unaware of? What kinds of things should I be profiling/measuring to determine the optimality of my solution?

答: One thought is why only cache n results?  Even if n is 300,000 , you would only use 7.2MB of memory (plus whatever extra for the table structure).  That assumes three 64 bit doubles of course.  You could simply apply memoization to the complex calcuation routine itself if you are not worried about running out of memory space.</p>


答:
The user story is not so much divided into tasks as the tasks required to implement the user story are determined; and by "implement the user story" I mean bring the story to the point that the users accept that it has been implemented.

Tasks might include:

Create unit tests for the Foo widget

Create system and integration tests for the Foo widget

Code the Foo widget

Integrate the Foo widget into the Foobar system

Create the user documentation for the Foo widget

Do acceptance tests on the Foobar system

Deploy the Foobar system

etc.

Now, how much time will each of those tasks take?

Title: Sprint Backlog Task Estimates - What Are the Hours Made Of?

Body:
For the sprint backlog, I read that the stories are broken into tasks, and estimated.  Are these estimates typically development hours only, or development + QA?  What are these hours typically consisting of?

Thanks.


问:
How to lead a development project without technical expertise
I have been a hands-on developer for my entire career and love working with code.  I have always resented the team lead who has little or no expertise regarding a particular technology and yet insists on a certain implementation.

Now I find myself on the other side of the looking glass.  I am the lead developer of a fat client to be implemented in C#, however my expertise is in building Java web applications.  While I know that I can leverage design patterns and OO paradigms in any language, I am lost when it comes to coding standards, project life cycle tools and release/distribution procedures.  I have no doubt that I can pick up the basics within a month or two, but there are certain experiences one can only gather with time.

What should I do, and how do I avoid becoming the project lead that I hated when I was developing?

答:
Take a hands on approach. Start by grabbing yourself a simple C# primer and write some code.  Try a few basic things that you would know how to do blindfolded in another language.

Read up on programming style and convention. You should find this in part in your primer anyway, but you can also use products like StyleCop and Resharper to enforce style rules that you are unfamiliar.  This will effectively train you very quickly to do things in a commonly accepted way in order to avoid problems compiling your software.

Just be yourself, and apply the design knowledge you already have.  The basics are essentially the same regardless of the language.  Where there will be differences will be in how the languages differ in terms of structure will be fairly minimal, and much of it will become apparent very quickly as you throw together a test app or two.

If there are obvious things you don't know, be forthcoming.  Your team will respect honesty more than simply barging on without a clue. Make well informed and reasoned decisions, and always take a couple of minutes aside to consider your response.  You will need to be assertive without attempting to dominate, and you can't let your lack of knowledge in one area appear to be a reflection on your ability to lead the team. Leadership implies mentoring, yet mentoring does not mean you can't also show a willingness to learn something new.


问:
Should a view and a model communicate or not?
According to the wikipedia page for the MVC architecture, the view is free to be notified by the model, and is also free to query the model about its current state. However, according to Paul Hegarty's course on iOS 5 at Stanford, lecture 1, page 18 all interaction must go through the controller, with Model and View that are never supposed to know each other. It is not clear to me if Hegarty's statement must be intended as a simplification for the course, but I am tempted to say that he intends the design as such.

How do you explain these two opposite points of view ?

答:
I do agree with Paul Hegarty and believe that the View must not know about the Model. It is not that difficult to achieve but it brings additional benefits to your design and future flexibility.

In small applications (usually desktop) where I would like to avoid "dummy" ViewModel classes and keep things simple, I do also use IModel interface (see the answer above) and do take care that Model has no idea about the View (use subscribers as in the classical MVC).

Also in this case the Controller is turned to be quite coupled with the View and for simplicity I do not always clearly separate them.

The second “simplified” approach is OK when you may have several views for the same model, but I would not recommend it if you would like to use the same view for different models. Under different I mean really different by nature and not just JUnit test classes that “follow” the main model.


问:
Do people use any tools to make Rich UI on Web Application?
As titled, take ASP.NET/Perl/PHP for example.

Because I don't have chance to work with UI Designer/or know anyone like that, so I really wonder do they use any tools to do the UI design?

I don't mean tools like PhotoShop or Flash to make the graphic, but I mean like writting CSS, Table layout/color, Div, JQuery animation etc.

I know for ASP.NET Visual Studio have some support on UI design, but is very minimum compares to like ExpressionBlend for WPF/Silverlight.

I have been still typing everything when I do the UI Design for ASP.NET.

So I wonder do people use any tools to help doing UI Design?  Or everyone take it like a man to type everything else like what we did back then with NotePad?

答: I use Balsamiq Mockups for UI design.  The last site that I worked on I used Adobe Dreamweaver for implementation.  Most of the CSS that I have worked with has been coded by hand (and debugged using a plugin called firebug to assist).</p>


答:
This seems like a lot of effort to go to for a single calculation given the processing power you have at your disposal in the average PC. Also, You'll still have the expense of the the first call to your calculation for each unique pair of values, so 100,000 unique value pairs will still cost you Timen * 100,000 at a minimum. Consider that accessing values in your dictionary will likely become slower as the dictionary grows larger. Can you guarantee your dictionary access speed will compensate enough to provide a reasonable return against the speed of your calculation?

Regardless, it sounds as though you will probably need to consider finding a means to optimize your algorithm. For this you'll need a profiling tool, such as Redgate Ants in order see where the bottlenecks are, and to help you to determine if there are ways to reduce some of the overheads you might have relating to class instantiations, list traversals, database accesses, or whatever it is that is costing you so much time.

Title: What data structure should I use for this caching strategy?

Body:
I am working on a .NET 4.0 application, that performs a rather expensive calculation on two doubles returning a double. This calculation is performed for each one of several thousand items. These calculations are performed in a Task on a threadpool thread.

Some preliminary tests have shown that the same calculations are performed over and over again, so I would like to cache n results. When the cache is full, I would like to throw out the least-oftenrecently used item. (Edit: I realized least-often doesn't make sense, because when the cache is full and I would replace a result with a newly calculated one, that one would be least often used and immediately replaced the next time a new result is calculated and added to the cache)

In order to implement this, I was thinking of using a Dictionary<Input, double> (where Input would be a mini-class storing the two input double values) to store the inputs and the cached results. However, I would also need to keep track of when a result was used the last time. For this I think I would need a second collection storing the information I would need to remove a result from the dictonary when the cache was getting full. I am concerned that constantly keeping this list sorted would negatively impact performance.

Is there a better (i.e. more performant) way to do this, or maybe even a common data structure that I am unaware of? What kinds of things should I be profiling/measuring to determine the optimality of my solution?


答:
The approach with the second collection is fine. It should be a priority queue which allows finding / deleting min values quickly and also changing (increasing) priorities within the queue (the latter part is the hard one, not supported by most simple prio queue implementations). The C5 library has such a collection, it is called IntervalHeap.

Or course, you can try to build your own collection, something like a
 SortedDictionary<int, List<InputCount>>.  (InputCount must be class combining your Input data with your Count value)

Updating that collection when changing your count value can be implemented by removing and re-inserting an element.


答:
It depends on the company, but usually.  They're often seen as second class citizens, and in many companies, testing is seen as an entry-level position from which you would then move on to becoming a real developer.

This is, of course, crap.  Having worked with some good testers, I can say that they are both valuable and hard to come by.  Someone with a mind that is creative enough to find non-obvious bugs and methodical enough to do a thorough job.

One exception, though: I've known a few Microsoft test guys, and I hear that testers there are first-class citizens.

Title: Are testers considered low profile?

Body: I happened to know some system admin and according to him, testing guys are not given preferences in an organization in comparison to developers. No doubt software releases are not possible without testers but I've never laid my hands on testing so not much aware of it. No offense intended. </p>


答:
Your question is good. GUI implementation in HTML is insane. Take a look at Artisteer
It may help a bit. Look at the video. The tool allows you to not only create a design from a template but also generates HTML and CSS code. I don't know if the demo version supports ASP.NET but I know that the production version now supports ASP.NET (please check before you buy)!

You could also consider using 3rd party GUI controls on top of VS. Some of those are much more pretty and provide functionality too.

The 'designer' spirit is usually required and not too many tools can replace that as you know.

Title: Do people use any tools to make Rich UI on Web Application?

Body:
As titled, take ASP.NET/Perl/PHP for example.

Because I don't have chance to work with UI Designer/or know anyone like that, so I really wonder do they use any tools to do the UI design?

I don't mean tools like PhotoShop or Flash to make the graphic, but I mean like writting CSS, Table layout/color, Div, JQuery animation etc.

I know for ASP.NET Visual Studio have some support on UI design, but is very minimum compares to like ExpressionBlend for WPF/Silverlight.

I have been still typing everything when I do the UI Design for ASP.NET.

So I wonder do people use any tools to help doing UI Design?  Or everyone take it like a man to type everything else like what we did back then with NotePad?


问:
What is the best technology for a TRULY portable REST client
I develop a suite of productivity tools, for Mac, iOS and Windows. They all communicate with a sync server via a RESTful interface (using Protocol Buffers), but as we add new platforms, we realize the pain it is to recreate different versions of the same code just to communicate with the client, so we have thought of using a modular design:

The backend client module would be the same for all clients, so that changes to the protocol can be easily ported to all clients

Clients we need to support: Windows, Mac, iOS, Android, Web, possibly Windows Mobile

The only way I can think of is via a JavaScript module that's shared across all clients and handles communications with the server, but perhaps that's even more work because of the integration required with the JavaScript interpreter. Maybe we might be better off writing a couple of backend modules instead of just one.

答: If you want it to run in a browser it would be pretty easy to do this. Backbone.js, ExtJS (and probably bunch of other JS Frameworks) will do it without much problem. All you will have to do is setup a few objects and point them at the correct URL</p>


答:
If you wan to use a LRU eviction cache (Least Recently Used eviction), then probably a good combination of data structures to use is:

Circular linked list (as a priority queue)

Dictionary

This is why:

The linked list has a O(1) insertion and removal time

List nodes can be reused when the list is full and no extra allocations need to be performed.

This is how the basic algorithm should work:

The data structures

LinkedList<Node<KeyValuePair<Input,Double>>> list;
Dictionary<Input,Node<KeyValuePair<Input,Double>>> dict;

Input is received

If the dictionary contains the key

return the value stored in the node and move the node to the beginning of the list.

If the dictionary does not contain the key

compute the value.

store the value in the last node of the list.

if the last node has a value, remove the previous key from the dictionary.

move the last node to first position.

store in the dictionary the (input, node) key value pair.

Some benefits of this approach are, reading and setting a dictionary value approaches O(1), inserting and removing a node in a linked list is O(1), which means the algorithm is approaching O(1) for reading and writing of values to the cache, and avoids memory allocations and block memory copying operations, making it stable from a memory point of view.


问:
Which is the purpose of using a workspace in Aptana?
I almost always do web development with a simple editor like Geany or Notepad++. Recently I'm starting with Aptana, and I'm a bit confused about the purpose/benefits of the workspace.

Why is it useful? How do I use it?

答:
The Workspace holds the development environment.

Each workspace houses a collection of projects, so it was determined that creating multiple workspaces was a good way to get organized. Each workspace stores the perspective and views for that workspace.

In my opinion you should have a new workspace for every new project you work on. You should also have a testing workspace in which you should have all testing projects. Another benefit is that when you switch your workspace for a particular project you get all perspectives and views you have organized for that specific project. You don't need to worry about files of all projects if you have separate workspaces for them, as you have files that are related to that project only. This way it also speeds up building/compiling files in workspace.

Another similar kind of discussion, but for Eclipse: Benefits of creating a new workspace for each project in Eclipse?


答:
My company has highly optimized scientific application which has become so big and complicated that new versions are literally taking t = infinity to produce.

Hard to maintain and difficult to introduce new feature = a definition of legacy code.

this application is branched for optimization a.k.a. a release or production version

Bad idea. Your engineers have to maintain two versions. Since your software is related to science (lots of calculations and algorithms I assume), you should have your algorithms implemented in two languages :

some kind of scientific language, like for example matlab or R. This version should be as clear as possible

some kind of programming language, like c, c++, java, etc. This version should be as optimized as possible. Only places that the profiler shows that are the bottle neck should be optimized. The other parts should be very clean. Off course, the code must be unit tested (as high code coverage as possible).

Title: Optimization as a branch: is that a thing?

Body:
My company has highly optimized scientific application which has become so big and complicated that new versions are literally taking t = infinity to produce.  (E.G. I have an email which pre-announces a late 2007 release for something that has not been released yet.)  New feature requests from the scientific team to the development team  leads to a lot of arguing.  This got me to thinking..

The application should be clearly written with good design, clear names and lots of automated tests.  New features are added to this application.  Run and pass the tests.  Then this application is branched for optimization a.k.a. a release or production version.  Again, run and pass the tests.

Am I missing something?  Is this a 'thing'?  I guess my question is, if I bludgeon the VP of Product Development with this, would I be right (about the idea, not the bludgeoning)?


答:
1)  Very, very unlikely.No, and your developers may put something nasty in your coffee for suggesting it.  Time your developers spend waiting for the code to compile or for the IDE to do whatever it's doing or whatever is time they're not spending making the code better.  Disrupts their mental flow, too.  Keep their minds on the problem, and they'll be much more efficient solving that problem.

2)  Give them each a second PC representing the lowest specs you want them to actually support, with a KVM switch to go between the that and their real workstation.

Title: Does giving a developer a slower development machine result in faster/more efficient code?

Body:
Suppose I give my developers a screaming fast machine.  WPF-based VS2010 loads very quickly.  The developer then creates a WPF or WPF/e application that runs fine on his box, but much slower in the real world.

This question has two parts...

1) If I give a developer a slower machine, does that mean that the resulting code may be faster or more efficient?

2) What can I do to give my developers a fast IDE experience, while giving 'typical' runtime experiences?

Update:

For the record, I'm preparing my even-handed response to management. This isn't my idea, and you folks are helping me correct the misguided requests of my client.  Thanks for giving me more ammunition, and references to where and when to approach this.  I've +1'ed valid use cases such as:

- specific server side programming optimizations

- test labs

- the possibly buying a better server instead of top of the line graphics cards


答: If you think like that and actually worry about it, you already avoided the risk to become this kind of project lead. It's a totally different kind of personality who would dare to make decisions without the proper knowledge. Just keep an open mind to what your coworkers tell you and create and encourage a culture of dialogue and exchange of information in your team.</p>

Title: How to lead a development project without technical expertise

Body:
I have been a hands-on developer for my entire career and love working with code.  I have always resented the team lead who has little or no expertise regarding a particular technology and yet insists on a certain implementation.

Now I find myself on the other side of the looking glass.  I am the lead developer of a fat client to be implemented in C#, however my expertise is in building Java web applications.  While I know that I can leverage design patterns and OO paradigms in any language, I am lost when it comes to coding standards, project life cycle tools and release/distribution procedures.  I have no doubt that I can pick up the basics within a month or two, but there are certain experiences one can only gather with time.

What should I do, and how do I avoid becoming the project lead that I hated when I was developing?


答:
Opportunity comes once in a while .. Do Grab it.. I would say, try to learn the basics of C#. Get some tutorial from online , try to work on it. initially it would be tough to learn the new concept , later when your first task done you will have some confidence in it.

Think positive, Try to take hard task, Debug your own code  and am sure you will master in it..

Do not loose your opportunity.


问:
Should QA find reproducible scenarios?
Sometimes my QA team reports bugs, but neither I or them have any idea on how to reproduce them. This leads to very long and frustrating debugging sessions which sometimes do not even yield results.

My software is tied heavily with proprietary hardware so bugs can come from many directions at once.

Should I expect more from them than "your software crashed when I pressed a button" or should I figure myself what happened?

EDIT:

One of my coworker pointed out that we are probably all developers here so the results might suffer a little bias

答:
your QA team sucks

Go to them and tell them to read a document that any professional tester has to have printed right inside their brains (I was a tester once and I still have it right there, in my brain): How to Report Bugs Effectively.

Particularly, point them to the section "Show me how to show myself":

This is the era of the Internet. This is the era of worldwide communication. This is the era in which I can send my software to somebody in Russia at the touch of a button, and he can send me comments about it just as easily. But if he has a problem with my program, he can't have me standing in front of it while it fails. "Show me" is good when you can, but often you can't.

If you have to report a bug to a programmer who can't be present in person, the aim of the exercise is to enable them to reproduce the problem. You want the programmer to run their own copy of the program, do the same things to it, and make it fail in the same way. When they can see the problem happening in front of their eyes, then they can deal with it...

If they start yelling at you complaining that "bugs can come from many directions at once", tell them they suck even more than you thought before. Tell them that Testability is a feature they should evaluate among other project features and they should invest efforts into getting this feature right.

Testability improvements one could get when there is a professional tester focused on it could be much like magic. I learned that myself few months ago. QA engineer working with our team gave me a handful of testability requests to develop for some components in our application. Things he asked about made very little sense to me but I just gave it to him assuming that he knows better as a professional. Soon after I finished, he came up with a tool that reduced testing efforts by order of magnitude. He said most of it was based on these cryptic requests I implemented, go figure.

Title: Should QA find reproducible scenarios?


问:
Where can I get free public raw data?
In web development, a mashup is a web page or application that uses and combines data, presentation or functionality from two or more sources to create new services.

There are many sources for getting data (raw information). Governments are good examples.

However many of those cost and have complicated licensing.
For instance SMHI in Sweden sells temperature data meanwhile our neighbor country Norway gives it away for free.

One would say what kind of application are you building and what data do you need?  I would say give me some interesting data and I will do a good mashup of it. I could just plot it on Google maps for instance.

So the question is: Where can I get free data?

Note: I'm not interested in data mining using a webcrawler!

Please share your sources with me.

答: For those who do AWS, Amazon Public Datasets might be of interest.</p>

Title: Where can I get free public raw data?


问:
Enterprise scalable vs internet scalable, what is the meaning & differences?
While reading about Java EE applications, somewhere I have seen people saying they're enterprise scalable, I am confused as to what that really mean?

Are Java web applications mainly written & suitable for building enterprise management tools, not for the high traffic websites of today's world, that need to scaled to a large internet population?

答:
No! Java as .NET or even PHP (if well developped) can provide scalable applications in order to handle a lot of clients requests.

Enterprise scalable probably refer to the capacity of enterprise servers to answer those requests, I thinks this kind of scalability is not dependant of the language, but rather hardware, DB and other tools.


答:
Enterprise scalability is (at least I perceived it this way) a very fuzzy term (as is internet scale). Both actually refer to the same, i.e., being able to react to changing requirements, load and possibly simple horizontal scalability.

Are Java web applications mainly written & suitable for building enterprise management tools, not for the high traffic websites of today's world, that need to scaled to a large internet population?

Java EE isn't commonly used for high volume websites. Instead, through their strong transactional model combined with extensive support for messaging and availability of commercial support, they are a better fit for insurance companies or banks.

This doesn't mean of course that you can't write scalable websites with Java. If you want to, you only need to make sure that you avoid certain parts of Java EE. For instance, you should try to avoid Enterprise JavaBeans and Java Persistence 2.0 if you want (simple and cheap) scalability.

To give you an example, eBay is (or at least has been in 2004) using Java with own implementations for ORM and an optimistic transactional model to meet their non-functional requirements.

Title: Enterprise scalable vs internet scalable, what is the meaning & differences?

Body:
While reading about Java EE applications, somewhere I have seen people saying they're enterprise scalable, I am confused as to what that really mean?

Are Java web applications mainly written & suitable for building enterprise management tools, not for the high traffic websites of today's world, that need to scaled to a large internet population?


答:
As pointed out in Peter Smith's answer, the pattern you are trying to implement is called memoization. In C# it is pretty hard to implement memoization in a transparent way without side effects. Oliver Sturm's book in functional programming in C# gives a solution (the code is available for download, chapter 10).

In F# it would be much easier. Of course, it's a big decision to start using an other programming language, but it may be worth considering. Especially in complex calculations, it is bound to make more things easier to program than memoization.


问:
How serious is losing the source code?
If a software company loses the source code to one of the products they are selling, how serious would that be, in terms you could explain to a layman?  Would the term "gross negligence" be too strong?  Or "gross incompetence"?  Obviously no one got killed but isn't it as serious as some financial negligence that people get jail time for?

EDIT:
Let's say it's not a case of a disk drive crashing, natural disaster or anything like that.  Just they misplaced it.

答:
As the others have noted, this likely falls under the "it all depends" heading, so a couple of senarios:

Source for a disk-based, console video game - This would likely have little impact on the company since they tend to not make any changes to the game once it has been burned to disk. Granted they might lose some time if there is library code that they have to redevelop, it wouldn't be that bad.

Source for a downloadable video game - This would likely be bad since the the customers are likely going to expect that bugs will be patched, not being able to do so could cause the customers to lose faith in the company which could adversely effect future releases.

Source for a game in development - Most video game companies cannot afford to lose the code for a game currently in development unless it is extremely early in the development cycle (i.e. days, maybe weeks into it.) For a small company, losing the source for their flagship release could cause them to go out of business.

Source for a small business application with a limited release audience - Unlikely to cause any problems for the company, although they might lose a couple customers.

Source for a large business application with a limited release audience - Another situation where it might cause the company to go out of business due to the loss of faith from their customers. Even in most small markets there tend to be more than one company operating and this could be enough for the business to move to a competitor.

Source for a major application from a large company - Here is where it really all depends and would likely be on a very narrow, case-by-case basis. Flagship products (e.g. Microsoft Windows) generally have support contracts associated with them and not being able to support the product could lead to breach of contract lawsuits. If I had to give an estimate, I would say that most people involved in the lose of the code up to senior leadership of those people might need to be looking for new employment.

Across the board though, I would likely say that the person that lost the code would be looking for a new job (and might find it hard to find one!) and they might also be facing lawsuits from the company.

Title: How serious is losing the source code?


答:
France recently opened an open data website

Edit: Paris did too

Title: Where can I get free public raw data?

Body:
In web development, a mashup is a web page or application that uses and combines data, presentation or functionality from two or more sources to create new services.

There are many sources for getting data (raw information). Governments are good examples.

However many of those cost and have complicated licensing.
For instance SMHI in Sweden sells temperature data meanwhile our neighbor country Norway gives it away for free.

One would say what kind of application are you building and what data do you need?  I would say give me some interesting data and I will do a good mashup of it. I could just plot it on Google maps for instance.

So the question is: Where can I get free data?

Note: I'm not interested in data mining using a webcrawler!

Please share your sources with me.


答:
Well, everyone has their opinions, so why not me too.

Enterprise scale - as noted above, suitable for insurance companies, banks and the like - that means a lot of requests, reliability, transactions (ACID), correct sequence ordering, timeliness, consistent, relational databases, etc.

Internet scale - a huge number of requests, transactions not enforced (less ACID), no ordering, inconsistent (due to loosly synchronized redundancy), structured storage instead of relation databases, etc.

You could compare the differences between Internet scale technology like Google App Engine and Enterprise scale technology like EJB.


问:
What is pseudocode?
I've seen a lot of mentions of Pseudocode lately, on this site and others. But I don't get it:

What is Pseudocode? For example, the Wikipedia article below says "It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading." Does this mean that it isn't actually used to make programs?

Why is it used?

How is it used?

Is it considered a Programming Language? (See the above Wikipedia quote)

Is it commonly known/used?

I honestly don't know where to start with this. I have Googled it and I've seen the Wikipedia article on the topic, but I still don't fully understand what it is.

答:
Pseudocode is, as the name implies, not real code, but it looks like code. It helps people to understand a problem domain or solution better without having to add all the baggage necessary when using a real language.

In short: it's used only for illustrational purposes.

Pseudocode and programming

There is no definition or fixed rule of pseudocode, it can be different each time. It is not a (real) programming language and no-one will consider it one. It cannot be compiled or used as a real programming language: if you could do that, it ceases to be pseudocode. Pseudocode does not need to be deterministic (a necessity for computers to compile), it rather needs to be understood by humans. To use pseudocode, you'll have to convert it to your favorite programming language. This conversion process can be different each time and no rules can be given for it because, again, pseudocode is like free speech: it can take any form.

Usages

It is commonly used, especially in the design phase of projects to help understand a certain approach to a problem. It's also commonly used in algorithm design, or when teachers draw something on the board. In all these cases it is not necessary to compile the code, you just want to understand the problem/solution.

Types of pseudocode

Pseudocode can be, but doesn't have to be of a certain type, i.e., you can have a stack-based pseudocode to illustrate MSIL, you can have an imperative pseudocode to illustrate Java, C#, C++, Python, you can have a functional pseudocode to illustrate F#, Haskell, SQL etc.

Examples

From the top of my head, but anything goes, because pseudocode can be invented on the spot:

XML pseudocode, showing a head+body structure that allows for multiple p-elements:

```<code><head ...
   <title ...
</
<body ...>
   (<p>...)+
</
</code>```

Imperative pseudocode, showing the diamond problem in languages that support multiple inheritance:

```<code>class A() { readFile(); }
class B() : A {}       // overrides readFile in A
class C() : A {}       // overrides readFile in A
class D() : B, C {}    // what definition of readFile should be used?
</code>```

The above two examples obviously resemble some (type of) language, but aren't really that language and cannot possibly compile. They rather illustrate something that you want to explain.

Title: What is pseudocode?

Body:
Pseudocode is, as the name implies, not real code, but it looks like code. It helps people to understand a problem domain or solution better without having to add all the baggage necessary when using a real language.

In short: it's used only for illustrational purposes.

Pseudocode and programming

There is no definition or fixed rule of pseudocode, it can be different each time. It is not a (real) programming language and no-one will consider it one. It cannot be compiled or used as a real programming language: if you could do that, it ceases to be pseudocode. Pseudocode does not need to be deterministic (a necessity for computers to compile), it rather needs to be understood by humans. To use pseudocode, you'll have to convert it to your favorite programming language. This conversion process can be different each time and no rules can be given for it because, again, pseudocode is like free speech: it can take any form.

Usages

It is commonly used, especially in the design phase of projects to help understand a certain approach to a problem. It's also commonly used in algorithm design, or when teachers draw something on the board. In all these cases it is not necessary to compile the code, you just want to understand the problem/solution.

Types of pseudocode

Pseudocode can be, but doesn't have to be of a certain type, i.e., you can have a stack-based pseudocode to illustrate MSIL, you can have an imperative pseudocode to illustrate Java, C#, C++, Python, you can have a functional pseudocode to illustrate F#, Haskell, SQL etc.

Examples

From the top of my head, but anything goes, because pseudocode can be invented on the spot:

XML pseudocode, showing a head+body structure that allows for multiple p-elements:

<head ...
   <title ...
</
<body ...>
   (<p>...)+
</

Imperative pseudocode, showing the diamond problem in languages that support multiple inheritance:

class A() { readFile(); }
class B() : A {}       // overrides readFile in A
class C() : A {}       // overrides readFile in A
class D() : B, C {}    // what definition of readFile should be used?

The above two examples obviously resemble some (type of) language, but aren't really that language and cannot possibly compile. They rather illustrate something that you want to explain.


答: Pseudocode is not a language, not a convention. Every textbook or paper would use its own version of the pseudocode. As with many other informal mathematical "languages", in the best case it would be informally described in the paper itself, in the worst case the authors would expect it to be "obvious" enough.</p>

Title: What is pseudocode?

Body:
I've seen a lot of mentions of Pseudocode lately, on this site and others. But I don't get it:

What is Pseudocode? For example, the Wikipedia article below says "It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading." Does this mean that it isn't actually used to make programs?

Why is it used?

How is it used?

Is it considered a Programming Language? (See the above Wikipedia quote)

Is it commonly known/used?

I honestly don't know where to start with this. I have Googled it and I've seen the Wikipedia article on the topic, but I still don't fully understand what it is.


答:
I am lost when it comes to coding standards, project life cycle tools and release/distribution procedures.

Find an open source product that uses the same technology you're going to use.

If possible, find one that is in some way similar to the problem domain.  This isn't as important as finding a project with the same technology and active updates.

Download their working code.  Read it.

Figure out what tools they use.  Use them.

Figure out how to build and release the open source project.  Build it and release it.

An open source project (with a number of contributors) will illustrate best practices.

I have no doubt that I can pick up the basics within a month or two, but there are certain experiences one can only gather with time.

True.

Learn from the open source community.