答:
The first thing to consider, this is a for something casual.  It isn't designing a system to determine rounds for the world cup of floor ball.  Its for casual pick up games with a group of people who enjoy a good game rather than a lopsided win.

I recall something of Google having a foosball odds generator.  Quite a bit more work was done on that than I am doing on this.  Looking for a refrence for that, I found an article in SO and a True Skill calculator that is used by Microsoft for the xbox.

Taking a much more simplistic approach, each player gets the score of the ratio of points their team has for the game.  For Game 1, player A would get 1.25 (10/8) while player D would get 0.8 points (8/10).  Find the mean of all the numbers and that is the player's score.

For the set of games described, this provides:

```<code>  A 1.42
  B 1.22
  C 0.72
  D 1.07
  E 1.27
  F 1.40
  G 2.50
</code>```

At this point, you have a problem similar to that of the partition problem with the constraint that each team needs the same number of players and values need not be exact (but just as close as possible).

Title: Strategy/algorithm to divide fair teams based on history

Body:
We are a group of people playing floorball together on a regular basis. Every session starts with the daunting task of dividing teams...

So what would be better than an application to pick teams automatically?

So, given a history of team-combinations and results, and a list of people showing up for this particular session, what would be a good strategy to find the optimal teams? By optimal, I mean teams as equal as possible.

Any ideas?

Edit: To make it clear, the data that I have to base the picking on, would be something like this:

```<code>[{ team1: ["playerA", "playerB", "playerC"],
   team2: ["playerD", "playerE", "playerF"],
   goals_team1: 10,
   goals_team2:  8
 },
 { team1: ["playerD", "playerB", "playerC"],
   team2: ["playerA", "playerE", "playerG"],
   goals_team1:  2,
   goals_team2:  5
 },
 { team1: ["playerD", "playerB", "playerF"],
   team2: ["playerA", "playerE", "playerC"],
   goals_team1:  4,
   goals_team2:  2
 }]
</code>```

Body:
The first thing to consider, this is a for something casual.  It isn't designing a system to determine rounds for the world cup of floor ball.  Its for casual pick up games with a group of people who enjoy a good game rather than a lopsided win.

I recall something of Google having a foosball odds generator.  Quite a bit more work was done on that than I am doing on this.  Looking for a refrence for that, I found an article in SO and a True Skill calculator that is used by Microsoft for the xbox.

Taking a much more simplistic approach, each player gets the score of the ratio of points their team has for the game.  For Game 1, player A would get 1.25 (10/8) while player D would get 0.8 points (8/10).  Find the mean of all the numbers and that is the player's score.

For the set of games described, this provides:

  A 1.42
  B 1.22
  C 0.72
  D 1.07
  E 1.27
  F 1.40
  G 2.50

At this point, you have a problem similar to that of the partition problem with the constraint that each team needs the same number of players and values need not be exact (but just as close as possible).


问:
Is there any hard data on the (dis-)advantages of working from home?
Is there any hard data (studies, comparisons, not-just-gut-feel analysis) on the advantages and disadvantages of working from home?

My devs asked about e.g. working from home one day per week, the boss doesn't like it for various reasons, some of which I agree with but I think they don't necessarily apply in this case.

We have real offices (2..3 people each), distractions are still common. IMO it would be beneficial for focus, and with 1 day / week, there wouldn't be much loss at interaction and communication. In addition it would be a great perk, and saving the commute.

Related: Pros and cons of working remotely / from home  (interesting points, but no hard facts)

To clarify: it's not my decision to make, I agree that there are pro's and con's depending on circumstances, and we are pushing for "just try it". I've asked this specific question because (a) facts are a good addition to thoughts in arguing with an engineer boss, and (b) we, as developers, should build upon facts like every respectable trade.

答:
I've been working from home for the past 9 months or so.  Actually it's more like long-distance telecommuting (very long distance in fact - my "primary" office is in Boston and I'm in Seattle).  I worked for the company for 3 years locally in Boston, but after my wife became pregnant with our third child we decided it was best to move back and be closer to family in Seattle.  There was a business case to go along and justify my move however; we have clients here on the west coast that I deal with where being more local would help.  Even though the company I work for has an office in Seattle, I'm not really connected with anyone in the office and given that it would be at least an hour commute each way, I haven't been there in months (really hard on most days to justify spending a couple hours a day on a bus when it takes 10 seconds to walk down the hall).

So, on most days I work at home.  It was not an arrangement that I would have picked when in Boston, even though we did have some people doing it.  I had a small two bedroom apartment in Boston, and now in Seattle we have a house four times the size (and paying less in rent!)  A separate room/home office is key, and if you are going to have a land-line, it's best that the only connection to that line be in the office, lest you have any little ones pick up the phone when you're on an important call.  My company pays for internet/phone when you have a work from home arrangement, so that works out nicely.  I would imagine however for a part-time arrangement that the company would not pay for it (they don't at mine if you're only doing a couple days a week).

I am in constant contact with my teams in Boston and New York via email/pm/phone and I travel back every three months.  The arrangement works out pretty well, although there are times I miss face to face interaction.  However there are other times, like when I go back east, where I'm reminded how much time idle chit chat can suck out of the day or how often people hit you up with questions.  The one thing that's different is that I feel the need to constantly be working when I'm at home during work hours, whereas if I was not doing anything productive at the office (like talking with a co-worker about non-work related matters) I wouldn't think anything of it.  So my 8 hour day is usually 8 hours of actual work, whereas at the office it's quite a bit less.  At home if I get side-tracked with something not work related I'll tend to make up that extra time.

My family is pretty good about keeping boundaries, although one thing that can cripple a good working arrangement is being too flexible.  You really should structure any chores or errands into one solid block (which I find is best towards the end of the day when my productivity is about drained).  Chopping up the day just is not a good way to go about your work.

In summary, if you're going to pursue telecommuting make sure you:

1) Have a separate office

2) Have a dedicated land line if you're not going to be relying on a cell phone for all calls (and after awhile you'll appreciate being able to have a land-line and put your phone on speaker to avoid holding the phone while you're typing all the time)

3) Make sure family knows that when you're working, you're off-limits unless it's an emergency (my kids are pretty good about saying "daddy working" when they pass by my office or if I go upstairs)

4) Find out if your company reimburses for any expenses or if you're on your own

ContentLicense: CC BY-SA 3.0


问:
What should a tester (Quality Assurance) person do on a scrum team?
Coming from a scrum environment with no integrated testing support and an independent minded QA staff, how is a tester (QA person) best integrated with a scrum team? What should they do?

For reference some test functions are:

Unit Testing

Integration Testing

Functional Testing

Performance Testing

Acceptance Testing

答:
they should participate in design meetings.

they should participate in standups.

They should give feedback as to the testability of the software being built.

they should analyze what is being developed to come up with a comprehensive plan to test it.

they should write automated tests.

they should do exploratory testing.

they should monitor nightly test runs.

they should act as a testing mentor to the developers.

they should be quality ambassadors, and the customer advocate.

A really good book on this subject is Agile Testing: A Practical Guide for Testers and Agile Teams by Lisa Crispin and Janet Gregory. Highly, highly recommended.

ContentLicense: CC BY-SA 2.5


问:
What's the most effective way to perform code reviews?
I've never found the ideal way to perform code reviews and yet often my customers require them. Each customer seems to do them in a different way and I've never felt satisfied in any of them.

What has been the most effective way for you to perform code reviews?

For example:

Is one person regarded as the gatekeeper for quality and reviews the code, or do the team own the standard?

Do you do review code as a team exercise using a projector?

Is it done in person, via email or using a tool?

Do you eschew reviews and use things like pair programming and collective code ownership to ensure code quality?

答:
At SmartBear we not only make a code review tool, we also use it on a day to day basis. It's an essential part of our development process. We review every change that gets checked in.

I think it's a bad idea to have a single gatekeeper code reviewer for many reasons. That person becomes a bottleneck and they have to do too much code reviewing (just to keep the project moving) to really be effective at it (60-90 minutes at a time is the limit of effectiveness). Code reviews are a great way to share ideas and knowledge. No matter how much of a superstar your gatekeeper is, they can learn from others on the team. Also, having everyone do code reviews also creates a "collective code ownership" environment -- where people feel that they own the quality of the code (it's not just QA or the gatekeeper).

We have a free whitepaper on "Best Practices for Peer Code Review" that has 11 tips for making code reviews effective. Much of this is the same content from the book that John mentioned in a more distilled form.


问:
International two-part date formats
Do people outside of the USA use two-part date abbreviations for the current year? For instance, representing the last day of May, you might see someone enter 5/31 into a date field.

Do international users do something similar? In a country that ordinarily uses dd/MM/yyyy would they use 31/5 or some such?

答:
The simple answer is yes.  It is extremely annoying trying to sort information with a mix of dates formats </p>

<p>Consider using ISO 8601 date formats when printing dates and times.  When inputting free form dates clearly indicate the convention you are expecting.  Depending on convention 1/12/2012 could be early or late in the year. </p>

Title: International two-part date formats

Body:
The simple answer is yes.  It is extremely annoying trying to sort information with a mix of dates formats

Consider using ISO 8601 date formats when printing dates and times.  When inputting free form dates clearly indicate the convention you are expecting.  Depending on convention 1/12/2012 could be early or late in the year.


