答: What your are doing here is actually some kind of type conversion (you convert your raw data into a business object). You can use the Factory Pattern for doing exactely that (i.e., type conversions), so yeah, in some kind of way, your class is a factory (though I would use a Static Factory for that).</p>

Title: Is "Mapper" a valid design pattern or is it a variation of the "Factory" pattern?

Body:
A common pattern I see is what's known as the Mapper pattern (not to be confused with DataMapper which is something else entirely), which takes as an argument some kind of "raw" data source (e.g. an ADO.NET DataReader or DataSet) and maps the fields to properties on a business/domain object.  Example:

```<code>class PersonMapper
{
    public Person Map(DataSet ds)
    {
        Person p = new Person();
        p.FirstName = ds.Tables[0].Rows[0]["FirstName"].ToString();
        // other properties...
        return p;
    }
}
</code>```

The idea being your Gateway/DAO/Repository/etc. will call into the Mapper before it returns, so you get a rich business object versus the underlying data container.

However, this seems to be related, if not identical, to the Factory pattern (in the DDD parlance, anyways), which constructs and returns a domain object.  Wikipedia says this re: the DDD Factory:

Factory: methods for creating domain objects should delegate to a specialized Factory object such that alternative implementations may be easily interchanged.

From that quote the only difference I could think of is that the DDD-style Factory could be parameterized so it could return a specialized type of object if the need arose (e.g. BusinessCustomer versus ResidentialCustomer) while the "Mapper" is keyed to a specific class and only does translation.

So is there a difference between these two patterns or are they essentially the same thing with different names?


问:
Does a time estimate equal a promise in Scrum?
If an estimate is not a promise then as a product owner how can I deliver my projects without knowing how long it will take?

Does a Scrum team work more efficiently if we treat time estimates as a promise?

How much research (preparation, effort to understand the problem) in a story is enough to come up the right estimate?

What about unexpected technical problems (problems that can really mess your initial estimates) that come up after you estimate your work?

答:
When you estimate story points in Scrum, you should know enough to be able to actually start writing the feature. The estimate is not expected to be entirely accurate, the whole point of Agile development methodologies is that they recognise that you cannot accurately predict how long development will take.

The stage at which you make a commitment to delivering is when you accept the stories from the product backlog into a Sprint. You are promising to deliver those stories within the sprint.

If you do make this commitment, this means you are willing to do some extra hours if it looks like you aren't going to meet your promise. In reality, some stories will take longer than you thought and others will take less time than you thought.

When the team has done enough estimating, they will get better at it.

You may also want to look at...

The Clean Coder (Book) - there is a chapter in this book titled "The Language Of Commitment" and also a chapter about estimating, which is really eye-opening.

Kanban - Kanban is more of a pull style of running development - there are also combinations of Scrum and Kanban called "Scrumban", which draw from both ideas.

OwnerDisplayName: Preyash

ContentLicense: CC BY-SA 3.0

OwnerDisplayName: Sohnee


答:
Estimations are not promises etched in stone. They are the best guess the team can make about the effort required to complete the task / story.

In answer to your question "as a Product owner how can I deliver my projects with out time as a reference?", the answer is that you can and should have time as a reference (i.e. you will release on a certain date). What you do not have is the exact scope that will be in the delivery.

Note that what I said is true of each and every methodology you use for driving your development. The difference between Scrum and other methodologies (such as Waterfall), is that in Scrum this fact is acknowledged, and accounted for. What you will do, as a PO, is to prioritize your scope, and make sure that the team, at any given moment is:

Working on the most important (read: valuable) undelivered feature (task, requirement, user story)

Has successfully completed every feature that is more important than the one they are currently working on (this refers to the Definition of Done: Every completed story is tested, accepted, bug free, and feature-complete).

Having that, you can now ship, or deliver, at the drop of a hat, knowing that at any given moment, the latest build is the best product that could be shipped. This means that at the date of your original release commitment, you will deliver the best product possible.

Of course, this doesn't promise that it will consist of every story you requested of the team to develop, but you know that the remaining incomplete ones are of course the least important ones, that could easily be delivered at a later date.

Also, the estimates made by the team will be increasingly better, allowing you to have an early solid idea of what the scope will be at the end of the release. You will be able to ship a good solid product on time, with a few additional less-important features a few weeks later (you will of course be able to estimate when that will be).

As for the amount of research required - there's a law of diminishing returns in play here. If you break your stories small enough, then a little research should give you a close enough estimation. If you got them wrong, then you will amend in the next sprint and the estimates will be better. In 3-4 sprints, on average, you should have a good idea of how much scope can be delivered by the deadline (or how long it will take to complete the scope).

Title: Does a time estimate equal a promise in Scrum?

Body:
If an estimate is not a promise then as a product owner how can I deliver my projects without knowing how long it will take?

Does a Scrum team work more efficiently if we treat time estimates as a promise?

How much research (preparation, effort to understand the problem) in a story is enough to come up the right estimate?

What about unexpected technical problems (problems that can really mess your initial estimates) that come up after you estimate your work?

OwnerDisplayName: Assaf Stone


答:
Estimates of effort are a tool for forecasting.  A forecast is neither a commitment or a guarantee.  Forecasts are reevaluated continuously to account for new knowledge and should include possible alternatives such as optimistic and pessimistic variations.

We are forward looking in Agile.  Commitments add no more value to organizational planning than forecasts.

Highly recommend Mike Cohn's Agile Estimating and Planning

OwnerDisplayName: Ryan Cromwell


问:
Creating a webservice API - how much "credit" should I give the client/developer
When creating a web service API, how much should I count on the developer to act by my rules?

We are really aimed on creating an API so the developers shouldn't develop client side logic too much...

for example, if in one of my methods we require the client to send us a unique ID - we are relying on the client that the ID sent is really unique - so the client should also keep track of it's requests and add logic to it's code.

is it ok or should we try to solve ths kind of issues in a different more transparent ways?

答:
for example, if in one of my methods we require the client to send us
  a unique ID - we are relying on the client that the ID sent is really
  unique - so the client should also keep track of it's requests and add
  logic to it's code.