问:
Why can't there be an "universal" programming language that serves all purposes?
why not combine the best features of the all existent programming languages and fit it in a universal programming language?</p>

答:
Aside from the swiss-army-knife argument (which has a point -- it is more difficult to design a good wide-spectrum language than a domain-specific one -- but that doesn't mean such a language wouldn't be both possible and a good idea), there are problems with "combining the best features":

For language features, "best" is subjective, or at least (interminably) arguable.

Some features aren't compatible; a good feature from one language may blow up when combined with a good feature from another.

We're not done coming up with new features yet.

In short, language design is harder and more complicated than that.  Although, you may want to take a look at Scala.


问:
Why do some programmers think there is a contrast between theory and practice?
Comparing software engineering with civil engineering, I was surprised
to observe a different way of thinking: any civil engineer knows that
if you want to build a small hut in the garden you can just get the
materials and go build it whereas if you want to build a 10-storey house
(or, e.g., something like this) you need to do quite some maths
to be sure that it won't fall apart.

In contrast, speaking with some programmers or reading blogs or forums
I often find a wide-spread opinion that can be formulated more or less as follows: theory and formal methods are for mathematicians / scientists
while programming is more about getting things done.

What is normally implied here is that programming is something very
practical and that even though formal methods, mathematics, algorithm theory,
clean / coherent programming languages, etc, may be interesting topics,
they are often not needed if all one wants is to get things done.

According to my experience, I would say that while you do not need much
theory to put together a 100-line script (the hut), in order to develop
a complex application (the 10-storey building) you need a structured
design, well-defined methods, a good programming language, good text
books where you can look up algorithms, etc.

So IMO (the right amount of) theory is one of the tools
for getting things done.

My question is why do some programmers think that there is a contrast
between theory (formal methods) and practice (getting things done)?

Is software engineering (building software) perceived by many as
easy compared to, say, civil engineering (building houses)?

Or are these two disciplines really different (apart from mission-critical
software, software failure is much more acceptable than building failure)?

I try to summarize, what I have understood from the answers so far.

In contrast to software engineering, in civil engineering it is much clearer what amount of theory (modelling, design) is needed for a certain task.

This is partly due to the fact that civil engineering is as old as mankind while software engineering has been around for a few decades only.

Another reason is the fact that software is a more volatile kind of artefact, with more flexible requirements (it may be allowed to crash), different marketing strategies (good design can be sacrificed in order to get it on the market quickly), etc.

As a consequence, it is much more difficult to determine what the right amount
of design / theory is appropriate in software engineering (too little -> messy code, too much -> I can never get finished)
because there is no general rule and only (a lot of) experience can help.

So if I interpret your answers correctly, this uncertainty about how much
theory is really needed contributes to the mixed love / hate feelings
some programmers have towards theory.

答:
I think the analogy is flawed. As far as I'm aware, civil engineering does not have the same sort of theoretical basis as computer science; computer science was born from theoretical mathematics—like Turing machines. Civil engineering is about creating structures that resist mother nature and maybe even look beautiful. Again, I really don't know much about civil engineering, but I don't think there are civil engineer equivalents of P vs NP, the traveling salesman, and other fun things to bash your brains against. And there is definitely a place for our computer science theory—if someone solves the traveling salesman or the halting problem we are in for a lot of awesome new advances. But for a software engineer, whose business is to architect software, such problems are really only fun and games.

Now, I also think it depends on what you mean by "theory." Are we talking design patterns, or pumping lemma? Because having a good solid understanding of design patterns is absolutely critical to being a good software engineer. However, when architecting a large software system, theorizing about P/NP problems isn't useful. In that sense, I believe there is a very stark contrast between software engineering and theoretical computer science.

Or does theory refer to algorithms? You don't spend a whole lot of timing writing algorithms you learned in your algorithms class. Why? Because you typically only need them in particular cases (and then you look it up and research it), or you use a library already written for you. No need to write another bayesian classifier. Abstraction is an important principle in computer science. I think software engineers tend to not learn how an algorithm works until they need to.

Another reason is there are currently several popular "get it done" software development methods that are effective. For example, in agile development, you do not architect out an entire system beforehand. The reason for this is because you don't know exactly what you're building yet—you want what you're making to be flexible and adapt to new information and requirements. Designing it all out from the get go and then building just that does not always produce the best software. However, it is not the solution for everything. For example, say you're designing some distributed-computing-cluster-crazy-new thing. You can't do some napkin sketches and start your SCRUM.

TL;DR. I think there is some equivocation around the word "theory." Traditionally, theory refers to the theoretical mathematical aspects of computer science. Unless you are researching newer ways of computing, for the most part theoretical computer science plays no part in the day to day life of a software engineer. Software engineers care about design patterns and system architecture. Specific implementation details of certain algorithms are not important. Often times with less complicated ideas it is appropriate to not design a lot and just start coding. And I think this is where the idea comes from that programmers don't like theory.

ContentLicense: CC BY-SA 4.0


答:
The gap between theory and practice is too large at the moment. When doing theory, you are given three axioms and it is subsequently shown that a one-line theorem has a thousand page proof, or no proof at all. In software engineering, you're given inconsistent APIs of thousands of functions which give you a myriad of (bad) manners of implementing an underspecified feature.

Real software engineering would drive most of those in the formal field mad, and real mathematical software development drives those in engineering mad. Both fields require people of different aptitudes, and I don't think the aptitudes often overlap.

Title: Why do some programmers think there is a contrast between theory and practice?

Body:
Comparing software engineering with civil engineering, I was surprised
to observe a different way of thinking: any civil engineer knows that
if you want to build a small hut in the garden you can just get the
materials and go build it whereas if you want to build a 10-storey house
(or, e.g., something like this) you need to do quite some maths
to be sure that it won't fall apart.

In contrast, speaking with some programmers or reading blogs or forums
I often find a wide-spread opinion that can be formulated more or less as follows: theory and formal methods are for mathematicians / scientists
while programming is more about getting things done.

What is normally implied here is that programming is something very
practical and that even though formal methods, mathematics, algorithm theory,
clean / coherent programming languages, etc, may be interesting topics,
they are often not needed if all one wants is to get things done.

According to my experience, I would say that while you do not need much
theory to put together a 100-line script (the hut), in order to develop
a complex application (the 10-storey building) you need a structured
design, well-defined methods, a good programming language, good text
books where you can look up algorithms, etc.

So IMO (the right amount of) theory is one of the tools
for getting things done.

My question is why do some programmers think that there is a contrast
between theory (formal methods) and practice (getting things done)?

Is software engineering (building software) perceived by many as
easy compared to, say, civil engineering (building houses)?

Or are these two disciplines really different (apart from mission-critical
software, software failure is much more acceptable than building failure)?

I try to summarize, what I have understood from the answers so far.

In contrast to software engineering, in civil engineering it is much clearer what amount of theory (modelling, design) is needed for a certain task.

This is partly due to the fact that civil engineering is as old as mankind while software engineering has been around for a few decades only.

Another reason is the fact that software is a more volatile kind of artefact, with more flexible requirements (it may be allowed to crash), different marketing strategies (good design can be sacrificed in order to get it on the market quickly), etc.

As a consequence, it is much more difficult to determine what the right amount
of design / theory is appropriate in software engineering (too little -> messy code, too much -> I can never get finished)
because there is no general rule and only (a lot of) experience can help.

So if I interpret your answers correctly, this uncertainty about how much
theory is really needed contributes to the mixed love / hate feelings
some programmers have towards theory.


问:
Review quality of code
I have been asked to quality review two code bases. I've never done anything like that, and need advice on how to perform it and report it.

Background

There are two providers of code, one in VB and one in C (ISO 9899:1999 (C99)). These two programs do not work so well together, and of course, the two suppliers blames  each other. I will therefore as a independent person review both codes, on a comprehensive level review the quality of the codes to find out where it is most likely that the problem lies. I will not try to find problems, but simply review the quality and how simple it is to manage and understand the code.

Edit:
I have yet not received much information about what the problem consists of. I've just been told that I will examine the code in terms of quality. Not so much more. I do not know the background to why they took this decision.

答:
It really depends on what they want and mean by code quality.

But in general, your goal would be to give a review of how the code fares in terms of:

ease of maintainability and extensibility,

stability and security,

performance.

Pretty much most of the metrics fall under these porte-manteau categories (actually, I'd not even consider performance in general, and consider it most of the time as a bonus side-effect of good scores in terms of stability and maintainability, hence good code design).

There are some more absolute things to look for, like code certifications that can be directly applied and measured on some codebases, but they don't necessarily give a fine-grained review of these categories.

I'd advise you:

open an IDE and start browsing the code,

put breakpoints to know what happens at runtime and identify interesting cross-cutting concerns and major bottlenecks,

find some code checkers and have them flag violations and identify "hotspots" in your codebase,

do some profiling on the application to identify bottlenecks,

also have a look at the tooling used and the system's build (not what they directly asked, but some can be inferred from that, and it can help to identify other issues),

define process and practices to then start improving the metrics you identified, and explain how that will benefit the codebase, the developers, and the end product.

I know you tagged vb, but just to give you an example, Sonar would be a good example of a tool that can greatly help you quantifying the quality of a code base in many regards, from code quality from a technical point of view or even from a business perspective, by linking (more or less accurately) some markers to business costs. You want to find an equivalent tool, or a set of tools allowing you to achieve similar results, in your area. Sonar does have a C plugin, if you want, and I'm pretty sure Visual Studio has a few good code quality analyzers built-in or external, for VB.

OwnerDisplayName: magol

Title: Review quality of code


问:
Historical origins of Scala implicits
Scala has been called complex with its rich feature set by many of my colleagues and some even blamed all those new features of it. While most programmers are aware of the OO-features, and at least the decent ones also know about functional programming, there is one feature in particular in Scala for which I am not aware of its historical origins.

Given that a major mantra of our profession is to not reinvent the wheel, I am rather confident, that Scala does not have any actual unheard-of-before features, but I stand to be corrected on this one if necessary.

To get to the actual question, while I am aware of the origins of most of Scala's features I have never seen something like its implicit declarations before. Are there other (older!) languages out there which also provide this feature?

Does it make sense to distinguish the different cases of implicits (as they may originate from different sources), namely implict conversions and implicit parameters?

答:
Implicit in scala means two different things

Implicit Parameters.  These appeared in Haskell, and maybe other languages first.  Supporting evidence: This paper from 2000 and GHC 5.04.1 documentation (Sept-2002, before there was a Scala)

Implicit conversions.  I don't know the first language to have these, but they were in C# 1.0 (using the implict keyword) which pre-dates the first version of Scala by about a year.

Title: Historical origins of Scala implicits


答:
The stakes are lower, the job is easier, and management rarely sees the value in good design.  System instability, maintainability, and integrity are an "IT" problem--not a "Business" problem.  All executives have one thing in common.  They are either 95% focused on money, or they report to someone who is.

The rest of the battle is with your fellow programmers.  Many of them cannot or will not commit to thinking about a problem before coding begins.  Due to the above, a good deal of these people are senior developers, making it even more difficult to get a good design into production.

I have watched project leads waste years adding ad-hoc features and fixes to projects that were rocky to begin with, and then shoot down every attempt to bring order to the chaos with phrases like "too complicated" or "wasting time."  It is not pleasant to watch a major project spiral to its inevitable doom because management will not admit they are building their own prison on a daily basis; however, I fear it is an unfortunate reality that many developers have witnessed and--for better or worse--learned from.

I try to find a medium in my work.  I write no more code in "tainted" projects than is absolutely necessary, and I take every opportunity to move functionality out of them.  "Between projects," I spend time on design and cleanup in the projects I actually have control over.

In the end, it is a big mess of politics and personal integrity that 75% of the world's programmers don't have the stomach for.  I can barely stand it, myself.


答:
Yes, there are different ways of entering a data in a short format. The CLDR chart on Md notations illustrates the variation. Many languages use d/M notation, but d.M, M-d, and other notations are used, too. The notations used in CLDR are explained in the LDML specification; “Md” stands for month and date notation consisting of shortest possible numeric notation for month, M, and day, d, with language-dependent punctuation and order.

The M/d vs. d/M case is particularly problematic, because both notations are used in English, as well as in other languages.

Data consisting of two numbers separated by a slash should be accepted on input only if you can be sure to know which of the two different notations M/d and d/M is meant. When can you be sure of such things? Just giving people instructions doesn’t guarantee anything. Calendar widgets for input have their problems, but at least they avoid the confusion between 4/7 and 7/4.

Title: International two-part date formats

Body:
Do people outside of the USA use two-part date abbreviations for the current year? For instance, representing the last day of May, you might see someone enter 5/31 into a date field.

Do international users do something similar? In a country that ordinarily uses dd/MM/yyyy would they use 31/5 or some such?


答:
First of all, I love this question. I've written like three 1000 word answers and they were all horribly wrong by the time I got to the end of them.

The problem with attempting to compare the two as analogous, I think, is that programming is a modelling process that can be as abstract or tightly bound to concrete as you want.

Structural engineering theory, on the other hand, is tightly bound to very specific sets of reality-based laws that you have to conform to. You can't just alter the context or the laws. The problem itself is rooted in those laws. In programming, however, sometimes the solution is actually altering the nature of the question or simply placing it in a different context.

Whether the MVC pattern, for instance, is a perfect fit, has a lot to do with that context. A desktop application typically deals in one language and one language only, not counting config files.

The front end of a web app on the other hand, consists primarily of two declarative (non-programming) languages and JavaScript. The one physical thing you can't entirely abstract away is the fact that there is always this http wall to chuck things over between server and browser. Regardless of how you bury it in code, that takes time and asynchronous design.

Obviously you can't use a popular and well-regarded pattern like MVC to handle front end concerns on the web exclusively without altering the way you might handle it in a desktop app context. In fact I would argue, you should be aware of what makes MVC useful but not even try to implement it in a particularly exacting or wholesale manner. The web app paradigm is unique in that all the look-at-me stuff is handled by the user's browser and all the data/model-ish stuff is typically on the server somewhere. But where does that leave the controller? All on the server or all on the front end? Somebody has to own that. Or maybe MVC isn't 100% the best fit for the scenario. Not a bad fit for .NET back end stuff. Not terrible in the context of specific UI widgets. But attempting to apply it to everything for the sake of consistency could be a bad move, IMO.

Building a house solves a problem. Typical programming problems, however, often involve solving problems within problems and sometimes the solution is to redefine the outer problem. Reality isn't especially keen on that idea unfortunately.


问:
Scrum in a consulting environment?
Is it possible to introduce scrum to a consulting environment? On any given week I might belong to 4 different teams, each with a different PM, BA and dev team (I am a designer). It doesn't seem feasible, time wise, to be able to be part of that many teams/projects as there would need to be daily stand-ups for each, sprint reviews, etc. I should add these projects are not necessarily software, but mainly ecommerce web projects.

Can someone who has done this speak to how you approach it?

Edit

I think my situation is different and I should have discussed it further.

Our dev team is in India, so finding a time in the US morning/India evening for daily stand-ups are hard, especially when we almost always have client calls in the US morning/India evening so dev can be present if necessary. Instead, what our PM's have done is have 1 daily meeting for the US team (BA, Design). However, they go through ALL the projects at once. So, if you're not on that project, you're screwed and have to wait till your project comes up. This can be 30min-75min a day, for me. Insane. This does NOT cancel our weekly status call (30m-1h) with the client (x however many projects you are on). This is obviously not scrum, as there are no devs present during any of this and it's just action items being listed for the US team. However, I'd love to get to a point where our 'scrum-like' dev team (they develop in sprints and have sprint planning meetings) can be part of daily standups with the US team and we transition to an actual scrum framework.

答:
How much time do you spend in team meetings for each project, each week?

I'm going to assume that there is a weekly status meeting for each project, and that each meeting runs for about an hour.

A 10min scrum each day for each project would save you 10min a week for each project. Doesn't seem like much, right? But in that hour long status meeting, how much time do you prepare to go to it?  It ends up pulling everyone on the team from the zone. It sucks if you haven't even worked on that project that week b/c you end up doing a huge context switch that is a full hour block of your time for a project that isn't so high on your priority list atm.

With a scrum it is fast. Everyone finds out who is working on what daily. PMs can get the quick overview of their project, devs know who is working on what part so bottle necks can be identified sooner and team leads can see quickly who is going to go over on a ticket and do some damage control before it gets out of hand.

I work in a multi project environment, and I have to say I prefer the projects that are run with scrum over the traditional status meeting. We tend to be on time and on budget more, and it is refreshing to know if someone is actually spending time on that project on any given day.

One project I was on at the end of last year moved to scrum near the end. The PM cancelled the weekly status meeting one day, then sent out a meeting invite for that afternoon. We did a quick status update, then he scheduled another meeting for two days later. We continued at every other day until crunch time, the it turned into a morning stand up and the PM normally brought donuts to encourage us to all be there.

The project went from being a set of tasks that the devs would get to, to clearly defined goals and tickets to work on by the next meeting. When you have to give your status update tomorrow and not next week, you want to make sure you have something to say. :-)

I honestly believe scrum can fit into any project if the team is committed to it. It opens up communication so that everyone is on the same page, something that you expect a weekly status meeting to do, but rarely does.

Title: Scrum in a consulting environment?


问:
What are the alternatives to "overriding a method" when using composition instead of inheritance?
If we should favor composition over inheritance, the data part of it is clear, at least for me.

What I don't have a clear solution to is how overwriting methods, or simply implementing them if they are defined in a pure virtual form, should be implemented.

An obvious way is to wrap the instance representing the base-class into the instance representing the sub-class. But the major downsides of this are that if you have say 10 methods, and you want to override a single one, you still have to delegate every other methods anyway. And if there were several layers of inheritance, you have now several layers of wrapping, which becomes less and less efficient. Also, this only solve the problem of the object "client"; when another object calls the top wrapper, things happen like in inheritance. But when a method of the deepest instance, the base class, calls it's own methods that have been wrapped and modified, the wrapping has no effect: the call is performed by it's own method, instead of by the highest wrapper.

One extreme alternative that would solve those problems would be to have one instance per method. You only wrap methods that you want to overwrite, so there is no pointless delegation. But now you end up with an incredible amount of classes and object instance, which will have a negative effect on memory usage, and this will require a lot more coding too.

So, are there alternatives (preferably alternatives that can be used in Java), that:

Do not result in many levels of pointless delegation without any changes.