In one of the web service we have developed, the requirement was that ID was generated by the client (web service) and it is assumed to be unique for all future references. Thus, the database on this side of the web service, has that ID as a primary key, it was UNIQUE id, but it was not Auto Increment. This was never a problem. The client side CAN dictate the id if the business logic needs so. (i won't go into details of how to logically. In our case, unique-ID was pre-fixed against a code for which a client is already authenticated) I am not saying you should always ask for client to generate id - but when required this is not a showstopper.

However, we cannot rule-out the possibility that incoming requests cannot be erroneous or garbled in some cases. For that, strict type and bound checking was done (on the XML inputs) and unless everything is found perfect, no existing database records would ever get modified.

is it ok or should we try to solve ths kind of issues in a different
  more transparent ways?

I didn't quite understood what other transparent ways are - but as a simple rule of thumb is, that if you can do the followig:

define a very simple and clear flow of transactions on paper and
validate it,

define clear cut roles of each party,

have least possible variations in contexts,
(i mean various different situations where different behavior is expected for same inputs).

and align your database schema closely to the transaction structures,

then chances of getting in troubles reduces drastically.

Most reasons, why surprises are seen in incorrect error checking almost always draws back to ambiguity in requirements specs to be frozen.

Dipan.


问:
What is the advantage of using map datastructure?
I am a member of some online coding website and today when I submitted a solution in C++, I saw there were much better answers in C++  itself which took considerably less time. The solutions were open so I went on through some of them and found all of them using map datastructure. I could not figure out where exactly it takes an edge. I made some googling but it was not convincing. Please help.</p>

答:
For most purposes the classes from the standard library are likely to outperform any quickly-put-together data structure / container / algorithm you will write.  This is assuming you choose the right abstraction (std::vector and std::list have different trade-offs, for example).  A lot of time and effort by a lot of smart people has gone into making those libraries both generic and as fast as possible given the generic nature of the libraries.

If you have a very specific case that you know really well, and you also know your standard library classes really well, you might be able to write a custom class that outperforms the best standard equivalent for your specific, limited purpose, but such a thing should only be done when profiling your application demonstrates a need for such optimization.


问:
Is it best to minimize using pointers in C?
I think most people would agree that pointers are a major source of bugs in C programs (if not the greatest source of bugs). Other languages drop pointers entirely for this reason. When working in C, then, would it be best to avoid using pointers whenever practicable? For example, I recently wrote a function like this:

```<code>void split (char *record, char *delim,
            int numfields, int fieldmax,
            char result[numfields][fieldmax]);
</code>```

While not as versatile as a dynamically allocated variable, in that it requires the programmer to know the number of fields in advance and anything over fieldmax is truncated (which is sometimes acceptable), it eliminates the need for memory management, and the potential for memory corruption. I think this is a pretty good trade, but I was wondering what the opinions of other programmers on this were.

答:
The power of C comes from the fact that underline data storage is transparent to
use. It is not really about pointers, it is more about working directly on hardware while still being a general purpose code.

While this may be of no virtue in many cases, in that case, we don't need to drop pointers from C, we need to drop C from development.

In my opinion, in your earlier version, you are NOT avoiding pointers. I can always supply an already corrupt (or free()ed) pointer as *record and everything will be doomed!

The core issue, though, is not really pointers! I have seen so many people don't get it right in the beginning, but even after having reasonable number of project experience, some get it, some fear it. I cann't say authoritatively, but those who have some basic exposure (introduction) to microprocessor architecture and/or OS basics, don't quite face that much trouble. It is the essence of how the machines work and C translates it in a very transparent way on higher level. If you ever fear pointers in C, try work on this background knowledge and lot of practice; things should work smooth. I don't quite believe that one should ever fear C or its' pointers.  If you have the fear, there is always a way to get over it and then start enjoying pointers in C.


答:
map is a fairly well-rounded dictionary-type container that provides several advantages over std::list (linked lists) and std::vector (arrays). Although its not strictly specified, the performance constraints required on a map pretty much forces it to be implemented as some kind of self-balancing binary tree. So if its helpful to you to think about it in those terms, consider the advantages of binary trees over normal arrays/linked lists if you have learned about them in the past.

Lookup time

If you know your keys (what you're using to lookup your data) fall into a very narrow integer range, then an array (or preferably a vector) is ideal if all you care about is lookup. You can look up using a key in constant time with no fuss.

This breaks down if your key space becomes too large or is not an integer. You obviously can't have an array that has an item stored only in the 0th slot and the 2^32 spot without wasting tons of memory. A map lets you maintain reasonable lookup performance (O(log(n))), but only takes up 2 spots to store the memory. A map also lets you lookup on any type that defines a < operator or specifies to the map through a template argument how to compare keys. So you can have reasonable lookup on maps of strings -> another value. So a map will let you do map["Bob"] = 5; for example.

Ordered

map stores items in key order. So you can iterate over all the items in a map, from begin to end, in sorted key order. You obviously can do this with an array/vector, however as was said earlier, a map lets you have any arbitrary key type with any arbitrary ordering defined.

Insertion

To insert into the middle of an array/vector you have to shift all the items over to the left. For a dynamic array and a vector you have to resize the vector, which will cause you to copy the entire array to new memory.

A map has reasonable insertion time (O(log(n))).

Alternatives w/different tradeoffs

multimap is like map but allows the keys to be not unique

unordered_map is a map that does not store items in order, but can provide better lookup performance if a good hash function is provided

Title: What is the advantage of using map datastructure?

Body: I am a member of some online coding website and today when I submitted a solution in C++, I saw there were much better answers in C++  itself which took considerably less time. The solutions were open so I went on through some of them and found all of them using map datastructure. I could not figure out where exactly it takes an edge. I made some googling but it was not convincing. Please help.</p>


问:
How to handle management pushing legacy systems?
I am currently on a paid internship, and have been tasked with maintaining an obsolete system that has been developed by multiple developers (at different times) over the course of the past 5 years. Management agrees the "system is on life support", and I receive a fairly regular supply of bug reports from end users currently using the system.

Management now wants to extend the project for another year, and in the process nearly triple the user base.

As an intern (or any entry level position) how do I "push back"? I've already written a report stating my concerns, albeit in an open-ended document. Is there protocol or document type for suggesting changes? Am I in a position to make suggestions, or should I simply continue to support the old system?

To clarify, software development is not my company's primary business. As such no internal protocols exist. Additionally, the project has no formal documentation at all, and no requirements documents either. The development is very ad hoc.

答:
I guess, in a very theoretic sense - there is no such a thing called Legacy system. I have a very old phone (a legacy system), and these days there are good android phones (modern platforms), but my phone works and does what i need. Why should i throw that away?

All systems you call "legacy" today, were one day the state-of-the-art. It is only the time we need. Also, when there are sizable work is in place, it is not that re-doing the whole stuff again in modern platforms, means it will be automatically bug free (or pain free).

Here is what i recommend you should do:

Leave away your dislike of "legacy system" first. This will make you very counter productive.

Begin documenting what you now do and what you think. Albeit in a step by step way. There is just no better time to do documentation than the one where you realize you need one.

Instead of trying to Push-back the furthering of "legacy system" - try to define path for it's exit smoothly. Try to see that you can convince management that newer development which can be isolated, can be done step by step in newer plat forms without breaking interoperability with old systems. Slowly (and this will be really slowly) as things evolve, the need to keep legacy system would vanish. That is the only way to say a good bye to any old system.

Dipan.


问:
Are value converters more trouble than they're worth?
I'm working on a WPF application with views that require numerous value conversions. Initially, my philosophy (inspired in part by this lively debate on XAML Disciples) was that I should make the view model strictly about supporting the data requirements of the view. This meant that any value conversions required to turn data into things like visibilities, brushes, sizes, etc. would be handled with value converters and multi-value converters. Conceptually, this seemed quite elegant. The view model and view would both have a distinct purpose and be nicely decoupled. A clear line would be drawn between "data" and "look".

Well, after giving this strategy "the old college try", I'm having some doubts whether I want to continue developing this way. I'm actually strongly considering dumping the value converters and placing the responsibility for (almost) all value conversion squarely in the hands of the view model.

The reality of using value converters just doesn't seem to be measuring up to the apparent value of cleanly separated concerns. My biggest issue with value converters is that they are tedious to use. You have to create a new class, implement IValueConverter or IMultiValueConverter, cast the value or values from object to the correct type, test for DependencyProperty.Unset (at least for multi-value converters), write the conversion logic, register the converter in a resource dictionary [see update below], and finally, hook up the converter using rather verbose XAML (which requires use of magic strings for both the binding(s) and the name of the converter [see update below]). The debugging process is no picnic either, as error messages are often cryptic, especially in Visual Studio's design mode/Expression Blend.

This isn't to say that the alternative--making the view model responsible for all value conversion--is an improvement. This could very well be a matter of the grass being greener on the other side. Besides losing the elegant separation of concerns, you have to write a bunch of derived properties and make sure you conscientiously call RaisePropertyChanged(() => DerivedProperty) when setting base properties, which could prove to be an unpleasant maintenance issue.

The following is an initial list I put together of the pros and cons of allowing view models to handle conversion logic and doing away with value converters:

Pros:

Fewer total bindings since multi-converters are eliminated

Fewer magic strings (binding paths + converter resource names)

No more registering each converter (plus maintaining this list)

Less work to write each converter (no implementing interfaces or casting required)

Can easily inject dependencies to help with conversions (e.g., color tables)

XAML markup is less verbose and easier to read

Converter reuse still possible (although some planning is required)

No mysterious issues with DependencyProperty.Unset (a problem I noticed with multi-value converters)

*Strikethroughs indicate benefits that disappear if you use markup extensions (see update below)

Cons:

Stronger coupling between view model and view (e.g., properties must deal with concepts like visibility and brushes)

More total properties to allow direct mapping for every binding in view

RaisePropertyChanged must be called for each derived property (see Update 2 below)

Must still rely on converters if the conversion is based on a property of a UI element

So, as you can probably tell, I have some heartburn about this issue. I'm very hesitant to go down the road of refactoring only to realize that the coding process is just as inefficient and tedious whether I use value converters or expose numerous value conversion properties in my view model.

Am I missing any pros/cons? For those who have tried both means of value conversion, which did you find worked better for you and why? Are there any other alternatives? (The disciples mentioned something about type descriptor providers, but I couldn't get a handle on what they were talking about. Any insight on this would be appreciated.)

Update

I found out today that it's possible to use something called a "markup extension" to eliminate the need to register value converters. In fact, it not only eliminates the need to register them, but it actually provides intellisense for selecting a converter when you type Converter=. Here is the article that got me started: http://www.wpftutorial.net/ValueConverters.html.

The ability to use a markup extension changes the balance somewhat in my pros and cons listing and discussion above (see strikethroughs).

As a result of this revelation, I'm experimenting with a hybrid system where I use converters for BoolToVisibility and what I call MatchToVisibility and the view model for all other conversions. MatchToVisibility is basically a converter that lets me check if the bound value (usually an enum) matches one or more values specified in XAML.

Example:

```<code>Visibility="{Binding Status, Converter={vc:MatchToVisibility
            IfTrue=Visible, IfFalse=Hidden, Value1=Finished, Value2=Canceled}}"
</code>```

Basically what this does is check if the status is either Finished or Canceled. If it is, then the visibility gets sets to "Visible". Otherwise, it gets sets to "Hidden". This turned out to be a very common scenario, and having this converter saved me about 15 properties on my view model (plus associated RaisePropertyChanged statements). Note that when you type Converter={vc:, "MatchToVisibility" shows up in an intellisense menu. This noticeably reduces the chance of errors and makes using value converters less tedious (you don't have to remember or look up the name of the value converter you want).

In case you're curious, I'll paste the code below. One important feature of this implementation of MatchToVisibility is that it checks to see if the bound value is an enum, and if it is, it checks to make sure Value1, Value2, etc. are also enums of the same type. This provides a design-time and run-time check of whether any of the enum values are mistyped. To improve this to a compile-time check, you can use the following instead (I typed this by hand so please forgive me if I made any mistakes):

```<code>Visibility="{Binding Status, Converter={vc:MatchToVisibility
            IfTrue={x:Type {win:Visibility.Visible}},
            IfFalse={x:Type {win:Visibility.Hidden}},
            Value1={x:Type {enum:Status.Finished}},
            Value2={x:Type {enum:Status.Canceled}}"
</code>```

While this is safer, it's just too verbose to be worth it for me. I might as well just use a property on the view model if I'm going to do this. Anyway, I'm finding that the design-time check is perfectly adequate for the scenarios I've tried so far.

Here's the code for MatchToVisibility

```<code>[ValueConversion(typeof(object), typeof(Visibility))]
public class MatchToVisibility : BaseValueConverter
{
    [ConstructorArgument("ifTrue")]
    public object IfTrue { get; set; }

    [ConstructorArgument("ifFalse")]
    public object IfFalse { get; set; }

    [ConstructorArgument("value1")]
    public object Value1 { get; set; }

    [ConstructorArgument("value2")]
    public object Value2 { get; set; }

    [ConstructorArgument("value3")]
    public object Value3 { get; set; }

    [ConstructorArgument("value4")]
    public object Value4 { get; set; }

    [ConstructorArgument("value5")]
    public object Value5 { get; set; }

    public MatchToVisibility() { }

    public MatchToVisibility(
        object ifTrue, object ifFalse,
        object value1, object value2 = null, object value3 = null,
        object value4 = null, object value5 = null)
    {
        IfTrue = ifTrue;
        IfFalse = ifFalse;
        Value1 = value1;
        Value2 = value2;
        Value3 = value3;
        Value4 = value4;
        Value5 = value5;
    }

    public override object Convert(
        object value, Type targetType, object parameter, CultureInfo culture)
    {
        var ifTrue = IfTrue.ToString().ToEnum<Visibility>();
        var ifFalse = IfFalse.ToString().ToEnum<Visibility>();
        var values = new[] { Value1, Value2, Value3, Value4, Value5 };
        var valueStrings = values.Cast<string>();
        bool isMatch;
        if (Enum.IsDefined(value.GetType(), value))
        {
            var valueEnums = valueStrings.Select(vs => vs == null ? null : Enum.Parse(value.GetType(), vs));
            isMatch = valueEnums.ToList().Contains(value);
        }
        else
            isMatch = valueStrings.Contains(value.ToString());
        return isMatch ? ifTrue : ifFalse;
    }
}
</code>```

Here's the code for BaseValueConverter

```<code>// this is how the markup extension capability gets wired up
public abstract class BaseValueConverter : MarkupExtension, IValueConverter
{
    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        return this;
    }

    public abstract object Convert(
        object value, Type targetType, object parameter, CultureInfo culture);

    public virtual object ConvertBack(
        object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
</code>```

Here's the ToEnum extension method

```<code>public static TEnum ToEnum<TEnum>(this string text)
{
    return (TEnum)Enum.Parse(typeof(TEnum), text);
}
</code>```

Update 2

Since I posted this question, I've come across an open-source project that uses "IL weaving" to inject NotifyPropertyChanged code for properties and dependent properties. This makes implementing Josh Smith's vision of the view model as a "value converter on steroids" an absolute breeze. You can just use "Auto-Implemented Properties", and the weaver will do the rest.

Example:

If I enter this code:

```<code>public string GivenName { get; set; }
public string FamilyName { get; set; }

public string FullName
{
    get
    {
        return string.Format("{0} {1}", GivenName, FamilyName);
    }
}
</code>```

...this is what gets compiled:

```<code>string givenNames;
public string GivenNames
{
    get { return givenName; }
    set
    {
        if (value != givenName)
        {
            givenNames = value;
            OnPropertyChanged("GivenName");
            OnPropertyChanged("FullName");
        }
    }
}

string familyName;
public string FamilyName
{
    get { return familyName; }
    set
    {
        if (value != familyName)
        {
            familyName = value;
            OnPropertyChanged("FamilyName");
            OnPropertyChanged("FullName");
        }
    }
}

public string FullName
{
    get
    {
        return string.Format("{0} {1}", GivenName, FamilyName);
    }
}
</code>```

That's a huge savings in the amount of code you have to type, read, scroll past, etc. More importantly, though, it saves you from having to figure out what your dependencies are. You can add new "property gets" like FullName without having to painstakingly go up the chain of dependencies to add in RaisePropertyChanged() calls.

What is this open-source project called? The original version is called "NotifyPropertyWeaver", but the owner (Simon Potter) has since created a platform called "Fody" for hosting a whole series of IL weavers. The equivalent of NotifyPropertyWeaver under this new platform is called PropertyChanged.Fody.

Fody setup instructions: http://code.google.com/p/fody/wiki/SampleUsage (replace "Virtuosity" with "PropertyChanged")

PropertyChanged.Fody project site: http://code.google.com/p/propertychanged/

If you'd prefer to go with NotifyPropertyWeaver (which a little simpler to install, but won't necessarily be updated in the future beyond bug fixes), here is the project site:
http://code.google.com/p/notifypropertyweaver/

Either way, these IL weaver solutions completely change the calculus in the debate between view model on steroids vs. value converters.

答:
If the Conversion is something View-Related, such as deciding the visibility of an object, determining which image to display, or figuring out what brush color to use, I always put my converters in the View.

If its Business-Related, such as determining if a field should be masked, or if a user has permission to perform an action, then the conversion happens in my ViewModel.

From your examples, I think you're missing a big piece of WPF: DataTriggers. You seem to be using converters for determining conditional values, but converters should really be for converting one data type into another.

In your example above

Example: say you had a stereo system that could either be in radio,
  CD, or MP3 mode. Assume there are visuals corresponding to each mode
  in different parts of the UI. You could either (1) let the view decide
  which graphics correspond to which mode and turn them on/off
  accordingly, (2) expose properties on the view model for each mode
  value (e.g., IsModeRadio, IsModeCD), or (3) expose properties on the
  view model for each graphical element/group (e.g., IsRadioLightOn,
  IsCDButtonGroupOn). (1) seemed a natural fit for my view, because it
  already has mode awareness. What do you think in this case?

I would use a DataTrigger to determine which image to display, not a Converter. A converter is for converting one data type to another, while a trigger is used to determine some properties based on a value.

```<code><Style x:Key="RadioImageStyle">
    <Setter Property="Source" Value="{StaticResource RadioImage}" />
    <Style.Triggers>
        <DataTrigger Binding="{Binding Mode}" Value="CD">
            <Setter Property="Source" Value="{StaticResource CDImage}" />
        </DataTrigger>
        <DataTrigger Binding="{Binding Mode}" Value="MP3">
            <Setter Property="Source" Value="{StaticResource MP3Image}" />
        </DataTrigger>
    </Style.Triggers>
</Style>
</code>```

The only time I would consider using a Converter for this is if the bound value actually contained the image data, and I needed to convert it into a data type that the UI could understand. For example, if the data source contained a property called ImageFilePath, than I would consider using a Converter to convert the string containing the image file location to a BitmapImage which could be used as the Source for my Image

```<code><Style x:Key="RadioImageStyle">
    <Setter Property="Source" Value="{Binding ImageFilePath,
            Converter={StaticResource StringPathToBitmapConverter}}" />
</Style>
</code>```

The end result is I have one library namespace full of generic converters which convert one data type to another, and I rarely have to code a new converter. There are occasions when I will want converters for specific conversions, but they are infrequent enough that I never mind writing them.

Body:
If the Conversion is something View-Related, such as deciding the visibility of an object, determining which image to display, or figuring out what brush color to use, I always put my converters in the View.

If its Business-Related, such as determining if a field should be masked, or if a user has permission to perform an action, then the conversion happens in my ViewModel.

From your examples, I think you're missing a big piece of WPF: DataTriggers. You seem to be using converters for determining conditional values, but converters should really be for converting one data type into another.

In your example above

Example: say you had a stereo system that could either be in radio,
  CD, or MP3 mode. Assume there are visuals corresponding to each mode
  in different parts of the UI. You could either (1) let the view decide
  which graphics correspond to which mode and turn them on/off
  accordingly, (2) expose properties on the view model for each mode
  value (e.g., IsModeRadio, IsModeCD), or (3) expose properties on the
  view model for each graphical element/group (e.g., IsRadioLightOn,
  IsCDButtonGroupOn). (1) seemed a natural fit for my view, because it
  already has mode awareness. What do you think in this case?

I would use a DataTrigger to determine which image to display, not a Converter. A converter is for converting one data type to another, while a trigger is used to determine some properties based on a value.

<Style x:Key="RadioImageStyle">
    <Setter Property="Source" Value="{StaticResource RadioImage}" />
    <Style.Triggers>
        <DataTrigger Binding="{Binding Mode}" Value="CD">
            <Setter Property="Source" Value="{StaticResource CDImage}" />
        </DataTrigger>
        <DataTrigger Binding="{Binding Mode}" Value="MP3">
            <Setter Property="Source" Value="{StaticResource MP3Image}" />
        </DataTrigger>
    </Style.Triggers>
</Style>

The only time I would consider using a Converter for this is if the bound value actually contained the image data, and I needed to convert it into a data type that the UI could understand. For example, if the data source contained a property called ImageFilePath, than I would consider using a Converter to convert the string containing the image file location to a BitmapImage which could be used as the Source for my Image

<Style x:Key="RadioImageStyle">
    <Setter Property="Source" Value="{Binding ImageFilePath,
            Converter={StaticResource StringPathToBitmapConverter}}" />
</Style>

The end result is I have one library namespace full of generic converters which convert one data type to another, and I rarely have to code a new converter. There are occasions when I will want converters for specific conversions, but they are infrequent enough that I never mind writing them.


问:
Should I HTML encode all output from my API?
I am creating a RESTful JSON API to access data from our website where the content is in German.

A handful of the fields will return formatted HTML while most are single lines of text although they are highly like to include special characters.

To make it easy to use I wanted consistency throughout. As the text in the HTML fields would not be easy to encode after they have the data my first thought was to encode all fields (they can always be un-encoded later int he other fields).

Is this the best approach or should I suffix all the HTML fields e.g. description_html to imply they are already encoded or try something else?

The plan is let people use the API however they want although initially to let our partners use our data on their website.

答:
It seems this depends on the intent of the API.  Is it to provide formatted HTML to clients, or to provide data which the clients can use however they see fit?

If the purpose really is to provide consumable HTML, I would say to do the encoding.   If it is to provide access to data, then don't.

If you really want to support both, perhaps different APIs (using the same back-end code) are in order -- one of which encodes, the other does not, but otherwise serving up the same fields, etc.


问:
How would you design a generic layer for OpenGL windowing that does not care how the program underneath actually looks like?
The kind of OpenGL windowing that I refer to is like GLFW, GLUT, SDL, etc.

Imagine three C++ programs: (ignore syntax)

Game A:

```<code>class Game
    resize()
    keyEvent()
</code>```

Game B:

```<code>resize()
keyEvent()
</code>```

Game C:

```<code>class Key
    event()
class Display
    resize()
</code>```

In A, everything is in one class, in B nothing is in a class, and in C the two events have their own classes. Another that is not shown is subclassing a provided 'Game' class that has predefined functions overloaded.

I would like any reasonable means that can allow the main library to delegate out to each of these three cases. The solution should not require separate storage of a 'this' parameter.

I have thought of a couple of ideas, one is a way of mapping the function in a functor. Another was lambdas. Lambdas are not okay, because they are not widely implemented yet. (Compilers of choice are VC 2010, gcc (latest stable), and Apple's clang).

Any new C++ 2011 features that are widely implemented are reasonable thoughts.

A gentleman at the local university suggested something similar to the functor, but I cannot remember the function he was talking about.

答:
It is not very clear what your true intention is. However, describing you based on some assumptions.

Before you think of a methods - you need to define the abstraction of the core objects - such as Windows, surfaces, canvas and the device layer which would do the rendering. I believe the inputs (such as key board and mouse) would be objects as well. A good deal of work is to represent hardware - and while many are attempting to do it, it is not that universal thing.

If you are wanting to create GUI type framework than there will be whole object hierarchies like buttons and form elements etc. If you intend to do this for the class of rendering (what openGL actually aims to) you have higher level representations of Square and Triangles and how do draw Textures on them!

Once, you sort this out you need to define their behavior of inputs and outputs they will take and define which other objects they will deal with using the other API.


答:
Generally a web service should return raw data, and a consuming application that embeds the data in a web page would encode the data it embeds. That way other applications that might display the data in a Windows application or do some other processing on it don't have to deal with html.

If the purpose of a service is really to provide formatted text and uses html to represent the formatting, then it should be marked as such. Though you should consider how a non web-page consumer would use that data.

Title: Should I HTML encode all output from my API?

Body:
I am creating a RESTful JSON API to access data from our website where the content is in German.

A handful of the fields will return formatted HTML while most are single lines of text although they are highly like to include special characters.

To make it easy to use I wanted consistency throughout. As the text in the HTML fields would not be easy to encode after they have the data my first thought was to encode all fields (they can always be un-encoded later int he other fields).

Is this the best approach or should I suffix all the HTML fields e.g. description_html to imply they are already encoded or try something else?

The plan is let people use the API however they want although initially to let our partners use our data on their website.


问:
What are combinators and how are they applied to programming projects? (practical explanation)
What are combinators?

I'm looking for:

a practical explanation

examples of how they are used

examples of how combinators improve the quality/generality of code

I'm not looking for:

explanations of combinators that don't help me get work done (such as the Y-combinator)

答:
Digging around a bit, I found a StackOverflow question, Good explanation of “Combinators” (For non mathematicians) that's a close cousin of this question.  One of the answers pointed to Reginald Braithwaite's blog, Homoiconic, which links to several useful examples of combinators in code (e.g. the K combinator, implemented by Ruby's Object#tap method - read the page for examples of why it's useful).

The Wikipedia page on Combinatory Logic describes combinators more globally.


问:
Is "Mapper" a valid design pattern or is it a variation of the "Factory" pattern?
A common pattern I see is what's known as the Mapper pattern (not to be confused with DataMapper which is something else entirely), which takes as an argument some kind of "raw" data source (e.g. an ADO.NET DataReader or DataSet) and maps the fields to properties on a business/domain object.  Example:

```<code>class PersonMapper
{
    public Person Map(DataSet ds)
    {
        Person p = new Person();
        p.FirstName = ds.Tables[0].Rows[0]["FirstName"].ToString();
        // other properties...
        return p;
    }
}
</code>```

The idea being your Gateway/DAO/Repository/etc. will call into the Mapper before it returns, so you get a rich business object versus the underlying data container.

However, this seems to be related, if not identical, to the Factory pattern (in the DDD parlance, anyways), which constructs and returns a domain object.  Wikipedia says this re: the DDD Factory:

Factory: methods for creating domain objects should delegate to a specialized Factory object such that alternative implementations may be easily interchanged.

From that quote the only difference I could think of is that the DDD-style Factory could be parameterized so it could return a specialized type of object if the need arose (e.g. BusinessCustomer versus ResidentialCustomer) while the "Mapper" is keyed to a specific class and only does translation.

So is there a difference between these two patterns or are they essentially the same thing with different names?

答:
The only common thing about Mapper, Builder and Factory is that they deliver a "constructed product" - and object instance of a type. To avoid any confusion, i am referring to following discussions for their respective definition.

Mapper - close to what is explained here: http://www.codeproject.com/KB/library/AutoMapper.aspx. This is not exact same as above - but closest i found about mapper.

Builder - as defined here: http://www.oodesign.com/builder-pattern.html

Factory - is defined here: http://www.oodesign.com/factory-pattern.html

The mapper is essentially a constructor inside out. Suppose for a while, if you don't have a mapper - When you anyway need many set of parameters they are all arguments on the constructor. Now as things evolve, some applications are not aware of additional attributes that needs to go under constructor where one either computes it or use default. The critical thing is that mapper can do this for you - and it would be more useful if this has linkage to external objects to decide such an algorithm for construction.

The Builder is very different from mapper. A builder is essential when a complete object is composed using many parts of the object. It's kind of assembling the objects by fitting together many parts. Even the initialization of the individual part objects are related to existence of other parts.

The factory patterns looks very simple at the outset. It returns a newly constructed objects.
If any ordinary constructor can give me a fully functional instance using an operator like new()? why would i need a factory that gives me same results?

However, factory pattern's usage is typically very specific; though most often, not displayed in literature where this is applied. Usually, an application creates a factory which is shared to various objects who needs to create such product objects during the execution. When many such products are created, Factory method allows creation of objects based on certain policy for example, one can force a certain template which is used by factory method when all objects are created. This is neither like a builder method; here product out is only one (and independent). This is also not like mapper; here external data set to create object as per the client is actually minimal. The factory pattern really provides (as the name suggests) a consistently similar product objects!

Dipan.


问:
Where should I put my utility methods?
I am very new to Visual Studio and C# and am wondering how best to create a repository of sorts for utility methods.

For instance, we need a method that returns the current fiscal year and other company specific values.

Would it be best to create utility class file that is imported into every project? Or, create a new project with the these methods and add it to the current solution?

In python, for instance, I created an egg that has all the utility methods that I then install into the site-packages.

答: Create a new project and import it into needed solutions. This way you can let it have its own solution and add an additional project for unit tests.</p>

Title: Where should I put my utility methods?

OwnerDisplayName: Michael Wheeler


答:
I'd create a project that has all of the utilities, and you reference that in other projects.

I'd put company-specific things in a separate project again.

You can include the same projects in many solutions; you just have to be careful about making changes that could break usages in other solutions.

Title: Where should I put my utility methods?

Body:
I am very new to Visual Studio and C# and am wondering how best to create a repository of sorts for utility methods.

For instance, we need a method that returns the current fiscal year and other company specific values.

Would it be best to create utility class file that is imported into every project? Or, create a new project with the these methods and add it to the current solution?

In python, for instance, I created an egg that has all the utility methods that I then install into the site-packages.

OwnerDisplayName: Jay


答:
My suggestion is to not worry about it until you have to.

Create your utility methods and place them into an appropriate class in the project that requires them. I might create a FiscalYear class, and separate classes for each area within the "company-specific values". Do not create a single class just to hold "company-specific values", since the only thing those values will have in common is that they are "company-specific".

When you get a second project that also needs access to the same classes, then is the time to create a third project to hold those classes that are in common between them.

Title: Where should I put my utility methods?

OwnerDisplayName: John Saunders


答: I fabour creating "Framework" dll's in a seperate project/solution and referencing when needed, keep it backwards compatible with its own unit tests etc. If the requirements are domain specific then create another project within the current solution.</p>

Title: Where should I put my utility methods?

OwnerDisplayName: Lloyd


问:
Using Mercurial repository inside a Git one: Feasible? Sane?
I am thinking on creating a Mercurial repository under a Git repository.
e.g.

```<code>..../git-repository/directory/hg-repo/
</code>```

The 2 repositories

Is it possible to manage (keeping your sanity)? How similiar is it to this?

I am a computer science student at University. I manage my work in Git, mainly as a distribution mechanism (after realizing that rsync fails when you have changes in more than one place) between my desktop and usb drive. I try use of Git as a VCS as I do work.

I have finished a semester where I did a small group project to prepare for a larger group project next year. We had to use Subversion, and experienced the joys of a centralised VCS (including downtime).

I tried to keep the subversion repository separate to my Git repository for the subject**, however it was annoying that it was seperate (not in the place where I store assignments). I therefore moved to using an Subversion repository inside my Git repository.

As I think ahead (maybe I am thinking too far ahead) I realise that I will have to try and convince people to use a DVCS and Mercurial will probably be the one that is preferred (Windows and Mac GUI support, closer to Subversion).

Having done some research into the whole Git vs Mercurial debate (however not used Mercurial at all) I still prefer Git.

Can I have a Mercurial repository inside a Git one without going mad (or it ruining something)? Or is it something that I should not consider at all?

(Or is it a bad question that should be deleted?)

** I think outside of Australia it is called a course

答: Take a look at the hg-git extension for Mercurial, http://hg-git.github.com/. It allows you to access a Git repository (including pulling, pushing, and committing) using Mercurial. I use it to manage my projects on Github using TortoiseHg on Windows. Haven't had a problem with this approach yet.</p>


问:
What are non-programming mistakes that a programmer should avoid?
People make mistakes, even in the real life... Which should we, geeky programmers, avoid?</p>

答: "It works on my machine!" is an excuse that can only go so far.  Make sure you consider multiple unbiased environments.  Your development machine, unfortunately, is well-built to run whatever you program on it!</p>

ContentLicense: CC BY-SA 2.5


问:
What are the biggest differences between F# and Scala?
F# and Scala are both functional programming langugages that don't force the developer to only use immutable datatypes. They both have support for objects, can use libraries written in other languages and run on a virtual machine. Both languages seem to be based on ML.

What are the biggest differences between F# and Scala despite the fact that F# is designed for .NET and Scala for the Java platform?

答:
F# is settled on functional aspects
while scala is based on
object-oriented aspects.

F# has better IDE support with Visual studio while Scala's eclipse plug-in is for open source IDE and comparatively slower.

F#, being more ML-like than Scala, has more of a minimal lambda calculus-y feel to it the way OCaml, Standard ML, and Scheme have. F# appears to be a considerably simpler language.


答:
A 'non-programming mistake' I see people make (especially the guy in the mirror) is 'stubbing your toe'.

By this, I mean, getting overly excited over a little mistake, like stubbing your toe. Then taking an excessive negative reaction. The frustration ultimately snowballs and a bunch of little problems end up causing massive heart ache and sorrow. When something goes wrong, take a quick break, breath then reengage.

Get stuck on a bug, take a break.

App works on 3 servers, but not the 4th, take a 5-15 minute break.

IDE crashes randomly, take a break.

Kids won't stop bouncing off the walls,take a break. (maybe reduce dietary sugar as well)

In the first decade or so of my career, this happened to me all the time. I was my own worst enemy more often than not. I still fall prey to this trap, but far less frequently.

Title: What are non-programming mistakes that a programmer should avoid?

Body: People make mistakes, even in the real life... Which should we, geeky programmers, avoid?</p>


答:
Truth is no one gives interns the work they want to do. When you are the most junior person, you get the least exciting work. How well you personally handle that says a lot to the organization as to whether they can trust you to do more the exciting work.

So here is a priceless opportunity to show that you can deliver  by doing the bug fixes, that you can refactor by making each part of the code you touch a little beter, that you can create unit tests, by starting to create them for this system and that you can document by creating documentation for the next poor soul who is stuck with this system. It also gives you the opportunty to show you can deal with users effectively (to get more detail on reported bugs) and meet their needs. If the project is not now in source control, put it there and if the bugs aren't tracked in a bug tracker, then start one. These types of actions will show you know how to work professionally. All of this is far more valuable experience than just working in some fun technology doing a project that will be thrown aaway after you leave (the other things some interns get assigned to do).

Or you could take the opposite path and just bitch about how bad the project is and how cool it would be to replace it. In which case, you almost certainly won't be offered a job at that company after your internship.

Title: How to handle management pushing legacy systems?

Body:
I am currently on a paid internship, and have been tasked with maintaining an obsolete system that has been developed by multiple developers (at different times) over the course of the past 5 years. Management agrees the "system is on life support", and I receive a fairly regular supply of bug reports from end users currently using the system.

Management now wants to extend the project for another year, and in the process nearly triple the user base.

As an intern (or any entry level position) how do I "push back"? I've already written a report stating my concerns, albeit in an open-ended document. Is there protocol or document type for suggesting changes? Am I in a position to make suggestions, or should I simply continue to support the old system?

To clarify, software development is not my company's primary business. As such no internal protocols exist. Additionally, the project has no formal documentation at all, and no requirements documents either. The development is very ad hoc.


问:
Is there a way to combat Sales perpetually overcommitting?
I seem to be repeatedly stuck in a situation where release dates are set not based on anything technical, but because someone in Sales has committed to a customer by then.  Based on discussions with friends in development at other companies, the same thing seems to happen.

"Here is the committed feature set and here is the committed release date", and it's difficult to argue because at this point there is money riding on it, and that trumps everything.

In general, is there a way to push back on this?  If not for this release, what about in future?  The problem I have is that the only way I see one way of doing so, and that's by doing the best I can, but release the software 'as is', so to speak.

I don't want to release bug-ridden software since it's my name attached, but doing 80 hour weeks for months at a time just vindicates the arbitrarily set release date.

edit: for the record, I'm not doing 80 hour weeks now, just that comes to mind as what would be required to cover the expected feature set by the release date.

答:
Disagreements like this are normally caused by a lack of communication. Either they don't understand the pressure they are putting on you or you don't understand what they are really asking for. Either way, to solve the issue, you need to understand the situation from the other point of view.

Have you ever tried selling software? It may not seem like the best answer to many developers, but until you've tried, it will be hard to see the business from the sales side. If you're a great developer, write something you really want to write and sell it. You may see that they have some valid points or you may see that they don't!


问:
Conceptually speaking, how would I pull facebook wall posts from 100k users?
Not looking for any code snippets here, so here goes:

Let's say 100,000 users on my web app have authorized my application to connect to facebook (with or without offline_access). I want to build a sort of "pull" mechanism, whereby when a user posts to their facebook wall, I can grab it from the Graph API and store it locally on my server.

I would assume that this would require a call to the Graph API every n minutes to pull their latest wall posts.

Ideally, this would be done for Twitter as well. I know LinkedIn does this, but I am not sure of the exact details.

Question 1: I'd need to make an individual Graph API call for each user, right?

Question 2: If I suddenly bombard the Graph API with 100k Graph API calls, wouldn't I run head-first into the rate limiter?

Question 2b: If not, what if I had a million users? Surely...

答:
There's not really any need to build the "pull" mechanism when you can have Facebook POST you graph updates. I'm not entirely sure about limits on this service.

As for your individual questions:

Question 1: I'd need to make an individual Graph API call for each
  user, right?

No. You can issue requests for multiple users. See the "Selection" section in this doc. However, I'm sure that there's a limit to the number of users that you can query at once (not sure about the number though).

Question 2: If I suddenly bombard the Graph API with 100k Graph API
  calls, wouldn't I run head-first into the rate limiter?

Yep, which is probably why you'd want to have the data pushed to you rather than pulled.

Question 2b: If not, what if I had a million users? Surely...

Don't build for what you think, or hope you might have.. Build for what you know you have. Refactor and optimize when the time comes. Not now.


答:
"Assumption is the mother of all f**kups."

-- Under Siege 2: Dark Territory (1995)


问:
How to have two different programs with two different languages interact?
I don't know if this is too broad or not, but I am a youngish programmer still in college, its my Junior year. I feel like I have a pretty good grasps for different languages and have a pretty good base. But I am stumbling to think how if for example, I am trying to create a program and say I wrote one part in python just because its easy, and does the job, but this program would need to get output from another program that I wrote in C and I am using C because of its speed. I am not sure how to have the two different programs and languages interact with each other to create an overall one total program. I am thinking of like sure you can write to a file, but then what if python and C programs both accessing a file I would need to think of locks.

Most times I have done this was with importing files into a program, but in that case they are the same language so that is easy I just use the import function, but with two languages/programs interacting to create one cohesive output I am having trouble.

I was thinking about this question because I was thinking of diving into creating some basic web applications just to learn but I have no idea how to have say javascript file interactive with something that I wrote in python or vice-versa.

I feel like I am missing something really easy here and just not understanding. Sorry if this question is too broad but I couldn't really find a clear answer online, I was trying to look through an opensource webapp, but couldn't really grasp an answer from it, again pardon me if the question seems dumb I thought this be a good place to ask I love reading on stackexchange.

Thank you for any reply.

答:
Message passing would seem to be the general concept here as there are various examples where one can have different languages interacting,e.g. one could use classic ASP with COM components and some JavaScript to get a mix of 3 different languages used in the same application.

In the example you state, wouldn't the locks be something for the Operating System to handle on the file system?  Each program doesn't know about the other necessarily remember.

ContentLicense: CC BY-SA 4.0


答: Most software components shouldn't communicate in terms of instructions but send and receive data: interact with a database, send/receive JSON/XML requests, etc.</p>

Title: How to have two different programs with two different languages interact?

Body:
I don't know if this is too broad or not, but I am a youngish programmer still in college, its my Junior year. I feel like I have a pretty good grasps for different languages and have a pretty good base. But I am stumbling to think how if for example, I am trying to create a program and say I wrote one part in python just because its easy, and does the job, but this program would need to get output from another program that I wrote in C and I am using C because of its speed. I am not sure how to have the two different programs and languages interact with each other to create an overall one total program. I am thinking of like sure you can write to a file, but then what if python and C programs both accessing a file I would need to think of locks.

Most times I have done this was with importing files into a program, but in that case they are the same language so that is easy I just use the import function, but with two languages/programs interacting to create one cohesive output I am having trouble.

I was thinking about this question because I was thinking of diving into creating some basic web applications just to learn but I have no idea how to have say javascript file interactive with something that I wrote in python or vice-versa.

I feel like I am missing something really easy here and just not understanding. Sorry if this question is too broad but I couldn't really find a clear answer online, I was trying to look through an opensource webapp, but couldn't really grasp an answer from it, again pardon me if the question seems dumb I thought this be a good place to ask I love reading on stackexchange.

Thank you for any reply.


答:
There are several different well-established ways for two programs to communicate with each other.  You've already identified one obvious one, by sharing files, and one obvious difficulty with it.  But there are other ways.

Most modern operating systems contain a mechanism called named pipes, which is basically a data stream with its input end in one program and its output end in a different program.  If you need to send data from one program to another program running on the same computer, that can be a good method to use.

If you need to set up an API for one program to use to call the other program, you might want to look into RPC, (remote procedure calls,) which again is usually supported at the OS level.

If you want to communicate between two programs on two different computers, things get more complicated.  Then you need to work with networking and protocols.  You need one of the programs to be able to open a socket and listen for incoming messages, decode them into an internal method call, process them and return a response.  There are plenty of libraries available for providing this functionality in various different languages, including C and Python.

Basically, what method you should use depends on the specifics of what you're trying to do.  Do some research on various forms of inter-process communication and network messaging, and you should be able to figure out what would best suit your needs.


答:
We have a large suite of web applications in our team and faced the same issue.
We came up with a very high-level generic "Application Utilities" library. This contains project agnostic utlity functions/classes. So (as you suggested) date utlities, things that replicated some of the old VB functions I missed (String.Left, String.Right etc) and that kind of thing.

For each specific project we have a BusinessLayer assembly which contains various project-specific logic. It is not uncommon to find a "Utlities" namespace within this project.
This would contain various functions specific to the context of the application.

Title: Where should I put my utility methods?


答:
Thinking you will be fairly rewarded for your efforts.  In other words, you might think that you will be rewarded for working hard and making good code and that you will be punished for spending all day on stackexchange.

But this is not the case.  In many cases, you will work with/for clueless people who will just guess how much you work, what your value is, and condescend you.


答: Avoid being overly dramatic when mistakes do happen.  A typo isn't the end of the world.  Just because a task took a little longer than initially estimated isn't the worst thing possible.  The tale of the Norden Bombsight would be an example where while someone had a good idea and good intentions in making a new device, there can be various other things that happen to reduce the effectiveness of the new thing created.  Definitely a cautionary tale as he hopes to get the spaghetti sauce talk behind him from Feb. 2004.</p>


问:
What is the/Is there a right way to tell management that our code sucks?
Our code is bad. It might not have always been considered bad, but it is bad and is only going downhill. I started fresh out of college less than a year ago, and many of the things in our code puzzle me beyond belief. At first I figured that as the new guy I should keep my mouth shut until I learned a little more about our code base, but I've seen plenty to know that it's bad.

Some of the highlights:

We still use frames (try getting something out of a querystring, almost impossible)

VBScript

Source Safe

We 'use' .NET - by that I mean we have .net wrappers that call COM DLLs making it almost impossible to debug easily

Everything is basically one giant function

Code is not maintainable. Each page has multiple files that are created every time a new page is made. The main page basically does Response.Write() a bunch of times to render the HTML (runat="server"? no way). After that there can be a lot of logic on the client side (VBScript), and finally the page submits to itself (often time storing many things in hidden fields) where it then posts to a processing page which can do things such as save the data to the database.

The specifications we get are laughable. Often times they call for things like "auto-populate field X with either field Y or field Z" with no indication of when to choose field Y or field Z.

I'm sure some of this is a result of not being employed at a software company, but I feel as if people writing software should at least care about the quality of their code. I can't even imagine that if I were to bring something up that anything would be done soon, as there is a large deadline looming, but we are continuing to write bad code and use bad practices.

What can I do? How do I even bring these issues up? 75% of my team agree with me and have brought up these issues in the past, yet nothing gets changed.

答:
There are two kinds of managers: ones that pretend to understand what you do and those that don't.  The ones that pretend to understand software will be hostile to you.  The ones that don't are merely annoyed by you.

In any case, managers are all liars so they have a strong disposition to assume everyone else is.

My point is, if you say the software is out of date, they'll just take it as an excuse.  They don't care.

OwnerDisplayName: Azkar


答:
Code written in different languages can interact in a number of ways.

At the source level, cross-compilation from one language into the other can be done for some combinations of languages (for example, Google's GWT includes a java-to-javascript compiler; the Glasgow Haskell compiler can compile to C; early versions of C++ compiled to C). Most of the time, however this is not really feasible.

Languages that share a virtual platform, such as the JVM or the .NET runtime, can usually interact through mechanisms exposed by the platform - for example all JVM languages can access Java libraries and use them to communicate among each other, and they can call methods and use classes created in any other JVM language.

Many programming languages, including Python, offer a mechanism to interface with native libraries, typically written in C. Using such a mechanism, it is possible to call native functions from another, more high-level, language. Popular libraries often have bindings readily available. This technique is usually referred to as a "Foreign Function Interface". The Python-into-C interface is the CFFI.

Another option is to build two completely separate programs and have them interact at runtime. There are various mechanisms to achieve this; the easiest is through a pipe (look into the subprocess module for python): basically, one program calls the other, sending input to its stdin and reading the result back from its stdout. This makes one program a subprocess of the other; if you need both to be long-lived and started independently, data can be passed back and forth through named pipes, (local) network sockets, shared files, and (depending on the platform) other means. Which one is best depends.


答:
If the data will change, it should be stored in a data store (database, XML, CSV, etc.) and not in code. For example, fiscal year keeps changing and if you store it in code or DLL, you will have to change the version every year to hard code the new value.

You can use this suggestion together with @marc's and @Bond's notes above to get a complete answer of your question.

Title: Where should I put my utility methods?


问:
Does a time estimate equal a promise in Scrum?
If an estimate is not a promise then as a product owner how can I deliver my projects without knowing how long it will take?

Does a Scrum team work more efficiently if we treat time estimates as a promise?

How much research (preparation, effort to understand the problem) in a story is enough to come up the right estimate?

What about unexpected technical problems (problems that can really mess your initial estimates) that come up after you estimate your work?

答:
If an estimate is not a promise then as a product owner how can I
  deliver my projects without knowing how long it will take?

You do not work with one big estimate, but with a lot of small estimates at the story level. A lot of the estimation errors at the story level average out. You cannot promise both content and date. You can, however, be fairly confident that the top of the backlog will get in a release (alternatively, have a fairly accurate - but not fixed - date at which time the whole backlog can be delivered).

Does a Scrum team work more efficiently if we treat time estimates as a promise?

No. That leads to sandbagging estimates and turn velocity/burndown charts into useless data - which prevents the team from improving.

How much research (preparation, effort to understand the problem) in a story is enough to come up the right estimate?

Depends how much you care about the precision. You can spend weeks preparing every estimate carefully, or give quick good faith estimates and hope errors average out. The first way is setting up for failure, because estimating something you haven't done before is really hard, and software engineering is all about stuff you haven't done before.

Personally, I don't think there is much benefit trying to get very accurate estimates. What I try to do is make sure the estimates are accurate enough - i.e. that I haven't missed something which might make cause a story to deviate from its estimate by an order of magnitude. (See next point).

What about unexpected technical problems (problems that can really mess your initial estimates) that come up after you estimate your work?

Small iterations. Ordered backlog. Small stories.
The dangerous stuff is what you don't know you don't know. Lack of expertise on a problem will result in poor estimates, but you can adjust by either acquiring expertise (more elaboration) or go with 'good enough' estimates - it's all about risk management.


问:
MIT and copyright
I am contributing to a library that is licensed under the MIT license.

In the license and in each class file it has a comment at the top saying:

Copyright (c) 2011 Joe Bloggs <joe.bloggs@example.com>

I assume that he owns the copyright to the file, and can change the license of that file as he sees fit.

If I contribute to the library with a new class entirely write by me, can I claim copyright of that file. And put:

Copyright (c) 2011 Petah Piper <petah.piper@example.com>

at the top?

答:
I'm not a lawyer, but the answer is yes. Copyright holder is the person or entity that can claim right to having created a piece work, or to whom such right has been transferred. The MIT license is not about transferring copyright, but about granting legal right to use the (copyrighted) work as stated in the license. If you write a class, you have the copyright to it, even if its actual use depends on third-party work.

Once you add your class to the software package and distribute the whole package, the package has multiple copyright holders: the original authors, and you. You are allowed to distribute the parts from the original package because the MIT license allows you to "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software".

Title: MIT and copyright


答:
From a practical viewpoint combinators are kind of programming constructs that allow you to put together pieces of logic in interesting and often advanced manners. Typically using them depends on the possibility of being able to pack executable code into objects, often called (for historical reasons) lambda functions or lambda expressions, but your mileage can vary.

A simple example of a (useful) combinator is one that takes two lambda functions without parameters, and creates a new one that runs them in sequence. The actual combinator looks in generic pseudocode like this:

```<code>func in_sequence(first, second):
  lambda ():
    first()
    second()
</code>```

The crucial thing that makes this a combinator is the anonymous function (lambda function) on the second line; when you call

```<code>a = in_sequence(f, g)
</code>```

the resulting object a is not the result of running first f() and then g(), but it is an object that you can call later to execute f() and g() in sequence:

```<code>a() // a is a callable object, i.e. a function without parameters
</code>```

You can similarly then have a combinator that runs two code blocks in parallel:

```<code>func in_parallel(first, second):
  lambda ():
    t1 = start_thread(first)
    t2 = start_thread(second)
    wait(t1)
    wait(t2)
</code>```

And then again,

```<code>a = in_parallel(f, g)
a()
</code>```

The cool thing is that 'in_parallel' and 'in_sequence' are both combinators with the same type / signature, i.e. they both take two parameterless function objects and return a new one. You can actually then write things like

```<code>a = in_sequence(in_parallel(f, g), in_parallel(h, i))
</code>```

and it works as expected.

Basically so combinators allow you to construct your program's control flow (among other things) in a procedural and flexible fashion. For example, if you use in_parallel(..) combinator to run parallelism in your program, you can add debugging related to that to the implementation of the in_parallel combinator itself. Later, if you suspect that your program has parallelism-related bug, you can actually just reimplement in_parallel:

```<code>in_parallel(first, second):
  in_sequence(first, second)
</code>```

and with one stroke, all the parallel sections have been converted into sequential ones!

Combinators are very useful when used right.

The Y combinator, however, is not needed in real life. It is a combinator that allows you to create self-recursive functions, and you can create them easily in any modern language without the Y combinator.

Title: What are combinators and how are they applied to programming projects? (practical explanation)

Body:
What are combinators?

I'm looking for:

a practical explanation

examples of how they are used

examples of how combinators improve the quality/generality of code

I'm not looking for:

explanations of combinators that don't help me get work done (such as the Y-combinator)

Body:
From a practical viewpoint combinators are kind of programming constructs that allow you to put together pieces of logic in interesting and often advanced manners. Typically using them depends on the possibility of being able to pack executable code into objects, often called (for historical reasons) lambda functions or lambda expressions, but your mileage can vary.

A simple example of a (useful) combinator is one that takes two lambda functions without parameters, and creates a new one that runs them in sequence. The actual combinator looks in generic pseudocode like this:

func in_sequence(first, second):
  lambda ():
    first()
    second()

The crucial thing that makes this a combinator is the anonymous function (lambda function) on the second line; when you call

a = in_sequence(f, g)

the resulting object a is not the result of running first f() and then g(), but it is an object that you can call later to execute f() and g() in sequence:

a() // a is a callable object, i.e. a function without parameters

You can similarly then have a combinator that runs two code blocks in parallel:

func in_parallel(first, second):
  lambda ():
    t1 = start_thread(first)
    t2 = start_thread(second)
    wait(t1)
    wait(t2)

And then again,

a = in_parallel(f, g)
a()

The cool thing is that 'in_parallel' and 'in_sequence' are both combinators with the same type / signature, i.e. they both take two parameterless function objects and return a new one. You can actually then write things like

a = in_sequence(in_parallel(f, g), in_parallel(h, i))

and it works as expected.

Basically so combinators allow you to construct your program's control flow (among other things) in a procedural and flexible fashion. For example, if you use in_parallel(..) combinator to run parallelism in your program, you can add debugging related to that to the implementation of the in_parallel combinator itself. Later, if you suspect that your program has parallelism-related bug, you can actually just reimplement in_parallel:

in_parallel(first, second):
  in_sequence(first, second)

and with one stroke, all the parallel sections have been converted into sequential ones!

Combinators are very useful when used right.

The Y combinator, however, is not needed in real life. It is a combinator that allows you to create self-recursive functions, and you can create them easily in any modern language without the Y combinator.


答:
Depending on your type of problem, the standard shell use of pipes might be sufficient (type in your shell):

program1 | program2

In this way the output of program1 goes directly to the input of program2. Of course this doesn't work for every problem, but a lot of (non-interactive) problems can be solved fine using this approach.


问:
What is the benefit of studying bitwise operators?
What is the benefit of studying bitwise operators (Bitwise Not, Bitwise AND, Bitwise OR, Bitwise XOR, Left Shift, Signed Right Shift, Unsigned Right Shift etc.)?

Will we really use these operators in programming?

答:
Here's an example of needing bitwise operations in a "normal" (non-gaming, non-low-level) application, from just today:

We have a VB.Net app that was upgraded from an old VB6 app, which allows users to pick their own color.  We were having issues because the color is stored in the database as a VB6 color, which are four-byte integers stored as ABGR (alpha-blue-green-red).  However, .Net uses the more usual ARGB (alpha-red-green-blue).

If you have a solid grasp of bitwise operators, this is an easy 3-minute fix.  If not, however, you would likely have found yourself struggling for a good day trying to figure them out.


问:
API Development - Sinatra?
I've been tasked to create a mobile application as well as an accompanying website. Both the application and website will interact with the same database. To make things easy, I figure creating an API would be best that way I can separate it out from the mobile application and website.

Would this be the preferable method? I'm thinking Sinatra would be best for this situation. I'm using Ruby on Rails for the website but feel it would be overkill for the API.

I just want to validate my thoughts regarding this issue.

Thanks!

答:
Actually Sinatra itself recommends using it as middleware, e.g. for rails applications. </p>

<p>So I'm guessing it's more a question of which you are most familiar with, Sinatra would be a lightweight approach, but rails could work, too. Choose the one you're most familiar with. </p>

Title: API Development - Sinatra?

Body:
Actually Sinatra itself recommends using it as middleware, e.g. for rails applications.

So I'm guessing it's more a question of which you are most familiar with, Sinatra would be a lightweight approach, but rails could work, too. Choose the one you're most familiar with.


问:
Haskell GUI: how much can be done with Haskell?
I've been wanting to try out graphics in Haskell. From what I've seen, the available libraries are either front-ends to C/C++ libraries, or an abstraction of them with minimal features. The high-level libraries do not seem to suit my needs, and so I'm left with lower-level front-ends.

What I need is to render tiles and text - basics for a very simple game. I know how to do this with C, and was thinking I could write the graphics in C and interface it with Haskell. The alternative is to write the graphics using a Haskell library.

My question is, can available Haskell libraries achieve what I want? I do not want to bend over backwards; if C can do it better than I would like to know.

答: SDL is an excellent library with good Haskell bindings—and related libraries for images, audio, and text—for which enough tutorials exist to get you off the ground; being rather low-level, it requires a bit of care to keep things pretty and functional, but in my experience SDL and Haskell make a superb combination.</p>


问:
How to handle management pushing legacy systems?
I am currently on a paid internship, and have been tasked with maintaining an obsolete system that has been developed by multiple developers (at different times) over the course of the past 5 years. Management agrees the "system is on life support", and I receive a fairly regular supply of bug reports from end users currently using the system.

Management now wants to extend the project for another year, and in the process nearly triple the user base.

As an intern (or any entry level position) how do I "push back"? I've already written a report stating my concerns, albeit in an open-ended document. Is there protocol or document type for suggesting changes? Am I in a position to make suggestions, or should I simply continue to support the old system?

To clarify, software development is not my company's primary business. As such no internal protocols exist. Additionally, the project has no formal documentation at all, and no requirements documents either. The development is very ad hoc.

答: You probably don't have enough information to determine if it is cost effective to go another year or not. It would be interesting to understand the company and why they are adding users. Seems like there may be some growth going on and they just can't afford to take a step back financially or under certain time constraints to build another app. Building a new app is rarely the best choice anyway. 5 years is not that old unless they built it on old technology to begin with.</p>


问:
Is Perl still a useful, viable language?
I know it may have been asked before, but here goes nothing...

Is Perl still something that would be considered useful? If someone was a new programmer (either completely new to programming or just a few month/years of experience) would Perl be something to be considered worthwhile to learn?

Is Perl still used with frequency? Is it still popular?

Or is Perl dying out compared to languages like Python, Ruby, PHP, ASP.NET, etc.?

Basically it boils down to this:

Is it still used/is it still used frequently? If yes, is it dying? If no, will it make a come back?

Is it something that would be worth learning?

How does it compare in demand to languages like Python in both popularity and usability/viability? Could languages like Python or Ruby be considered replacements for Perl?

Also, will newer versions of Perl really bring a large improvement to the Perl community, and perhaps bring Perl back to centerstage compared to other languages?

EDIT:

Okay, I suppose here's a better, reworded question:

Is Perl still growing, or is it "dying"? Is it still a language worth learning and using? What projects does it really "shine" in compared to other languages? What makes Perl a language to choose? Essentially: is Perl growing obsolete compared to other languages, and if so, do you expect that to change, or to continue?

And thank you to everyone who has answered so far, the discussion has been really interesting!

答:
For the record, I've been programming in Perl 5 for around 15 years, so I'm a bit biased.  Having said that, I really like Perl.  Don't listen to the naysayers, and don't think that its age is somehow an indicator of its shelf live.  The best way to look at Perl is to see it in comparison to other languages:

PHP - PHP is a pretty good web programming language; don't get me wrong.  But, it's only a web programming language.  Even web applications need their cronjobs to do clean up processes, and you have to do some strange stuff to make that happen.  Never mind having to write a quick script for UNIX administrator or parsing a text file.  Plus, PHP doesn't have CPAN.

Ruby - The language is too new and "script kiddie" for my tastes.  The only thing I hear about Ruby is Ruby on Rails.  Perl has Catalyst and Dancer (as MVC frameworks), which are damn fine MVCs, but it's not the cornerstone of the language.  You're not going to find "Ruby" as a requirement in job offers any time soon (if ever).  Plus, Ruby doesn't have CPAN.

Python - In the words of Larry Wall, Python is just snake oil.  Python cares about whitespace and the last language I used that cared about whitespace was BASIC.  Also, like BASIC, it's was essentially designed to be a easy-to-use beginner's language.  Finally, no CPAN here.

Java - Java is a problem child language.  The concept was to have this virtual machine that runs on any platform, but because of the huge popularity of the language in college courses, you see Java applications every where that they shouldn't be.  For example, in-house server-based web applications shouldn't exist.  It's a single server with specs they define and it gets wrapped in a separate VM with a limited memory footprint.  Java is bloated, and they don't have CPAN.

C# - I've actually have been using this language quite a bit now, and I've seemed to have formed a love/hate relationship with it.  Being able to overload methods with different parameters is cool and fun.  But, if you want a language that will bitch at your every line of code about type casting, then C# is for you.  My god, it wants you to put explicit casting EVERYWHERE!  Making classes are fun, but you suddenly realize that you're spending more time making classes to make the damn language just WORK than actually writing real code.

Also, C# doesn't have...okay, it has .NET, which is really good and extensive.  However, I still like CPAN better because you can still write your own modules and complain at the author about a bug or design flaw.  And they are all free.  Plus, Perl is working towards Perl.NET in the future, so we may be designing Windows applications before long.

Perl is a great language that has:

Regular Expressions - If it's one thing that Perl can do well, it's text manipulation.  Yes, many languages have regular expressions, but Perl has damn near invented them, and there's a reason why grep has a "Perl Regular Expression" mode, or why Oracle has a section on "Perl-influenced Extensions in Oracle Regular Expressions".  It's built-in and doesn't require any modules.

Flexibility - You have three basic variable types: Scalars, Arrays, and Hashes.  That's it.  That's all you need.  You don't have a int, byte, string, or any of that crap.  Perl figures it out just fine.  And you can use references all you want without fear of memory leaks or cause the whole PC to crash.  The language just works.

Portability - Perl works great on the web.  It works great in UNIX.  It even works pretty well in Windows.  It's not pigeon-holed to a single function.  It's a jack-of-all-trades, but also a master of (mostly) everything.

It's easy to do a lot with a little code - Give me a 1K blank file and I can write all kinds of things with that space.  Even a Perl one-liner is great to add into a command line pipe.

CPAN - I cannot stress how good it is to find just about anything you need for anything.  What is "anything"?  Well, how about DB modules for every database or thing you could imagine, ranging from Oracle to iPod to CSV to Adabas to Yaswi?  How about several fully featured web servers?  How about a Excel file reader, or a SNMP module, or a module that reads comments for debug lines, or modules that help you program faster?  A project that I'm doing right now is writing a dynamic Terraria map generator, augmenting from an existing module called Games::RolePlay::MapGen.  .NET would never have something like that.

Plus, it's a breeze to install any module via CPAN.  Get it from Debian.  Install it from CPAN directly.  It does as good a job as apt-get in resolving dependencies.  I have no problem telling my sysadmin to install X module from CPAN, since it's just a simple one-liner command.

Yes, it has its flaws, and yes, I'm biased towards it, but you've probably already heard the negatives too many times.  They don't outweigh the positives, not by a long shot.


问:
Should I structure my DBs based on the data's true form, or how I plan to use that data?
This is mostly a hypothetical question, but it's something I've been tossing around and I wondered what other people though. Here's a contrived example to illustrate: Let's say I'm building an app that lets users pick a few keywords and then shows them photos that are tagged with those keywords.

On one hand, I could create user, keyword and photo tables which store the data entities as they exist. This would let allow me to easily change the function of the app without needing to change the underlying data structures, but it also requires several queries to fetch the data I need for the app.

Or, I could just have a single user-photos table, and somehow stuff all the data in there. This would make it easier to pull the data I need for the app, but it would be harder to perform any other type of querying on that data. After all, a user-photo isn't really a thing -- it's just a convenient data structure for this one purpose.

This might be a bad example, but the main thrust of my question is: should your database structure be based on the actual underlying entities they're storing, or can you use shortcuts to make it easier to use the data for your purposes?

答:
You are asking if you should normalize (split into three tables) or de-normalize. You've already figured out some of the pros and cons of both. In most cases, it's preferable to go with a higher degree of normalization. This allows your data to more closely represent the entities that you're dealing with, and in general this will make life easier.

In your case, I recommend the first option (though you might find it will need some tweaking - for example: the relationship between photos and keywords is many-to-many, so you might want a photos-keywords to store these relationships). You can still get the notion of user-photo with a query or view on the three underlying tables.

Situations where denormalization might be better usually happen in reporting systems.

For more reading:

Normalization: http://en.wikipedia.org/wiki/Database_normalization

Denormalization: http://en.wikipedia.org/wiki/Denormalization


答:
I would go with a normalized database design always. One advantage of normalized database design is that normalization allows you to extend the database without re-work in most cases (I am yet to prove this idea...).

In your case:

The proposed design

user, keyword and photo

is not valid. This is because the relationship between a user and a keyword is a many-to-many relation.

also

user - photo

is not valid, where would you store the keywords and how would you relate them to users if you do this?

This would make it easier to pull the data I need for the app

Don't worry about reading the data. It is just a matter of some SQL that would take you few hours or less to build and tune.

Title: Should I structure my DBs based on the data's true form, or how I plan to use that data?

Body:
This is mostly a hypothetical question, but it's something I've been tossing around and I wondered what other people though. Here's a contrived example to illustrate: Let's say I'm building an app that lets users pick a few keywords and then shows them photos that are tagged with those keywords.

On one hand, I could create user, keyword and photo tables which store the data entities as they exist. This would let allow me to easily change the function of the app without needing to change the underlying data structures, but it also requires several queries to fetch the data I need for the app.

Or, I could just have a single user-photos table, and somehow stuff all the data in there. This would make it easier to pull the data I need for the app, but it would be harder to perform any other type of querying on that data. After all, a user-photo isn't really a thing -- it's just a convenient data structure for this one purpose.

This might be a bad example, but the main thrust of my question is: should your database structure be based on the actual underlying entities they're storing, or can you use shortcuts to make it easier to use the data for your purposes?


问:
What's your favourite quote about programming?
What's your favourite quote about programming?

One quote per answer, and please check for duplicates before posting!

答:
Should array indices start at 0 or 1?
  My compromise of 0.5 was rejected
  without, I thought, proper
  consideration.

    — Stan Kelly-Bootle

LastEditorDisplayName: Roger Pate


答:
Yes, you can.

I assume that he owns the copyright to the file, and can change the license of that file as he sees fit.

He cannot change the terms of existing licenses nor can he prevent new licensees from being issued (by others, but to his code) under different terms. The MIT license is irrevocable and includes automatic issuing of licenses to new recipients.

Title: MIT and copyright

Body:
I am contributing to a library that is licensed under the MIT license.

In the license and in each class file it has a comment at the top saying:

Copyright (c) 2011 Joe Bloggs <joe.bloggs@example.com>

I assume that he owns the copyright to the file, and can change the license of that file as he sees fit.

If I contribute to the library with a new class entirely write by me, can I claim copyright of that file. And put:

Copyright (c) 2011 Petah Piper <petah.piper@example.com>

at the top?


答:
What you're talking about is sometimes referred to as the difference between OLTP and OLAP databases.  The only letter that differs is the T/A:

T = Transactional

A = Analytical

OLTP databases are optimized for data that's being changed all the time.  That typically involves making sure it's normalized.

OLAP databases are optimized for reporting.  They're typically de-normalized, something like a "star" table configuration.

Normally the OLTP databases are the production databases that are running all day long collecting data, and then there's some kind of process that takes the data from the OLTP database and reformats it into the OLAP database at regular intervals (nightly, for instance).  That means some person sitting at their desk running historical reports can't see anything after last night, but they get better performance.

That means if you started building your application by including an OLAP database for your reporting, it's probably a case of premature optimization.  You need the OLTP database to run your application, and the OLAP is an optimization to improve performance.  Therefore, the correct approach is to start by designing a normalized database (in your case separate tables for each "entity").


答:
Performance is one of the major reasons to opt for perl. Compared with Python, Ruby or any of the JVM based scripting languages its lightning fast.

This is why its never been replaced in the data mining space, all the other (freebie) languages are slower when it comes to handling large volumes of data.

Title: Is Perl still a useful, viable language?

Body:
I know it may have been asked before, but here goes nothing...

Is Perl still something that would be considered useful? If someone was a new programmer (either completely new to programming or just a few month/years of experience) would Perl be something to be considered worthwhile to learn?

Is Perl still used with frequency? Is it still popular?

Or is Perl dying out compared to languages like Python, Ruby, PHP, ASP.NET, etc.?

Basically it boils down to this:

Is it still used/is it still used frequently? If yes, is it dying? If no, will it make a come back?

Is it something that would be worth learning?

How does it compare in demand to languages like Python in both popularity and usability/viability? Could languages like Python or Ruby be considered replacements for Perl?

Also, will newer versions of Perl really bring a large improvement to the Perl community, and perhaps bring Perl back to centerstage compared to other languages?

EDIT:

Okay, I suppose here's a better, reworded question:

Is Perl still growing, or is it "dying"? Is it still a language worth learning and using? What projects does it really "shine" in compared to other languages? What makes Perl a language to choose? Essentially: is Perl growing obsolete compared to other languages, and if so, do you expect that to change, or to continue?

And thank you to everyone who has answered so far, the discussion has been really interesting!