Make sure that not only the client of an object, but also all the code of the object itself, is aware of which implementation of method should be called.

Does not result in an explosion of classes and instances.

Ideally puts the extra memory overhead that is required at the "class"/"particular composition" level (static if you will), rather than having every object pay the memory overhead of composition.

My feeling tells me that the instance representing the base class should be at the "top" of the stack/layers so it receives calls directly, and can process them directly too if they are not overwritten. But I don't know how to do it that way.

[EDIT] It seems that many people reading this question think that I am debating if I should use Composition or Inheritance, and that "guiding" me to the one or the other will solve my problem. This is not the case. I always use inheritance when I can, for the simple fact that composition requires more coding, and also more memory. No need to convince me that inheritance is not evil.

I have a very good reason to want to use composition. I want to create a system that model domain objects that can "change nature" over time. That is they can both gain and loose functionality/properties over time, as a result of some actions. This is a lot more natural when modeled as composition.

If the components that can be dynamically added and removed where composed only of properties, it would be easy. In fact I have already found 14 different possible designs that support that case, with varying compromise on code complexity, memory usage, and speed.

The real problem comes when all those components need to be aware of each other, and talk to each other. This is not required when they are just "beans" (in the Java sense). I want to know if there are any, and hopefully several, ways of allowing the components to talk to each other, and more specifically how to have several components of the same type, where one serves as base-class and the others progressively override some of it's methods.

I can see two ways to simulate the overriding present in inheritance.

The first is to have a base component, and all overriding components are built as wrapper on top of another component of the same type. Like that, you can choose at runtime which hierarchy of components you want. This is like pipes and filters. But the problem is that with inheritance, not only can the derived class call methods of the base class, but it works the other way around too. A base class can declare a pure virtual method, which is implemented by the sub-class, and the base class can call this method. I don't see how to accomplish that using whole component wrapping. Also, if we have N inheritance/wrapping layers, then calls to method of the base component then gets N level of delegation, even if the method was not overwritten by any of the wrapping components.

The other alternative, like I said in "One extreme alternative ...", is to do it like above, but forcing each component to contain a single method. In that case we solve the problem of the base-class not seeing/calling the methods of the derived classes, for all methods, except it's own method. So it works now correctly for all cases except for recursion. But the price we pay in memory consumption is high, at least in Java. And Java isn't "functional", so there is a lot of syntax overhead to turn every object method into an individual object.

If there any better alternatives then the two mentioned above, I would like to know about it.

答:
I have come to a working example that shows the properties I desired from the solution. It is somewhat unwieldy, but that is always the case in static languages when using composition to do what inheritance was made for (IMO).

The idea is that you simulate a virtual dispatch table using a singleton class instance, where you have one field per method, pointing to the domain interface. So you can set each field of the VDT to a different implementation if you want, and the implementations are decoupled. And in your real object, you just need one extra reference to that VDT, which is immutable and shared by all your instances.

Here is the code example


问:
How to refuse to give an access to passwords to a customer without being unprofessional or rude?
Let's say you're creating a website for a customer. This website has its own registration (either combined with OpenID or not). The customer asks you to be able to see the passwords the users are choosing, given that the users will probably be using the same password on every website.

In general, I say:

either that it is impossible to retrieve the passwords, since they are not stored in plain text, but hashed,

or that I have no right to do that or that administrators must not be able to see the passwords of users, without giving any additional details.

The first one is false: even if the passwords are hashed, it is still possible to catch and store them on each logon (for example doing a strange sort of audit which will remember not only which user succeeded or failed to logon, but also with which password). The second one is rude.

How to refuse this request, without being either unprofessional or rude?

答:
Of course you want to be nice, you could indicate that this request is an unusual request and that it requires approval from higher authorities. It would be nice to explain the impact of this act on the organization and the users. This is to ensure that bot you and the customer are in full understanding of the situation. You must keep everything in writing of course.

You could phrase the situation in a policy statement and ask the major stake holder/manager of the system to approve or deny the policy and use that as a backup documentation for your response to the request. You may also want to add to it the fact that users will be notified of the fact that their passwords are not secret.

It is all a mater of policy, nothing more and nothing less.


答:
Just say that you don't want to experiment life in prison :) Because you know what they ask you, if it's clearly for an illegal use of users passwords, will lead them to a lot of big problems. I think the best way is to try to teach them why it's really bad to do things like that.

But the real problem is, imho, the fact that you work for thieves while you dislike thieves. Instead of finding a way on how to not be too rude with people you dislike, wouldn't it be better if you just stop working for them? I would suggest that you add some clauses about what you are not ready to do in your futur contracts in order to avoid that kind of situations.

Anyway the fact that you're not ready to do what they ask you to do because that's illegal honors you.

Title: How to refuse to give an access to passwords to a customer without being unprofessional or rude?

Body:
Let's say you're creating a website for a customer. This website has its own registration (either combined with OpenID or not). The customer asks you to be able to see the passwords the users are choosing, given that the users will probably be using the same password on every website.

In general, I say:

either that it is impossible to retrieve the passwords, since they are not stored in plain text, but hashed,

or that I have no right to do that or that administrators must not be able to see the passwords of users, without giving any additional details.

The first one is false: even if the passwords are hashed, it is still possible to catch and store them on each logon (for example doing a strange sort of audit which will remember not only which user succeeded or failed to logon, but also with which password). The second one is rude.

How to refuse this request, without being either unprofessional or rude?


答:
Tell him the first part. That you are storing the passwords in a hash. And that all password systems work this way. The administrator can change passwords, reset passwords, but can't read passwords. If your customer is knowledgeable about programming, they may know that you could intercept the passwords before the hash.

Now move on to the second part. Does the site have a privacy policy or terms of use. Using the site to collect the passwords would be in violation of most of these policies. If the customer is insistent of collecting this information, explain that this would render his site useless and a ghost town if the community couldn't trust the site.

If it becomes clear that their intent is to steal passwords. Run. Find a new job or a new contract. If you work for a company on this contract tell them what you know.


答:
Glenn Vanderburg presents a great view on the differences between software engineering and more traditional engineering disciplines:
http://www.youtube.com/watch?v=NP9AIUT9nos

If a civil engineer could test his designs without any costs before building the final thing he would make much less use of theory.
If within seconds he could build a bridge a thousand times for free to test when it will break he would do so instead of spending months calculating when it might brake in theory...

In software development thats exactly what you do. Instead of calculating how fast your algorithm is in theory you can just test it and know the answer within seconds.

In fact most software today isn't limited anymore by physical constraints like computing power or memory. The limitation of software is the complexity that amounts in larger and larger systems. Its managing this complexity by keeping the system comprehensible by humans what makes the huge challenge in programming today.


答: Surely you are only storing hashed passwords so it is impossible. If not you have bigger problems. So that is the correct response.</p>


答:
One common problems in Scrum is that sometimes you'll get a Procrustean manager who wants to do things "by the book". They forget that the goal of using Agile/Scrum isn't to do Agile/Scrum but to deliver better quality and more user responsive software in an iterative fashion. You also get a lot of "Scrum In Name Only" managers who think that having a short daily meeting is all there is to Scrum. It can also become an enabler for micro-management prone managers.

In your situation, I think you and the Scrum masters in the various groups should be able to determine if you're needed for a stand-up on a particular day. For example, if the team is currently working on sprint that doesn't involve you directly, such as working on object models and the database, then you don't need to be there.

Given that you're providing work for multiple teams, you're more like a vendor, an ancillary role, rather than a development team member, a core role. That may be the way to approach it if your management is too by the book. If you're working alone, you may end up solo scrumming on your sprints. There was a good discussion of doing a solo scrum in this thread.

Title: Scrum in a consulting environment?

Body:
Is it possible to introduce scrum to a consulting environment? On any given week I might belong to 4 different teams, each with a different PM, BA and dev team (I am a designer). It doesn't seem feasible, time wise, to be able to be part of that many teams/projects as there would need to be daily stand-ups for each, sprint reviews, etc. I should add these projects are not necessarily software, but mainly ecommerce web projects.

Can someone who has done this speak to how you approach it?

Edit

I think my situation is different and I should have discussed it further.

Our dev team is in India, so finding a time in the US morning/India evening for daily stand-ups are hard, especially when we almost always have client calls in the US morning/India evening so dev can be present if necessary. Instead, what our PM's have done is have 1 daily meeting for the US team (BA, Design). However, they go through ALL the projects at once. So, if you're not on that project, you're screwed and have to wait till your project comes up. This can be 30min-75min a day, for me. Insane. This does NOT cancel our weekly status call (30m-1h) with the client (x however many projects you are on). This is obviously not scrum, as there are no devs present during any of this and it's just action items being listed for the US team. However, I'd love to get to a point where our 'scrum-like' dev team (they develop in sprints and have sprint planning meetings) can be part of daily standups with the US team and we transition to an actual scrum framework.


答:
Does the web site have a "Privacy Statement"? And does that statement include something about handing out "sensitive information"?

In that case I would probably say, "I am not at liberty to hand out sensitive information about the user's. That is in clear violation of our own privacy statement!" (The exclamation mark here is important). If you don't have a privacy statement, I would say the same, except for the last sentence.

The persons who ask such questions shouldn't be given false excuses, such as it is technically impossible. They should be educated in the truth, the user's passwords are private, and it is morally and ethically wrong (and probably also illegal as someone mentioned) to gather them from the system.


问:
Does a team of developers need a manager?
Background:

I'm currently part of a team of four: 1 manager, 1 senior developer and 2 developers. We do a range of bespoke in-house systems / projects (e.g. 6-8 weeks) for an organisation of around 3500 staff, as well as all the maintenance and support required from the systems that have been created before. There is not enough of us to do all the work that is potentially coming our way - we're understaffed. Management acknowledge this, but budget restraints limit our ability to recruit additional members to the team (even if we make the salary back in savings).

The Change

This leaves us where we are now. Our manager is due to leave his role for pastures new, leaving a vacancy in the team. Management are using this opportunity to restructure our team which would see the team manager role replaced by another developer and another senior developer. Their logic being that we need more developers, so here's a way of funding it (one of the roles is partially funded from another vacant post).

The team would have no direct line manager and the roles and responsibilities would be divided up between the seniors and the (relatively new to post) service manager (a non-technical role with little-to-no development knowledge/experience whose focus is shared amongst a number of other teams and individuals) - who would be our next actual manager up the food chain.

I guess the final question is:

Is it possible to run a development team without an manager? Have you had experience of this? And what things could go wrong / could be of benefit to us?

I'd ideally like to "see the light" and the benefits of doing things this way, or come up with some points for argument against it.

答:
Someone needs to be the manager, but in your team's case, I don't think this is a full-time position. Hire another sr. dev and make one of them the manager. Ideally, the one who best fits being a manager and not necessarily the best programmer.

The manager needs to have the final decision where there is no concensus, so the person should be technically qualified. Evaluating the other programmers, the meetings, and fending off senior management is part of the job.

Suggested Reading: The Year Without Pants. Even a large software project (WordPress), can go without direct managers, but there are some tasks (no one wants to do/are very hard) or require integrating a large number of devs for the same task, can be very difficult without some central control.


答:
The greater the risks, the more you need "air cover".  This is what a manager is really supposed to provide.  While the team does the work, the manager is supposed to ensure that there is nothing that will keep the team from achieving team goals. Whether it's tweaking the schedule, running interference between the team and the sales staff, or simply making sure the team are paid on time and that the coffee machine remains in working order.  A really great manager allows the team to function almost as if the manager isn't there.

The reality of course is that most managers utterly fail at this.  They either micromanage, or they are rendered obsolete so that the upper echelons of the company can control things more directly, and the truly great managers are a rare bird indeed. As far as a software team is concerned, there are some pros and cons both ways when it comes to having a hierarchical or flat team structure.  If the team is very small, and the work done requires very little overlap (and by that I mean everyone has an independent project), then it's been my experience that a flat (aka unmanaged) team structure can work very well if all of the team members are disciplined. It's also been my experience however that where there is a great deal of overlap in the work that the team members do, where there are two or more relatively strong personalities, or where there is a relatively stressful working environment with a busy workload, then having a team leader or a manager with clearly defined responsibilities is generally essential.

There are a lot of factors involved, however it really boils down to the personalities involved, their individual motivations and career objectives, and the example and guidance provided by upper management that will determine how necessary a manager or team leader position is.  Generally, if there is any chaos, and when the team is asking for it, then the team clearly needs leadership. If things generally tick along ok without management input, then perhaps the team can manage within a non-hierarchical structure for a time... at least until the workload and schedule becomes too difficult to manage.

Title: Does a team of developers need a manager?

Body:
Background:

I'm currently part of a team of four: 1 manager, 1 senior developer and 2 developers. We do a range of bespoke in-house systems / projects (e.g. 6-8 weeks) for an organisation of around 3500 staff, as well as all the maintenance and support required from the systems that have been created before. There is not enough of us to do all the work that is potentially coming our way - we're understaffed. Management acknowledge this, but budget restraints limit our ability to recruit additional members to the team (even if we make the salary back in savings).

The Change

This leaves us where we are now. Our manager is due to leave his role for pastures new, leaving a vacancy in the team. Management are using this opportunity to restructure our team which would see the team manager role replaced by another developer and another senior developer. Their logic being that we need more developers, so here's a way of funding it (one of the roles is partially funded from another vacant post).

The team would have no direct line manager and the roles and responsibilities would be divided up between the seniors and the (relatively new to post) service manager (a non-technical role with little-to-no development knowledge/experience whose focus is shared amongst a number of other teams and individuals) - who would be our next actual manager up the food chain.

I guess the final question is:

Is it possible to run a development team without an manager? Have you had experience of this? And what things could go wrong / could be of benefit to us?

I'd ideally like to "see the light" and the benefits of doing things this way, or come up with some points for argument against it.


答: From my experience, I can testify that this is common practice at least in Germany (31. 5. or 31. 05.) and the Netherlands (31-5, 31-05). Additionally, both countries regularly use 05/12 (sometimes 05/'12) to mean "May 2012".</p>

Title: International two-part date formats


答: No manager = No accountability=Mess on the long run at least. Every one will do things as he/she likes and middle management will run around not sure whom to talk to or who is right and who is wrong for a given problem or request. Unless the tasks are so segregated and have little or no relationships, having many 'small mangers' does not work in development because there are so many ways to do any given task and because management requires expertise a busy developer may not always have acquired. There is a need for someone to see the full picture.  The suggested style may work for teams providing support of legacy or current applications but not in development. To be optimistic, it will take your organization and some trials and  failures before this works out reasonably well.</p>


答:
I'm currently working on a small team without a manager. Small company. It works well.

Your mileage may vary.


问:
How does PHP internally represent strings?
UTF8?

UTF16?

Do strings in PHP also keep track of the encoding used?

Let's look at this script for example. Say I run:

```<code>$original = "शक्नोम्यत्तुम्";
</code>```

What actually happens?

Obviously I think $original will not contain just 7 characters. Those glyphs must each be represented by several bytes there.

Then I do:

```<code>$converted = mb_convert_encoding ($original , "UTF-8");
</code>```

What will happen to $converted? How will $converted be different from $original?

Will it be just the exact same byte sequence as $original but with a different encoding?

答:
A PHP string is just a sequence of bytes, with no encoding tagged to it whatsoever. String values can come from various sources: the client (over HTTP), a database, a file, or from string literals in your source code. PHP reads all these as byte sequences, and it never extracts any encoding information.

As long as all your data sources and destinations use the same encoding, the worst thing that can happen is that string positions are wrong (if you use multi-byte encodings), since PHP will count bytes, not characters.

But if the encodings don't match (e.g. you write a string literal in a source file stored as UTF-8, and then send it to a database that expects Latin-1), PHP will not perform any conversion for you: it will happily copy the bytes over raw.

The sanest solution is this:

Set PHP's internal encoding to UTF-8.

Save all your source files as UTF-8.

Use UTF-8 as your output encoding (don't forget to send suitable Content-type headers).

Set the database connection to use UTF-8 (SET NAMES UTF8 in MySQL).

Configure everything else to be UTF-8 if at all possible.

For anything that you can't control (e.g. third-party web services), make sure you know the encoding, and convert to UTF-8 as early as possible, and back to the other encoding as late as possible.

Why UTF-8? Because it can represent all Unicode characters and thus supersedes all the existing 7-bit and 8-bit encodings, and because it is binary compatible with ASCII, that is, every valid ASCII string is also a valid UTF-8 string (but not vv.).

In your example, what happens is this.

First, you save your source file; your text editor is probably configured to use UTF-8, so your string literal ends up UTF-8 encoded on disk. PHP reads this file, interpreting the string as a series of bytes; $original now holds a UTF-8 encoded string of 7 characters, which is just a byte sequence (though it contains more than 7 bytes, because each character is represented by two or more bytes). If you then call echo $original, the encoded string is sent to the client as-is; if you have told the client to expect UTF-8, everything is fine, but if you haven't, PHP has no way to tell the difference, and you'll end up with garbage in the browser. As an experiment, try this:

```<code>$original = "शक्नोम्यत्तुम्";
echo strlen($original);
</code>```

strlen is encoding-agnostic and assumes a fixed-width 8 bit encoding, that is, one byte per character, so it will count bytes, not characters.

Body:
A PHP string is just a sequence of bytes, with no encoding tagged to it whatsoever. String values can come from various sources: the client (over HTTP), a database, a file, or from string literals in your source code. PHP reads all these as byte sequences, and it never extracts any encoding information.

As long as all your data sources and destinations use the same encoding, the worst thing that can happen is that string positions are wrong (if you use multi-byte encodings), since PHP will count bytes, not characters.

But if the encodings don't match (e.g. you write a string literal in a source file stored as UTF-8, and then send it to a database that expects Latin-1), PHP will not perform any conversion for you: it will happily copy the bytes over raw.

The sanest solution is this:

Set PHP's internal encoding to UTF-8.

Save all your source files as UTF-8.

Use UTF-8 as your output encoding (don't forget to send suitable Content-type headers).

Set the database connection to use UTF-8 (SET NAMES UTF8 in MySQL).

Configure everything else to be UTF-8 if at all possible.

For anything that you can't control (e.g. third-party web services), make sure you know the encoding, and convert to UTF-8 as early as possible, and back to the other encoding as late as possible.

Why UTF-8? Because it can represent all Unicode characters and thus supersedes all the existing 7-bit and 8-bit encodings, and because it is binary compatible with ASCII, that is, every valid ASCII string is also a valid UTF-8 string (but not vv.).

In your example, what happens is this.

First, you save your source file; your text editor is probably configured to use UTF-8, so your string literal ends up UTF-8 encoded on disk. PHP reads this file, interpreting the string as a series of bytes; $original now holds a UTF-8 encoded string of 7 characters, which is just a byte sequence (though it contains more than 7 bytes, because each character is represented by two or more bytes). If you then call echo $original, the encoded string is sent to the client as-is; if you have told the client to expect UTF-8, everything is fine, but if you haven't, PHP has no way to tell the difference, and you'll end up with garbage in the browser. As an experiment, try this:

$original = "शक्नोम्यत्तुम्";
echo strlen($original);

strlen is encoding-agnostic and assumes a fixed-width 8 bit encoding, that is, one byte per character, so it will count bytes, not characters.


问:
The model to sell apps on App Store is better with a paid only version?
Rob Napier, the author of iOS 5 Programming Pushing the Limits, mentioned there are several models of selling apps on the App Store:

Write an app and sell it

Publish a free and a full version

Ad supported by third party or by iAd

In App purchase

Surprisingly, the author said that the most workable model is (1) in terms of sales.  I would think that (2) with fairly limiting ability for the free version can bring more sales, as people without trying, might not plunge down $0.99 or $1.99 for something they haven't tried?  I for one, might not have purchased Angry Birds if I didn't try their free version first.  Also, I think it also depends on the situation: for example, if the app is an alarm clock, and there are already 5 alarm clocks in App Store that are free, then your app that is $0.99 might not be that eagerly purchased (or they may end up never trying your app).  But if yours is also free, and users really like it out of all the other ones, then they may think, $0.99 is nothing to get a good alarm clock, and gladly pay you the $0.99 in exchange for a full version of the alarm clock, for something that they can't get with the free version. (such as the full version can let you choose a song from your Music Library for the alarm).

Could (1) work only if the user definitely want it and have no substitute?  How might it work the best?

答:
Not to mention service oriented designs that allow you to charge for the service, not the UI front-end. But I will leave that out of this discussion.

Common to all models is the process of writing the app, publishing it on the AppStore, and then advertising it so that people know it is out there. There is little to no problem if the app is unique (or offers unique services) and if the advertising has been excellent. Positive reviews from trusted people (friends, prestigious bloggers, magazines) boost your sales. But what if your app is not unique or if the advertising has not been to the sky or if reviewers just didn't have the time to try your app out? What if you app is not unique but just better (or so you hope) than the 15 others out there? How do you make that first sale? How do you get that first positive review? How do you get that tweet or Facebook like?

Pause. Haven't we solved this problem already? Fast rewind 10 years and we are in the era where the PC is gaining ground. Thousands of applications are being written and published on the web or discs. They are being advertised on the nascent web or popular PC magazines. There are many similar apps that offer more or less the same functionality but each has a specific way of doing it. How did we then get the user to buy our application in those days? And as most people would remember, back in those days (as is still the case today), quite a lot of paid software also came in a trial edition. There were (and are) two distinct kinds of trial software:

Time limited editions: Expires in 29/30 days. To continue using please buy a serial key or download the full version by clicking here.

Limited functionality editions: Free but comes with teasers --disabled menu items or blocking pop-ups that "encourage" the user to buy the "premium" version.

And I would say that worked out pretty well. So well that when web-services came along they adopted this model and gave away free access (limited by time or functionality). For example, many cloud "drives" give you X GB free and an option to get more by paying [more]. Some photo sharing/editing services give you a basic account and a "pro" account. If you like it, buy the premium content. The only downside to this, in the PC market at least, is that if people don't like the trial version you do not get the sales. That can mean taking a small loss because your investment in trial version would go waste. Users may not be so willing to try your later inventions too --once bitten.

Rob mentions that the 1st model has been by far the most successful. But it does not mean that the trial edition model won't get you those dollars. Quite to the contrary, given a choice to try it out, most people will try it out. Given an option to not try it out, they may not risk buying the wrong app --assuming there is a competition. Nonetheless, there are some differences between the PC/services market and the AppStore that support Rob's observation. And here is where I enter the realm of theory and speculation.

The Promise: In the PC market, you do not have an AppStore (well, leaving Mac AppStore out, it is not yet clear how it would affect consumer behaviour; am also leaving the repository market that most GNU/Linux systems come with for obvious reasons) --you have a free and open market where anyone can sell anything they want to. The biggest downside to this free and open market is the lack of trust. Unless you are a big professional/prestigious company, few people would trust that your software would be of high quality, will do what you told them it would do, and won't steal their data or do weird things to their computers. Priced software usually comes with a good reputation --if it is expensive, it must be good --but note the word "usually". In the AppStore world, Apple's policy on design, app advertisement (not iAd but your app's home page), developer identity verifications, membership fees, and programming has ensured that most users (even those who are not aware of such policies) have come to expect that apps will do what the developers say they will and that they will be of good (if not high) quality.

The cost: The biggest inhibition to buying something is the risk that you will make the wrong decision. This risk is measured by the cost of the product and the cost of using the wrong product. Buying a free virus (labeled as time management software) has a higher cost than buying a $4 coffee that didn't taste well. I have covered the first type of cost in #1. So, let's focus on #2 now. It is conventional wisdom in the FMCG retail world that brand shifts happen most at the lowest priced products. Most companies would enter the market with low priced or miniature versions of their products. Consumers aren't afraid of trying out something new if it does not cost much. Trying out a $15 tube of lotion is more risky than trying out a $2 soap. Many companies enter this market with a $2 soap and lure the customer into the promise (#1) --then the customer is willing to try that $15 tube of lotion. The point is not brand loyalty but that customers are more willing to experiment (and lose the occasional buck) for a $2 product than they are for a $15 product. Barring a handful of the apps that are priced in double/triple digits, most apps are $0.99 - $2.99 on the AppStore. For someone who buys $400 phones, that may not be too much. Sure, the customer will regret losing that $0.99 (and probably won't trust your company again) but not that much.

Now that the promise has been made and the cost of getting it wrong is not so high you will see that the 1st model can get quite a lot of buyers. An impartial review, right where you make the purchase, adds to credibility and reinforces the purchase/reject decision. Of course, it is common sense to think that the 2nd model (and I do believe) will get more buyers but it also costs more to produce and maintain two versions. Plus, you risk negative reputation with a poor trial version feedback --which is nominal because it applies to the paid version too. But at least with the paid version you recover some of your cost.

And hence, in the AppStore world, most developers initially went for the 1st model --it allows them to recover more cost (including that $99/year) than the 2nd model allows. We can see a growing trend in the ad supported trial version model --a combination of 2nd and 3rd models. Developers/companies who can get the two version cost tamed (e.g., by better software design and support model) can make more money with the 2nd model.


答:
You need a technical lead and a manager, yes.
I personally think the technical lead is much more important, though.
(If you're not sure what that is, it's basically the person that hands out the work and makes sure everyone's doing what they should be.)</p>


答:
Being a little cynical about the actual usefulness of 99% of the Apps in the AppStore, look at it this way.

If you got to watch the first 20 minutes of every single movie that came out at the movie theater for free, do you think you'd pay full price for more or less movies? Most movies are not that great, but we can't really determine that until we go to the theater and pay our $10 a person. We take a gamble.

The free versions of apps allow us to determine the usefulness of an App without paying for it. Most of the apps we download on mobile devices are not useful. If you see an App in the Market that might be useful for $0.99 but with no free version you might be tempted to "try it out" as it's only $0.99.

Title: The model to sell apps on App Store is better with a paid only version?

Body:
Rob Napier, the author of iOS 5 Programming Pushing the Limits, mentioned there are several models of selling apps on the App Store:

Write an app and sell it

Publish a free and a full version

Ad supported by third party or by iAd

In App purchase

Surprisingly, the author said that the most workable model is (1) in terms of sales.  I would think that (2) with fairly limiting ability for the free version can bring more sales, as people without trying, might not plunge down $0.99 or $1.99 for something they haven't tried?  I for one, might not have purchased Angry Birds if I didn't try their free version first.  Also, I think it also depends on the situation: for example, if the app is an alarm clock, and there are already 5 alarm clocks in App Store that are free, then your app that is $0.99 might not be that eagerly purchased (or they may end up never trying your app).  But if yours is also free, and users really like it out of all the other ones, then they may think, $0.99 is nothing to get a good alarm clock, and gladly pay you the $0.99 in exchange for a full version of the alarm clock, for something that they can't get with the free version. (such as the full version can let you choose a song from your Music Library for the alarm).

Could (1) work only if the user definitely want it and have no substitute?  How might it work the best?


问:
Javascript storing data
Hi I am a beginner web developer and am trying to build the interface of a simple e-commerce site as a personal project.The site has multiple pages with checkboxes. When someone checks an element, it retrieves the price of the element and stores it in a variable. But when I go to the next page and click on new checkboxes products the variable automaticly resets to its original state.How can I save the value of that variable in Javascript?

This is the code I've writen using sessionStorage but it still dosen't work when I move to next page the value is reseted.

How can I write this code so that it dosen't reset on each page change. All pages on my website use the same script.

```<code>$(document).ready(function () {
    var total = 0;

    $('input.check').click(function () {
        if ($(this).attr('checked')) {
            var check = parseInt($(this).parent().children('span').text().substr(1, 3));
            total += check;
            sessionStorage.var_name = 0 + total;
            alert(sessionStorage.var_name);

        } else {
            var uncheck = parseInt($(this).parent().children('span').text().substr(1, 3));
            total -= uncheck;
        }
    })
})
</code>```

答:
You have three basic options.

Send the data to the server and save it with the user's HTTP session. Then when you load a page that needs the data, you just pull it out and use it. This probably is not ideal for your case, but is still necessary for certain things. This is also the safest solution as it is unlikely a user can turn off any functionality in there browser to prevent it. If a full page load is too much, you can send that data with a asynchronous request (Ajax), but this does require that JavaScript is enabled. Although I don't think that is much of a problem anymore for general websites.

Save the data in a cookie. Cookies are sent back and forth with each HTTP request and response. There's a limit to how big your cookies can be, so if you are sending a lot of data, you might not want to do this. If you do, you'll want to make sure you delete the cookies when you're done with them so they don't bloat your requests and responses.

Take advantage of the client side data storage APIs in the various browsers. I am not up to speed on of this has been standardized and/or fully implemented by all major browsers yet, but the last time I checked there were libraries that abstracted away the various details. I know jQuery does this, but I'm sure there are others.

Title: Javascript storing data


问:
How do I know if I am using Scrum methodologies?
When I first started at my current job, my purpose was to rewrite a massive excel-VBA workbook-application to C# Winforms because it was thought that the new C# app will fix all existing problems and have all the new features for a perfect world.

If it were a direct port, in theory it would be easy as i just need to go through all the formulas, conditional formatting, validations, VBA etc. to understand it. However, that was not the case. Many of the new features are tightly dependant on business logic which I am unfamiliar with.

As a solo programmer, the first year was spent solely on deciphering the excel workbook and writing the C# app. In theory, I had the business people to "help" me specify requirements, how GUI looks and work, and testing of the app etc; but in practice it is like a contant tsunami of feature creep.

At the beginning of the second year I managed to convince the management that this is not going anywhere. I made them start from scratch with the excel-VBA.

I have this "issue log" saved on the network, each time they found something they didn't like about the excel-VBA app, they will write it in there. I check the log daily and consolidate issues (in my mind) mainly into 2 groups: (1) requires massive change. (2) can be fixed in current version.

For massive change issues, I make a copy of the latest excel-VBA and give it a new version number, then work on it whenever I can. For current version fixes, I make the changes in a few days to a week, and then immediately release it. I also ensure I update the same change in any in-progress massive change future versions.

This has gone on for about 4 months and I feel it works great. I made many releases and solved many real issues, also understood the business logic more and more. However, my boss (non-IT trained) thinks what I am doing are just adhoc changes and that i am not looking at the "bigger picture".

I am struggling to convince my boss that this works. So I hope to formalise my approach and maybe borrow a buzzword to confuse him. Incidentally, I read about Agile and SCRUM, about backlog and sprints. But it's all very vague to me still.

QUESTION (finally): I want to tell him that this is SCRUM! But I want to hold my breath first and ask whether my current approach is considered SCRUM or SCRUM-like? How can I make it more SCRUM-like? Note that I have only myself, there's no project leader or teams.

答:
I am writing this in the hopes that someone more wise and experienced with real world Scrum can tell me all of my mistakes.

I see Scrum as a way to provide and create customer value. Scrum sprints and story boards are all about customer value. And Agile is about being able to adapt and provide fast customer value. What value would an entire rewrite of an existing application provide the customer with? That is the first question. The second is that saying you will rewrite an entire application doesn't seem very Agile to me.

In my mind the Agile way of "rewriting" this application would be to evaluate each of the new features that you are adding and see if they can be written in small modules using C# and the Microoft Office integration points into Excel. This way as time goes on most of the code will be written in a modern, management language and runtime.

The biggest thing with Agile and even the SCRUM methodology is to always have a working application. You add feature complete functionality at each iteration. By this very nature a complete "rewrite" is not possible. However, after a long time of adding new working features, potentially using a different integration mechanism such as C#, you'll have for all intents and purposes a new application.


问:
Given number which equals the sum of some of the 10 numbers. How to determine that given number contains one of 10 numbers?
I have:

ten numbers: +1, +2, +4, +8, +16, +32, +64, +128, +256, +512.

flag == sum of some of this ten numbers.

How to determine that sum contains 2 or 32?

答:
Let's convert those numbers to binary:

```<code>1₁₀ → 0001₂
2₁₀ → 0010₂
4₁₀ → 0100₂
8₁₀ → 1000₂
</code>```

Notice the pattern? Now take 7:

```<code>7₁₀ → 0111₂
</code>```

By simply comparing the binary value, you easily see that there is 1, 2 and 4, but not 8. The same applies to any other number.

If you want to know how to determine if a number contains a flag in a specific programming language, read about bitwise operations. It is how zero or more flags can be combined to a single number, then evaluated to determine what flags are enabled.

Body:
Let's convert those numbers to binary:

1₁₀ → 0001₂
2₁₀ → 0010₂
4₁₀ → 0100₂
8₁₀ → 1000₂

Notice the pattern? Now take 7:

7₁₀ → 0111₂

By simply comparing the binary value, you easily see that there is 1, 2 and 4, but not 8. The same applies to any other number.

If you want to know how to determine if a number contains a flag in a specific programming language, read about bitwise operations. It is how zero or more flags can be combined to a single number, then evaluated to determine what flags are enabled.


答:
If you look at your numbers you could see that they are the form of 2^i where i=1...n; so only  one bit is affected by summing these numbers and there are no overflows.
Here is a table, to understand it better:

```<code>1 is 00000001
2 is 00000010
4 is 00000100
8 os 00001000
</code>```

So you could simply use bit shift and 'and' operators to get the operands of the sum.
You calculate 1 & num to get the first (least significant) bit (I presume that your number is represented by one byte and called num). If it is 1, you have 1 in your sum. You shift your number by one to the right. Now you and with 1 again: if the result is 1 you have 2 in your sum, etc.

Title: Given number which equals the sum of some of the 10 numbers. How to determine that given number contains one of 10 numbers?

Body:
I have:

ten numbers: +1, +2, +4, +8, +16, +32, +64, +128, +256, +512.

flag == sum of some of this ten numbers.

How to determine that sum contains 2 or 32?

Body:
If you look at your numbers you could see that they are the form of 2^i where i=1...n; so only  one bit is affected by summing these numbers and there are no overflows.
Here is a table, to understand it better:

1 is 00000001
2 is 00000010
4 is 00000100
8 os 00001000

So you could simply use bit shift and 'and' operators to get the operands of the sum.
You calculate 1 & num to get the first (least significant) bit (I presume that your number is represented by one byte and called num). If it is 1, you have 1 in your sum. You shift your number by one to the right. Now you and with 1 again: if the result is 1 you have 2 in your sum, etc.


答:
First, I'd recommend this Programmers SE post because it gets to good points pretty quickly: What is agile methodology?

The core to working within an Agile methodology is iterative development, so as to create value, adapt to changing customer needs, and always have a working app in front of you (as Andrew answered).

For some good points between Agile and a more Waterfall approach, which sounds like has been in your history, see: Don’t Go Chasing Waterfalls (Mini-waterfall vs Agile), the upshot of that post being

Stop thinking in terms of:

Get the requirements

Design the solution

Develop the solution

Test

Start thinking in terms of:

Figure out the first thing the user wants

Build a small piece, making sure it is right

Check with the user to  see how to make it better

Continue until user is happy

If you were to say you're operating in an Agile way, or with Agile principles in mind, you wouldn't be mistaken; my question to you would be why are you trying to convince your boss of this?  If it's because you have to explain yourself because your methodology is being negatively received by your customers/within the company, that's one thing -- and I don't think that you explaining Agile is going to change the fact that people internally are unhappy (if they are).

However, if it's to inform him or her of your development practices so that you can (and he or she can) manage expectations of the stakeholder groups, then great! In that case, you do have some more of the framework you can put in place, even as a lone developer, to keep yourself sane and keep shipping your app.

Consider the "Scrum Framework in 30 Seconds":

A product owner creates a prioritized wish list called a product backlog.

During sprint planning, the team pulls a small chunk from the
  top of that wishlist, a sprint backlog, and decides how to implement
  those pieces.

The team has a certain amount of time, a sprint, to
  complete its work - usually two to four weeks - but meets each day to
  assess its progress (daily scrum).

Along the way, the ScrumMaster
  keeps the team focused on its goal.

At the end of the sprint, the work
  should be potentially shippable, as in ready to hand to a customer,
  put on a store shelf, or show to a stakeholder.

The sprint ends with a
  sprint review and retrospective.

As the next sprint begins, the team
  chooses another chunk of the product backlog and begins working again.

Here's how that might map to your situation:

You maintain your backlog -- your list of things you/the stakeholders
want to do -- including a rough guideline of prioritization (e.g.
show-stoppers, nice-to-haves, things promised by a certain date)

Determine for yourself how often you want to release (every week? every 2 weeks? etc), and stick to that schedule

At the beginning of every sprint cycle (every week, every 2 weeks, or whatever you decide), look at the backlog and determine how many of those things you can get done, putting them into thematic groupings if possible.  Plan the next two sprints ahead if you can (put two sprint's worth of stuff into a "to do bucket")

Tell your boss "this is what I'm committing to by date X, this is what I'm committing to by date Y" -- shoot low until you get a handle on what you can commit to

Tell everyone else that nothing gets added to your to-do list for the sprint (unless it is a wild show stopper bug) but will be considered for evaluation of the next sprint.

At the end of the sprint, note the things that were done, think about what you could do better, release the app, take a breath, and start again.

It doesn't sound all that far off from what you are doing -- or are prepared to do -- now, but does provide a little structure around your work that should be beneficial.

Title: How do I know if I am using Scrum methodologies?

Body:
When I first started at my current job, my purpose was to rewrite a massive excel-VBA workbook-application to C# Winforms because it was thought that the new C# app will fix all existing problems and have all the new features for a perfect world.

If it were a direct port, in theory it would be easy as i just need to go through all the formulas, conditional formatting, validations, VBA etc. to understand it. However, that was not the case. Many of the new features are tightly dependant on business logic which I am unfamiliar with.

As a solo programmer, the first year was spent solely on deciphering the excel workbook and writing the C# app. In theory, I had the business people to "help" me specify requirements, how GUI looks and work, and testing of the app etc; but in practice it is like a contant tsunami of feature creep.

At the beginning of the second year I managed to convince the management that this is not going anywhere. I made them start from scratch with the excel-VBA.

I have this "issue log" saved on the network, each time they found something they didn't like about the excel-VBA app, they will write it in there. I check the log daily and consolidate issues (in my mind) mainly into 2 groups: (1) requires massive change. (2) can be fixed in current version.

For massive change issues, I make a copy of the latest excel-VBA and give it a new version number, then work on it whenever I can. For current version fixes, I make the changes in a few days to a week, and then immediately release it. I also ensure I update the same change in any in-progress massive change future versions.

This has gone on for about 4 months and I feel it works great. I made many releases and solved many real issues, also understood the business logic more and more. However, my boss (non-IT trained) thinks what I am doing are just adhoc changes and that i am not looking at the "bigger picture".

I am struggling to convince my boss that this works. So I hope to formalise my approach and maybe borrow a buzzword to confuse him. Incidentally, I read about Agile and SCRUM, about backlog and sprints. But it's all very vague to me still.

QUESTION (finally): I want to tell him that this is SCRUM! But I want to hold my breath first and ask whether my current approach is considered SCRUM or SCRUM-like? How can I make it more SCRUM-like? Note that I have only myself, there's no project leader or teams.


答:
I concur the answers above, but there's an important consideration.

A "manager" is a position, but think in terms of roles, a manager is someone who has certain responsibilities. Regardless of what these responsibilities are, negotiations with CxO, writing up reports, managing vacations, or even filling up a coffee machine - your team needs someone responsible for this.

Pro's — It can be one of you, and this could become a great boost to his/her career. The rest of team will get someone who is not "assigned from above", but someone who deeply understands the team's needs.

Of course, don't forget to negotiate how much time she would spend for managerial tasks, and what remains for what she used to do before.

Con's — It is also possible none of you would wish to be a manager. There's nothing bad in this. Many developers would rather enjoy with keyboard and other developers, than "wasting time" with reports, diagrams, and meetings. Trust me, five minutes with screaming boss every morning is extremely demotivating! :)

So, I would re-word you question like this:

Is it possible to run a development team without a dedicated manager? — Yes.

Is your team ready for that change? — I can't say.

Try it. It just worth trying.


问:
Thinking skills to be a good programmer
I have been programming for last 15 years with non-CS degree. Main reason I got into programming was that I liked to learn new things and apply them to my work. And I was able to find and fix programming errors and their causes faster than others. But I never find myself a a guru or an expert, maybe due to my non-CS major. And when I saw great programmers, I observed they are very good, much better than me of course, at solving problems.

One skill I found good in my mid-career is thinking of requirements and tasks in a reverse order and in abstract. In that way, I can see what is really required for me to do without detail and can quickly find parts of solution that already exist.

So I wonder if there are other thinking skills to be a good programmer. I've followed Q&As below and actually read some of books recommended there. But I couldn't really pickup good methods directly applicable for my programming work.

What non-programming books should a programmer read to help develop programming/thinking skills?

https://softwareengineering.stackexchange.com/questions/44654/skills-and-habits-to-develop-to-be-good-at-programming-im-a-newbie

答:
Remeber whenever you start learning the Programming language First learn the Concept and at once test it means do it practically once you do this exercise you will not forget the concepts and its use.

Next the well known "practice make perfect" and it also applies here in programming. The more you play with the code , run the code, read the existing code to correct it, you would become not good but gr8 programmer.

Title: Thinking skills to be a good programmer


问:
When too much encapsulation was reached
Recently, I read a lot of good articles about how to do good encapsulation. And when I say "good encapsulation", I am not talking about hiding private fields with public properties; I am talking about preventing users of your API from doing wrong things.

Here are two good articles about this subject:

http://blog.ploeh.dk/2011/05/24/PokayokeDesignFromSmellToFragrance.aspx

http://lostechies.com/derickbailey/2011/03/28/encapsulation-youre-doing-it-wrong/

At my job, the majority of our applications are not destined for other programmers but rather for the customers.

About 80% of the application code is at the top of the structure (Not used by other code). For this reason, there is probably no chance ever that this code will be used by other application.

An example of encapsulation that prevents users from doing wrong things with your API is returning an IEnumerable instead of IList when you don't want to give the ability to the user to add or remove items in the list.

My question is: When can encapsulation be considered simply OOP purism, keeping in mind that each hour of programming is charged to the customer?

I want to create code that is maintainable and easy to read and use, but when I am not building a public API (to be used by other programmers), where can we draw the line between perfect code and not so perfect code?

答:
Answer: When you have your interface complete, then automatically you are done with encapsulation. It does not matter if implemenation or consumption part is incomplete, you are done since interface is accepted as final.

Proper development tools should reduce cost more than tools cost themself.

You suggest that if encapsulation or whatever property is not relevant to market offer, if customer does not care then the property has no value. Correct. And customer cares nearly about no internal property of code.

So why this and other measurable properties of code exist ? Why deveoper should care ? I think the reason is money as well: any labor intensive and costly work in software development will call for a cure. Encapsulation is targeted not at the customer but at user of library. You saying you do not have external users, but for your own code you yourself are the user number 1.

If you introduce risk of errors into daily use, then you increase the cost of development.

If you spend on reducing the risk, you will increase the cost of development.

Market and evolution keep forcing this choice. Choose the least increase.

This is all understood well. But you are asking about this particular feature. It is not the hardest one to maintain. It is definitely cost effective. But be aware about laws of human nature and economy. Tools have their own market. The labeled cost for some can be $0, but there is always hidden cost in terms of time spent on adoption. And this market is flooded with methodologies and practices with negative value.

Title: When too much encapsulation was reached


问:
Application / Code reviews for lone programmers?
Are there any services that 'for a reasonable price' will give and provide good and technical advice on applications. On a lot of projects, I'm usually the only developer, and sometimes, I think some of my work needs to be improved for efficiency, better MVC interactions, etc. It would be great if there was a professional service that actually can and will do such reviews</p>

答:
This is not really 'professional', but it may help a little?

Try to explain your design to a 10 year old (and keep their engagement).

Have a 5 year old try to break your system (make it a game to make it crash).


答:
First; for any given discipline, there is always going to be someone much better at it in some way. Don't worry about that part.

Then; a CS degree is nice and all that, and the theoretical knowledge it gives you is certainly useful, but it is by no means an indication that someone is a good programmer. Some of the best programmers are self-taught, and believe me, the world is full of CS graduates who couldn't program their way out of a wet paper bag. So don't worry about that part either.

As to what it takes to become a good programmer: I think two things are essential. One is that you need to be able to approach problems in a strictly formal way, and to think at a certain level of abstraction. If you understand pointers and recursion, you are most likely good on this front. The other one is dedication and persistence. Just like any other craft, programming takes tens of thousands of hours of dedicated, focused practice to master, it doesn't happen over night. It takes at least ten years to achieve mastery, one way or the other. If you are passionate, putting in the hours, focusing, and finding ever new challenges is going to be easy; if you're not, I guess it's still possible, but it won't be a pleasant ride.

Title: Thinking skills to be a good programmer

Body:
I have been programming for last 15 years with non-CS degree. Main reason I got into programming was that I liked to learn new things and apply them to my work. And I was able to find and fix programming errors and their causes faster than others. But I never find myself a a guru or an expert, maybe due to my non-CS major. And when I saw great programmers, I observed they are very good, much better than me of course, at solving problems.

One skill I found good in my mid-career is thinking of requirements and tasks in a reverse order and in abstract. In that way, I can see what is really required for me to do without detail and can quickly find parts of solution that already exist.

So I wonder if there are other thinking skills to be a good programmer. I've followed Q&As below and actually read some of books recommended there. But I couldn't really pickup good methods directly applicable for my programming work.

What non-programming books should a programmer read to help develop programming/thinking skills?

https://softwareengineering.stackexchange.com/questions/44654/skills-and-habits-to-develop-to-be-good-at-programming-im-a-newbie