问:
Is the time spent customizing your dev machine environment worth it?
There are times when I am working on programming project and I get the itch to change some stuff in my environment (OSX or Linux). Vim might not being doing exactly
what I want, so instead of doing it the round about way I've been doing for a
couple months (sometimes years) I go and figure out the right way. Or I may be
doing something long handed in bash and I say to myself why don't I figure out
a better way.

The thing is when I go off and do this hours can fly by. Sometimes I
get stuck on trying to get what I want. I'll know I'm really close, so I don't give
up. I usually always get it eventually, but its after hours of tinkering and
googling. I hate the feeling of giving up and having to deal with something I
know could work better.

When I'm done I have a warm feeling knowing that my environment is a little more smooth
and personalized, but I wonder could my time be better spent. Where do I draw
the line? It seems with the all the UNIX-style tools there is an endless amount
to learn.

Always thought the sign of a superior programmer is someone who goes out of
their way to make the computer bend to their will. Am I doing it right? I figure
the bash shell, unix/linux, and vim will be around forever, so I see it as an investment.

But then again I just spend 3 hours trying to get some stupid thing the vimperator firefox
plugin to work right.

So I wondering what this community think about this.

答:
software tools are incredibly important. having the right tools available is crucial and well worth the time invested (not lost). consider the investment in learning and mastering a certain text editor or programming language...these skills will be with you long after you have left your current job,  which is why i keep using the term investment

think of the very best coders you know...my guess is they have very strong opinions about tools. do you know any excellent coders who let the IT dept decide what text editor they will use?

most coders are tinkerers. it is natural to tinker with your own tools. if your boss is a repsectable coder, chances are he or she is a tinkerer too


问:
Unwritten rules of rewriting another team member's code
We are practicing collective code ownership. To my understanding this means that any developer can change any line of code to add functionality, to refactor, fix bugs or improve designs.

But what about a complete rewriting of code from a developer who is still in the team? Should I ask him first? What is the best practice?

答:
From my observation the general practice is:  Never delete the code.  Just comment it out and keep it.

My practice is to comment it out while replacing it.  (Mainly for reference.)  Then delete it on the the final commit of the working change.   (This requires version control and an understanding of how to revert changes.)

When I find old commented code, I try to delete it in a separate commit with appropriate comments.  This makes it easier to revert or inspect the change should it be required.

For all changes you should be able to use the revision history to determine the developer(s) who created the code.  (Annotated revision history helps here.)  Contact them if possible to see why the code is as it is.  On many projects, cleanup time just doesn't occur and things get left behind.  Check the bug tracker to see if there is a record of the required cleanup.  Sometime changes need to be cleaned up a release or two later.

If you are changing code, there should be a reason you are working with that code.  Check with the original developer to find out why the code is like it is.  If there is a legitimate reason not to fix it, add a comment explaining why it wasn't fixed, or why is shouldn't be changed.  This will save the next developer some time.

Tags like FixMe, ToDo, Bug, and Hack can be used to indicate code which could be changed later.  (It is acceptable to tag limitations as Bug and not fix them if they won't be triggered under the required conditions.)  It might be bug if a home accounting program overflows at 20 million dollars, but I wouldn't waste much time fixing it.

Code review changes should be done by the original developer if it is appropriate to modify the code.

ContentLicense: CC BY-SA 3.0


问:
How can rotating release managers improve a project's velocity and stability?
The Wikipedia article on Parrot VM includes this unreferenced claim:

Core committers take turns producing releases in a revolving schedule, where no single committer is responsible for multiple releases in a row. This practice has improved the project's velocity and stability.

Parrot's Release Manager role documentation doesn't offer any further insight into the process, and I couldn't find any reference for the claim. My first thoughts were that rotating release managers seems like a good idea, sharing the responsibility between as many people as possible, and having a certain degree of polyphony in releases.

Is it, though? Rotating release managers has been proposed for Launchpad, and there were some interesting counterarguments:

Release management is something that requires a good understanding of
  all parts of the code and the authority to make calls under pressure if
  issues come up during the release itself

The less change we can have to the release process the better from an
  operational perspective

Don't really want an engineer to have to learn all this stuff on the
  job as well as have other things to take care of (regular development
  responsibilities)

Any change of timezones of the releases would need to be approved with
  the SAs

and:

I think this would be a great idea (mainly because of my lust for
  power), but I also think that there should be some way making sure that
  a release manager doesn't get overwhelmed if something disastrous
  happens during release week, maybe by have a deputy release manager at
  the same time (maybe just falling back to Francis or Kiko would be
  sufficient).

The practice doesn't appear to be very common, and the counterarguments seem reasonalbe and convincing. I'm quite confused on how it would improve a project's velocity and stability, is there something I'm missing, or is this just a bad edit on the Wikipedia article?

Worth noting that the top voted answer in the related "Is rotating the lead developer a good or bad idea?" question boldly notes:

Don't rotate.

答:
Depending on how your process is structured, I can think of two arguments for rotation:

When we have releases that overlap, such as bug back port releases that happen concurrently with a general release, it helps manage complexity to have separate people handle separate releases.

Releases often have a "star feature."  In such a case it is very useful to have someone very familiar with that feature be the person who makes the calls on what bugs are show stoppers, what to errata, what last minute changes are too risky, when are we confident it has been sufficiently tested, etc.


问:
Replacing Multiple Inhertance with delegation
I was going through "Object Oriented Modelling and Design" by James Rumbaugh et al and it said that in languages where multiple inheritance is not supported like Java three mechanisms can be used as workarounds

Delegation using aggregation of roles

Inherit the most important

class and delegate the rest Nested Generalization

I couldnt understand the examples given in the text. Could any one please explain this with an example. I know that "diamond problem" is  a problem within multiple inheritance and java supports multiple inheritance of interfaces.

答: Java does not provide multiple inheritance. Interfaces are in fact not inherited they are implemented/realized. Inheritance is used to extend a class static and dynamic characteristics, with composition (delegation, aggregation) the behaviors of a class are extended by adding adding classes instances (attributes, references) it can use to perform the services it provides. For instance if you have a Class for a thread which needs a socket you can make the Thread class extending the Socket class (very bad decision) and use the method it inherits or make the Thread class owning a Socket object it can use and delegate to it the socket stuff. Same behavior very different architecture.</p>


答:
I think the role of a Release Manager is somewhat different to the role of a Lead Developer, depending on the size of your development team/organisation.

ITIL v3 describes the role of a release manager as:

The Release Manager is responsible for planning and controlling the movement of Releases to test and live environments. His primary objective is to ensure that the integrity of the live environment is protected and that the correct components are released.

The RM is basically accountable and responsible for the following sub-processes:

Release Management Support

Release Planning

Release Build

Release Deployment

Early Life Support

Release Closure

I believe that having strong release management processes and a strong RM can certainly improve project stability, however - I'm not convinced it will improve velocity. There's also an inherent risk with having one single person responsible for the release management role. As with anything where you have one primary person that knows what to do/what is going on, there needs to be contingency planning in place in the event that person is unavailable or indisposed (e.g. hit by a bus).

Release management is something that requires a good understanding of all parts of the code and the authority to make calls under pressure if issues come up during the release itself

Having appropriate (and documented) processes and procedures in place and empowering the RM to make decisions, where another person steps into the role they should be able to take up the role with relative ease - providing all processes and practices are transparent. The RM should also be liaising with the Lead Developer for technical advice (where appropriate) before making decisions on the release. This ensures that correct decisions are made based on the information provided by the development team.

The less change we can have to the release process the better from an operational perspective

See my above point, providing the RM is governed by a set of policies and processes that require a change/review process prior to being changed - there shouldn't be any destabilisation throughout the release process.

Don't really want an engineer to have to learn all this stuff on the job as well as have other things to take care of (regular development responsibilities)

This one depends on the culture of the team/organisation. You could have a dedicated team of RMs who rotate through the release cycles and perform other duties when they do not have a "big release" to look after.

Where there is a release that contains complex requirements/features/etc, it would also be a good idea to have someone who knows about these changes as the RM - as they would be best positioned to make decisions about the quality and stability of the code that is to be released. As stated above, having good policies/procedures/documentation about your release process means that the role should not be a far stretch for someone to step into.

When it comes to project velocity, I don't believe that having a rotating RM will improve it, as having low velocity is generally not because release management practices are bad, or the Release Manager themselves is - it's usually part of a deeper/wider problem within the development team.

Overall - I think that rotating the role is generally a good idea, as it provides greater transparency to the process and shares knowledge and experience amongst your team members. This means that at any given point, someone should be able to step into the RM role in the event of an "emergency". Having a backup RM to the currently delegated one should always be in place, just in case that bus comes along and wipes out your RM.

Title: How can rotating release managers improve a project's velocity and stability?

Body:
The Wikipedia article on Parrot VM includes this unreferenced claim:

Core committers take turns producing releases in a revolving schedule, where no single committer is responsible for multiple releases in a row. This practice has improved the project's velocity and stability.

Parrot's Release Manager role documentation doesn't offer any further insight into the process, and I couldn't find any reference for the claim. My first thoughts were that rotating release managers seems like a good idea, sharing the responsibility between as many people as possible, and having a certain degree of polyphony in releases.

Is it, though? Rotating release managers has been proposed for Launchpad, and there were some interesting counterarguments:

Release management is something that requires a good understanding of
  all parts of the code and the authority to make calls under pressure if
  issues come up during the release itself

The less change we can have to the release process the better from an
  operational perspective

Don't really want an engineer to have to learn all this stuff on the
  job as well as have other things to take care of (regular development
  responsibilities)

Any change of timezones of the releases would need to be approved with
  the SAs

and:

I think this would be a great idea (mainly because of my lust for
  power), but I also think that there should be some way making sure that
  a release manager doesn't get overwhelmed if something disastrous
  happens during release week, maybe by have a deputy release manager at
  the same time (maybe just falling back to Francis or Kiko would be
  sufficient).

The practice doesn't appear to be very common, and the counterarguments seem reasonalbe and convincing. I'm quite confused on how it would improve a project's velocity and stability, is there something I'm missing, or is this just a bad edit on the Wikipedia article?

Worth noting that the top voted answer in the related "Is rotating the lead developer a good or bad idea?" question boldly notes:

Don't rotate.


问:
Can I distribute software that's using Microsoft's Visual Basic 2010 Express Edition?
Am I within my rights to write and distribute software in compiled and source form using, in part, Microsoft's Visual Basic 2010 Express Edition? I have only the free, express version.

If it has anything to do with this, the license I am using is the CC BY-NC-SA 3.0 license.

答:
I found this in a Microsoft forum, Need help understanding the Microsoft EULA for Express Products:

Since the question is a license issue, you can call 1-800-426-9400 , Monday through Friday, 6:00 A.M. to 6:00 P.M. (Pacific Time) to speak directly to a Microsoft licensing specialist, and you can get more detail information from there. You can also visit the following site for more information and support on licensing issues:
  http://www.microsoft.com/licensing/mla/default.aspx


问:
Is there a way to input values on a web site's text box using a database table values?
I have a table with username and passwords that I want to input in Hotmail's username and password box. Is there a way to actually program this? Are you allowed to manipulate text boxes of someone else's webpage? Not for illegal purposes, just to make my job easier and to not have to input values manually one by one. Hotmail is just an example.</p>

答:
Yes, it is possible, but it's probably a very bad idea.

First of all, you are introducing security problems. First you had a username and a password, and they were in your head only. The attack surface is small: with the exception of social engineering, a combination of at least two attacks is required, e.g. man-in-the-middle and a compromised SSL certificate. If, however, you write your tool, you'll have a whole database server, probably with a web server on top, and some javascript to access it. Compromise any of those parts, and there's all your passwords. It's probably not even hard to exploit: if your javascript is out in the open, then all it takes to get to your password is to run that javascript on a different page and have it submit a form there (ideally in a hidden iframe so you never get to see it happening). While it is unlikely that an attacker targets you specifically, if they do, the consequences are disastrous.

And then there's the legal side. In many countries, 'hacking' is illegal, even without criminal intent. What constitutes hacking is rather ill-defined, and things like disabling javascript to get around client-side validation have been found to be punishable in the past. While your intent is innocent, the technique, although unlikely to be detected, could, in extreme cases, be considered hacking.

And finally; there are solutions that can already do this, although they don't use an SQL database. Look for form filler plugins; there's plenty of them for most major browsers, just pick one that suits your preferences.


答:
Yes, you can distribute your source and binaries, under any license terms, for free or you can charge if you like.

https://stackoverflow.com/questions/3969484/can-i-produce-a-commercial-application-using-visual-studio-express-2010

Title: Can I distribute software that's using Microsoft's Visual Basic 2010 Express Edition?

Body:
Am I within my rights to write and distribute software in compiled and source form using, in part, Microsoft's Visual Basic 2010 Express Edition? I have only the free, express version.

If it has anything to do with this, the license I am using is the CC BY-NC-SA 3.0 license.


答: Yes, the express versions does not impact your licensing models of software you create. They only limit the functionality that the IDE provides for you.</p>


答:
There are two things to take into account here.

project release process is quite effort consuming:

takes 1 month, release manager guide is 15K plain text,

has 11 steps featuring total ~50 sub-points (see breakdown below)

release is performed by developers ("committers"),

they don't have dedicated release engineer

guess this is because it's open source, where everyone wants to be a developer

with process that complicated they'd likely have to also have a backup release engineer

Based on above observations, it's fairly easy to figure the reasoning behind their claims.

Velocity part of their claim is probably best spelled in release manager guide:

To make a monthly release schedule possible, we spread the burden of releases...

Having one committer doing releases that take as much "burden" as per their guide, plus doing regular development work, would hardly allow them release monthly - more likely two or three times less frequently - and even that would go only until that "only scapegoat committer" doing releases would get bored to death and leave the project.

Stability part of their claim goes most likely from the fact that release process, as well as its documentation are pretty complicated. Rotation of the guys running the process and using the documentation provides permanent review of the process and guide, keeping them up-to-date and in sync.

Appendix: Release manager guide breakdown

I. Preparations During the Month Before a Release

  8 sub-points

II. Get the Most Recent Changes

  2 sub-points

III. Update the Release Version

  10 sub-points

IV. Push Changes to the GitHub Repository

  4 sub-points

V. Prepare the Release Tarballs

  5 sub-points

VI. Tag the Release Commit

  2 sub-points

VII. Push Tarballs to the FTP Server

  6 sub-points

VIII. Release Announcement

  3 sub-points

IX. Update the Website

  7 sub-points

X. Update parrot.github.com and the Relevant parrot-docsx Repository

  1 sub-point,...

  ...plus "more information about the update process"
  referring to release_parrot_github_guide.pod which incidentally
  contains 4 more sub-points

XI. Publicity

  6 sub-points


问:
How do you encode Algebraic Data Types in a C#- or Java-like language?
There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as:

```<code>data ConsList a = Empty | ConsCell a (ConsList a)

consmap f Empty          = Empty
consmap f (ConsCell a b) = ConsCell (f a) (consmap f b)

l = ConsCell 1 (ConsCell 2 (ConsCell 3 Empty))
consmap (+1) l
</code>```

This particular example is in Haskell, but it would be similar in other languages with native support for Algebraic Data Types.

It turns out that there is an obvious mapping to OO-style subtyping: the datatype becomes an abstract base class and every data constructor becomes a concrete subclass. Here's an example in Scala:

```<code>sealed abstract class ConsList[+T] {
  def map[U](f: T => U): ConsList[U]
}

object Empty extends ConsList[Nothing] {
  override def map[U](f: Nothing => U) = this
}

final class ConsCell[T](first: T, rest: ConsList[T]) extends ConsList[T] {
  override def map[U](f: T => U) = new ConsCell(f(first), rest.map(f))
}

val l = new ConsCell(1, new ConsCell(2, new ConsCell(3, Empty)))
l.map(1+)
</code>```

The only thing needed beyond naive subclassing is a way to seal classes, i.e. a way to make it impossible to add subclasses to a hierarchy.

How would you approach this problem in a language like C# or Java? The two stumbling blocks I found when trying to use Algebraic Data Types in C# were:

I couldn't figure out what the bottom type is called in C# (i.e. I couldn't figure out what to put into class Empty : ConsList< ??? >)

I couldn't figure out a way to seal ConsList so that no subclasses can be added to the hierarchy

What would be the most idiomatic way to implement Algebraic Data Types in C# and/or Java? Or, if it isn't possible, what would be the idiomatic replacement?

答:
In C#, you can't have that Empty type, because, due to reification, the base types are different for different member types. You can only have Empty<T>; not that useful.

In Java, you can have Empty : ConsList due to type erasure, but I am not sure whether the type checker wouldn't scream somewhere.

However since both languages have null, you can think of all their reference types as being "Whatever|Null". So you'd just use the null as the "Empty" to avoid having to specify what it derives.

ContentLicense: CC BY-SA 4.0


问:
not checking in from the project root
Whenever I do a check-in, I always check in from the root of the project... i.e. check in all the files in my working copy, so after the check-in the source control repo contains exactly the same set of files that I just finished testing in my local copy.  I also make sure my source control is set to flag local files that are not under source control.  In general, there are none of these files... if there are, I either add them to source control or mark them as "ignored".  I also check in all my changes together in one check-in.

A lot of colleagues check in much differently.  They carefully select each file to check in, as if they are a master jeweler selecting only the very best gemstones to set into the royal crown, and they check in each one as a separate check-in.  They rely only on their memory to figure out which files need to be checked in, or especially added to source control.

The results are quite predictable... frequent broken builds because they forget to add their new files to source control or forget to check in a changed file (especially changed project files).

I have mentioned this to them and they never seem to change.  When I mentioned it to the team lead he said, "this is just a different way of working".  To which I may respond: What if I want to drive my car with my eyes closed?  Is that just "a different way of driving"?

Am I right in being bothered by this practice?

答:
Leaving the orthogonal problem of how to not forget to add files aside, your approach can lead to another problem: accidentally checking in changes that were just for testing etc.

Handpicking the source files (or sub-directories) to commit is one possible approach which can be done responsibly and without regularly breaking builds (utilizing the status info of your VCS). The real problem here is spreading the changeset over many different check-ins, one for every file. This will inevitably to lead to difficulties when the version history is needed for anything.

ContentLicense: CC BY-SA 2.5

Title: not checking in from the project root


答:
The only thing needed beyond naive subclassing is a way to seal classes, i.e. a way to make it impossible to add subclasses to a hierarchy.

In Java you can't.  But you can declare the base class as package private, which means that all direct subclasses have to belong to the same package as the base class.  If you then declare the subclasses as final, they can't be subclassed any further.

I don't know if this would address your real problem though ...

Title: How do you encode Algebraic Data Types in a C#- or Java-like language?

Body:
There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as:

```<code>data ConsList a = Empty | ConsCell a (ConsList a)

consmap f Empty          = Empty
consmap f (ConsCell a b) = ConsCell (f a) (consmap f b)

l = ConsCell 1 (ConsCell 2 (ConsCell 3 Empty))
consmap (+1) l
</code>```

This particular example is in Haskell, but it would be similar in other languages with native support for Algebraic Data Types.

It turns out that there is an obvious mapping to OO-style subtyping: the datatype becomes an abstract base class and every data constructor becomes a concrete subclass. Here's an example in Scala:

```<code>sealed abstract class ConsList[+T] {
  def map[U](f: T => U): ConsList[U]
}

object Empty extends ConsList[Nothing] {
  override def map[U](f: Nothing => U) = this
}

final class ConsCell[T](first: T, rest: ConsList[T]) extends ConsList[T] {
  override def map[U](f: T => U) = new ConsCell(f(first), rest.map(f))
}

val l = new ConsCell(1, new ConsCell(2, new ConsCell(3, Empty)))
l.map(1+)
</code>```

The only thing needed beyond naive subclassing is a way to seal classes, i.e. a way to make it impossible to add subclasses to a hierarchy.

How would you approach this problem in a language like C# or Java? The two stumbling blocks I found when trying to use Algebraic Data Types in C# were:

I couldn't figure out what the bottom type is called in C# (i.e. I couldn't figure out what to put into class Empty : ConsList< ??? >)

I couldn't figure out a way to seal ConsList so that no subclasses can be added to the hierarchy

What would be the most idiomatic way to implement Algebraic Data Types in C# and/or Java? Or, if it isn't possible, what would be the idiomatic replacement?


问:
Is STL implemented with OO?
There are several design patterns like Adaptor, Iterator implemented in STL.

Does that mean STL is implemented with OO concepts?

What is the relationship between OO and template parts of C++?

I learned that virtual member function which justifys the OO is contradict
with template, is this correct?

答:
In my opinion STL is more about algorithms over iterable containers than OO.

It defines a common interface (the iterator) to be implemented in order to use the algoritms.

C/C++ iterators are called enumerator/enumeratable in Java and C#

Maybe STL is more aspect-oriented than OO.

Title: Is STL implemented with OO?


问:
Do I need to use an interface when only one class will ever implement it?
Isn't the whole point of an interface that multiple classes adhere to a set of rules and implementations?</p>

答:
Strictly speaking, no you don't, YAGNI applies. That said, the time you'll spend creating the interface is minimal, especially if you have a handy code generation tool doing most of the job for you. If you are uncertain on whether you are going to need the interface of or not, I'd say it's better to err on the side of towards supporting the definition of an interface.

Furthermore, using an interface even for a single class will provide you with another mock implementation for unit tests, one that's not on production. Avner Shahar-Kashtan's answer expands on this point.


答: No (YAGNI), unless you are planning to write tests for other classes using this interface, and those tests would benefit from mocking the interface.</p>

Title: Do I need to use an interface when only one class will ever implement it?

Body: Isn't the whole point of an interface that multiple classes adhere to a set of rules and implementations?</p>


答:
Interfaces are designated to define a behaviour, i.e. a set of prototypes of functions/methods. The types implementing the interface will implement that behavior, so when you deal with such a type you know (partly) what behavior it has.

There is no need to define an interface if you know that the behavior defined by it will be used only once. KISS (keep it simple, stupid)


答:
From MSDN:

Interfaces are better suited to situations in which your applications require many possibly unrelated object types to provide certain functionality.

Interfaces are more flexible than base classes because you can define a single implementation that can implement multiple interfaces.

Interfaces are better in situations in which you do not need to inherit implementation from a base class.

Interfaces are useful in cases where you cannot use class inheritance. For example, structures cannot inherit from classes, but they can implement interfaces.

Generally in the case of a single class, it will not be necessary to implement an interface, but considering the future of your project, it could be useful to formally define necessary behavior of classes.


答:
While in theory you shouldn't have an interface just for having-an-interface's sake, Yannis Rizos's answer hints at further complications:

When you're writing unit tests and using mock frameworks such as Moq or FakeItEasy (to name the two most recent ones I've used), you're implicitly creating another class that implements the interface. Searching the code or static analysis might claim that there's just one implementation, but in fact there's the internal mock implementation. Whenever you start writing mocks, you'll find that extracting interfaces makes sense.

But wait, there's more. There are more scenarios where there are implicit interface implementations. Using .NET's WCF communication stack, for instance, generates a proxy to a remote service, which, again, implements the interface.

In a clean code environment, I agree with the rest of the answers here. However, pay attention to any frameworks, patterns or dependencies you have that might make use of interfaces.


答:
No, I'd say the STL is not particularly OO, if anything it maps more to a functional programming style. In particular:

std::algorithms are free functions not methods

they often take function objects so :. are higher order functions

they operate on any container

std::transform is map, the X_if functions are filters, std::accumulate is fold/reduce

likewise you can sort of argue that the containers themselves are monads

template instantiation is a type construction

the sequences at least have unit constructors e.g. vector<string>(1,"Foo")

fmap is std::transform

bind and/or join are implementable (though not provided out of the box)

any reasonable implementation of bind/join would meet the monad laws

For your other questions, the OO parts and template parts of C++ are seperate, and virtual functions do not preclude having templates. In the case of the STL the design just does not choose to use virtual functions.

Title: Is STL implemented with OO?

Body:
There are several design patterns like Adaptor, Iterator implemented in STL.

Does that mean STL is implemented with OO concepts?

What is the relationship between OO and template parts of C++?

I learned that virtual member function which justifys the OO is contradict
with template, is this correct?


答:
First, the "STL" is not an official term, it is the name of the library proposed for inclusing in the C++ Standard Library when there was no containers. It provides essentially container and algorithms templates.

Now, these container and algorithms templates are...templates so they produce types as needed. They don't rely on inheritance from the point of view of the user.

However, the standard library specify essentially the interface of the library, not the implementation. A lot of STL implementations will use a bit of object orientation in their implementation but as a user you will not see it if you don't dive in your implementations source code (that have to be exposed as it is essentially template code).

I learned that virtual member function which justifys the OO is
  contradict with template, is this correct?

No, they are orthogonal concepts that provide very different sets of advantages and cons. In fact in C++, one of the key advantage to use such a language is that you have both available and using one don't cancel using the other. It is even a very big advantage.
For example one of the most interesting idiom in C++ is CRTP that use both templates and inheritance. The idea is that the inheritance part allows you to extend several types with a common behaviour and data, as a base class; while the template part make sure to generate specific base classes for each child, making impossible to have a pointer to all the classes using the CRTP class as base. This is extremely useful and don't allow messing with inheritance where there shouldn't be.

I've also implemented very generic event dispatching systems that didn't know either event types or listener types but combined internally dynamic and static code that together allowed to generate the right internal types corresponding to the right runtime types.

And that's the point: you don't always need "object orientation". In fact, most of the time you don't need it at all, you need to define some types and use them directly as different part of some kind of abstract engine (composition).
You don't always need generic code, aka templates. You need it sometimes to generalize a function to apply to several unrelated types. When they are related you can use their base class instead and not need templates.

They have different advantages and completely different costs so they are good to combine to solve complex problems.

STL is a good example of a problem where most of it is about providding types (containers) and functions (algorithms) that are related to a given type instead of a hierarchy of runtime objects.
In the standard library, streams are made in a way that is typical to object orientation: it is a hierarchy of stream classes that does different things in a way that allow defining a sub stream class that combine different behaviours/capacities.
There, object orientation is useful, even if some people would prefer it to be more like the STL (I'm not a specialist on the subject).

So, just think of them as very different tools, as a screwdriver and a hammer. C++ don't let you think with only one tool in mind.

Title: Is STL implemented with OO?


问:
Cross platform or web development with .NET
With iOS and Android soaring on mobile devices that become ever more pervasive, every other year being the 'year of Linux on the desktop' - which is somewhat snarky, but they are getting there -, OSX still holding its own, the time when one could simply say "it runs on Windows, and if you're not using Windows, well, sucks to be you".

I'm a .NET developer, with the applications i'm developing being fairly service-oriented, so that I can easily expose the backend logic to different frontends cross platform. I'm really bad at user interfaces, but in the end, applications do need to end up with an end user. And to present the application to the end user, it needs a GUI. It was looking like XAML/WPF was the land of bounty, where they weren't quite there yet, but were aiming to make a cross platform presentation layer. Lately, it has been mighty quiet on the WPF front though. Silverlight is all but dead. I sort of half hope that the 'right thing' will be happening here, with some black magic, pixiedust and flying unicorns that poop rainbows transforming my code + XAML into HTML5/CSS3 applications, winforms, metro, or whatever other form I choose to build for. This might be a bit optimistic.

So what presentation forms should I be looking in to? I would like to continue to use .NET as a primary ecosystem. Should I just be going asp.net + html5, and do the front end by hand in html5/js/css? Is there any framework that looks like it will hold the promise to be able to do something in a somewhat unified language?

答:
Use Html5/CSS3 as native mobile/web development. This will allow you to get same result on mobile as well as desktop devices.

As a .NET developer you might be familiar with ASP.NET framework development, thus i would suggest to use ASP.NET MVC 4 for cross-platform mobile development with views/pages in HTML5/CSS3. There are good number of tools and mobile frameworks that are a part this development community.

You may look for more details @  What’s New for Mobile Development in ASP.NET MVC 4.

There is also possibility to use Silverlight, but i did not explore it yet. Here is a refernce to look - Silverlight for mobile phones


答:
OOP implementation, by itself, means nothing until you don't define what you mean by "object".
If Objects are values (not entities, like the most of the so-called OOP languages but C++ assumes), then STL is OOP otherwise no.

Assume this code fragment:

```<code>Person a("joe");
Person b = a;
</code>```

Are a and b two representations of a same living person or just two living pesons with a same name?

What is the object? a, b or the living person(s) they represent?

Also, C++ inheritance is a technical aggregation mechanism that's different from Object inheritance (that is an abstraction). The two can coincide if you impose a certain discipline (like Objects are all accessible trough indirection, and are all replaceable - that means all relevant methods are virtual) otherwise they can target different objectives (C++ inheritance is nothing more than an "implicit composition")

Templates also can (via specialization) offer "substitution" mechanism, based on static types rather than dynamic types (based on virtual functions) and in this sense -if a same discipline is used at compile-time- provide a compile-time OOP.

In essence non of the C++ aggregation and dispatching schemes is by itself OOP or justify OOP. They can do other things as well.
OOP is an abstract methodology to describe and relate object together.
Those relation can be mapped to inheritance and virtual dispatch if object types depends on the run-time execution, or can be mapped to template specialization and implicit conversions if the object types can be defined during compilation.
Inheritance can be just a one of the way to provide implicit conversion between references and pointers.

Title: Is STL implemented with OO?

Body:
OOP implementation, by itself, means nothing until you don't define what you mean by "object".
If Objects are values (not entities, like the most of the so-called OOP languages but C++ assumes), then STL is OOP otherwise no.

Assume this code fragment:

Person a("joe");
Person b = a;

Are a and b two representations of a same living person or just two living pesons with a same name?

What is the object? a, b or the living person(s) they represent?

Also, C++ inheritance is a technical aggregation mechanism that's different from Object inheritance (that is an abstraction). The two can coincide if you impose a certain discipline (like Objects are all accessible trough indirection, and are all replaceable - that means all relevant methods are virtual) otherwise they can target different objectives (C++ inheritance is nothing more than an "implicit composition")

Templates also can (via specialization) offer "substitution" mechanism, based on static types rather than dynamic types (based on virtual functions) and in this sense -if a same discipline is used at compile-time- provide a compile-time OOP.

In essence non of the C++ aggregation and dispatching schemes is by itself OOP or justify OOP. They can do other things as well.
OOP is an abstract methodology to describe and relate object together.
Those relation can be mapped to inheritance and virtual dispatch if object types depends on the run-time execution, or can be mapped to template specialization and implicit conversions if the object types can be defined during compilation.
Inheritance can be just a one of the way to provide implicit conversion between references and pointers.


问:
easiest way for push notifications
I wanted to implement real time push notification to one of the apps written in RoR. I don't have any experience with nodejs, nowjs, express or socketio.

What would be the easiest way to implement the realtime push notification system?

答:
The good folks at pubsubhubbub have a great solution using RSS feeds.
'PubSubHubBub' is a new protocol for real-time notifications.

In short, how you can enable your app to push real-time notifications:

Enable your app with an RSS feed

You need to register your feed with a Pubsubhubbub hub

Your subscribers will then receive real-time (or extremely close to real-time) updates from the hub

Please refer to this youtube video for a comprehensive presentation on the subject.

Title: easiest way for push notifications


答:
It's possible to work a little sloppy if you have good tools to keep bad builds from happening. Generally this will keep the team happier than requiring constant vigilance.

Setting up a continuous build is the first step. If broken builds are a problem, it will reveal it.

Then you could write a submit script that, given a list of files, checks out the project head in a new directory, patches them in, runs tests, and checks in the files together if they pass. Then they can cherry-pick if they like, so long as they use the submit script.

Title: not checking in from the project root

Body:
Whenever I do a check-in, I always check in from the root of the project... i.e. check in all the files in my working copy, so after the check-in the source control repo contains exactly the same set of files that I just finished testing in my local copy.  I also make sure my source control is set to flag local files that are not under source control.  In general, there are none of these files... if there are, I either add them to source control or mark them as "ignored".  I also check in all my changes together in one check-in.

A lot of colleagues check in much differently.  They carefully select each file to check in, as if they are a master jeweler selecting only the very best gemstones to set into the royal crown, and they check in each one as a separate check-in.  They rely only on their memory to figure out which files need to be checked in, or especially added to source control.

The results are quite predictable... frequent broken builds because they forget to add their new files to source control or forget to check in a changed file (especially changed project files).

I have mentioned this to them and they never seem to change.  When I mentioned it to the team lead he said, "this is just a different way of working".  To which I may respond: What if I want to drive my car with my eyes closed?  Is that just "a different way of driving"?

Am I right in being bothered by this practice?


问:
Generic way of handling exceptions in windows phone?
I mean what are some of the ways other programmers deal with exception for example, when an error occurs when accessing a web service for say. If an example cant be given for windows phone, give the closest you could.</p>

答:
There are different ways how to handle errors. basically you use framework to handle the application errors as well as there is a way to handle device related exceptions.

Here is a good intro to how to handle device specific exceptions on windows phone: -
Windows Phone 7 Development : Handling Device Exception

There is a related pots in SE - Windows Phone 7 - Handle Error in Application_UnhandledException with WebClient.

Nice video-tutorial from Channel 9 - Code Cleanup, Exception Handling, and Preparing for the Marketplace


问:
Nearest color algorithm using Hex Triplet
Wikipedia has a list of colors that I am using for a basis of color names.  I want to find the nearest named color given an arbitrary RGB value.

For example #5D8AA8 hex triplet is "Air Force Blue". This information will be stored in a database table (tbl_Color (HexTriplet,ColorName)) in my system

Suppose I created a color with #5D8AA7. I need to get the nearest color available in the tbl_Color table. The expected answer is "#5D8AA8  - Air Force Blue". This is because #5D8AA8 is the nearest color for #5D8AA7.

Do we have any algorithm for finding the nearest color?

References

Algorithm for parsing hex into color family

Algorithm for finding the color between two others - in the colorspace of painted colors

答:
A simple algorithm that gives reasonably good results: Add the squared difference of each color component (red, green, blue) between the color you are looking for and the color in your list of colors and choose the color where the sum of those squared differences is minimal.

For a more accurate result, see the wikipedia article on color difference and implement one of the algorithms described there.


答:
Go for HTML5 based development, not only will it work on mobiles but will be cross platform on desktops too.

to get cross-platform mobile web dev, you want Apache Cordova, not just a way to write apps using web GUIs, but also gives you access to various mobile APIs, nicely wrapped up in javascript library. For LoB apps, HTML is the perfect solution as you don't need tons of power to run them. For accessing your back-end services (being very careful about WCF services as their SOAP protocols tend to be poorly interoperable) then use jQuery direct or grab restify''s client libraries (or hey, forget obsolete old .NET and run Node.js servers instead, then you get to do everything in that unified language, except for CPU-crunching parts that you'll want to write in C++)

Of course, if you want to write something with lots of GUI performance, you'll want to go native with C++, either with the NDK or with an objective-c wrapper.

Title: Cross platform or web development with .NET

Body:
With iOS and Android soaring on mobile devices that become ever more pervasive, every other year being the 'year of Linux on the desktop' - which is somewhat snarky, but they are getting there -, OSX still holding its own, the time when one could simply say "it runs on Windows, and if you're not using Windows, well, sucks to be you".

I'm a .NET developer, with the applications i'm developing being fairly service-oriented, so that I can easily expose the backend logic to different frontends cross platform. I'm really bad at user interfaces, but in the end, applications do need to end up with an end user. And to present the application to the end user, it needs a GUI. It was looking like XAML/WPF was the land of bounty, where they weren't quite there yet, but were aiming to make a cross platform presentation layer. Lately, it has been mighty quiet on the WPF front though. Silverlight is all but dead. I sort of half hope that the 'right thing' will be happening here, with some black magic, pixiedust and flying unicorns that poop rainbows transforming my code + XAML into HTML5/CSS3 applications, winforms, metro, or whatever other form I choose to build for. This might be a bit optimistic.

So what presentation forms should I be looking in to? I would like to continue to use .NET as a primary ecosystem. Should I just be going asp.net + html5, and do the front end by hand in html5/js/css? Is there any framework that looks like it will hold the promise to be able to do something in a somewhat unified language?


问:
Saving Passwords To The Local Device
So In my app (iOS), you have to register in order to use the service (a food service).  But in order to change details about your account (username, password, and email), you have to reenter your password.  Except for if the user logged out, this is the only time you need your password to use the app.  So I was wondering, since the user basically never uses their password, and its likely they would forget it the one time they might need it, is it ok if I store their password to their local device (in NSUserDefaults)?

Since their password would only be on their local device, it doesn't seem like a security risk.  If the app was hacked, the only password they could get would be their own.

Further, I was planning on just storing it as a string (no encryption).  Would it make a difference if I hashed it or encrypted it before saving the password to their defaults?

Thanks in Advance.

答:
Use KeyChain to store passwords. I learned how to do that using this link and the KeyChainItemWrapper class can be found here

I don't think you need to encrypt that if you use a KeyChain. Also, NSUserDefaults are not suggested for storing passwords.

Title: Saving Passwords To The Local Device


答:
It depends on who you ask for a definition of OOP, because OOP is a notoriously ill-defined term and there is no good consensus over what constitutes OOP and what doesn’t.

From a Java person’s perspective, the answer is probably “no” since thee algorithms and containers library of C++ doesn’t deal in run-time polymorphism, doesn’t use class inheritance and because the syntax doesn’t look OOP-y.

On the other hand, ask a funcional programming person and the answer may be “yes”.

Here’s how Wikipedia defines OOP:

Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP, at least as an option.

All of those are realised, or aided, in C++’ standard library, and in particular in the part dealing with containers and algorithms. In particular, the algorithms strengthen encapsulation and abstraction (and thus modularity) and are polymorphous through the use of templates.

Title: Is STL implemented with OO?


答:
I learned that virtual member function which justifys the OO

Where on earth did you hear that?

The crucial tenets of object orientation is encapsulation and abstraction. virtual functions are just one means by which that is achieved. They're not necessary at all for actual object orientation. Indeed, a template is a perfectly suitable means. It may not be inheritance, but it is still a kind of polymorphism. And some classes require neither.

The Standard library's containers are absolutely object-orientated. They encapsulate all unnecessary details from the interface and abstract the implementation to the maximum that is reasonably possible.

Title: Is STL implemented with OO?


答:
Actually, the STL introduced the Generic Programming paradigm to the mainstream.

When I was taught about the Object-oriented Programming paradigm (by some professor) 15 years ago, I was taught the three crucial pillars are encapsulation, inheritance, and polymorphism (today the latter should probably be qualified as runtime polymorphism), while Wikipedia currently lists data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance as defining OOP characteristics. Of course, the STL uses some of them, like encapsulation, but then it also uses functions, which are a characteristic of the Structured Programming paradigm. Yet nobody would argue that the STL is Structured Programming.

Note that one of C++' strongest features is the fact that it supports many programming paradigms (Structured, Object-oriented, Generic, Functional Programming, and others) and that it shines brightest where you mix and mingle them.

Title: Is STL implemented with OO?


问:
Why does the C library use macros and functions with same name?
I am reading 'The Standard C Library' by PJ Plauger which is really interesting. The book  explains not only how to USE the library but also how it is implemented.

I have finished reading the ctype.h section and in the header the functions are declared as both macros AND functions. For example

```<code>int isdigit(int);
</code>```

but also

```<code>#define isdigit(c) (_Ctype[(int)(c)] & _DI)
</code>```

I don't understand why BOTH are used?

Also, if I try to recreate my own custom ctype header and implementation, I can only compile successfully if I remove the macro (comment out the define).

This aspect was not really explained in the book. Can someone please explain?

答:
The macro is (putatively) more efficient, as it doesn't involve a function call.  It can be optimised more easily, as it just involves a pointer offset lookup.

The function call allows linking against the same library even if the program was compiled without the macro definition - if it was compiled with a different header, or just with a rogue declaration inside the source file. Should, for example, you have a compiler which has someone's "improved" version of ctype.h that didn't have the macro, the function would still exist at runtime for use.

If we look at the standard:

c99

7.1.4 Use of library functions

Any function
  declared in a header may be additionally implemented as a function-like macro deﬁned in the header, so if a library function is declared explicitly when its header is included, one
  of the techniques shown below can be used to ensure the declaration is not affected by
  such a macro. Any macro deﬁnition of a function can be suppressed locally by enclosing
  the name of the function in parentheses, because the name is then not followed by the left
  parenthesis that indicates expansion of a macro function name. For the same syntactic
  reason, it is permitted to take the address of a library function even if it is also deﬁned as a macro.

That means that if you write:

```<code>int b = (isdigit)(c);
</code>```

or

```<code>int (*f)(int) = &isdigit;
int b = f(c);
</code>```

then you are invoking the actual function, not the macro.  You can also legally write:

```<code>#undef isdigit
int b = isdigit(c);
</code>```

or (in a source file not having #include <ctype.h> directly or transitively):

```<code>extern int isdigit(int);
int b = isdigit(c);
</code>```

Body:
The macro is (putatively) more efficient, as it doesn't involve a function call.  It can be optimised more easily, as it just involves a pointer offset lookup.

The function call allows linking against the same library even if the program was compiled without the macro definition - if it was compiled with a different header, or just with a rogue declaration inside the source file. Should, for example, you have a compiler which has someone's "improved" version of ctype.h that didn't have the macro, the function would still exist at runtime for use.

If we look at the standard:

c99

7.1.4 Use of library functions

Any function
  declared in a header may be additionally implemented as a function-like macro deﬁned in the header, so if a library function is declared explicitly when its header is included, one
  of the techniques shown below can be used to ensure the declaration is not affected by
  such a macro. Any macro deﬁnition of a function can be suppressed locally by enclosing
  the name of the function in parentheses, because the name is then not followed by the left
  parenthesis that indicates expansion of a macro function name. For the same syntactic
  reason, it is permitted to take the address of a library function even if it is also deﬁned as a macro.

That means that if you write:

int b = (isdigit)(c);

or

int (*f)(int) = &isdigit;
int b = f(c);

then you are invoking the actual function, not the macro.  You can also legally write:

#undef isdigit
int b = isdigit(c);

or (in a source file not having #include <ctype.h> directly or transitively):

extern int isdigit(int);
int b = isdigit(c);


问:
Public-private key pair handling on a Windows ecosystem
I've been thinking about how to architect an infrastructure for one of our business applications with the following requirement:

Data written by some user can only be read by that user and his superior and a 3rd person yet to be defined

I'm thinking in using some sort of asymmetric algorithm, such as RSA for data encryption.

We can generate a public-private key pair for each user and store the public key of each one openly on a database, but how should we handle the private key ?

If we just let the users manage their private key one day we will have a big headache if one of them loses his key.

If the private key becomes public somehow then the data would become public too, rendering the architecture invalid.

Our infrastructure is heavily Microsoft-oriented: All applications are ASP.Net MVC3, our dabatase is SQL Server 2005 and we use Active Directory for user authentication and basic data, such as e-mail/phone number.

How would you guys architect a solution to solve this problem ?

Bottom-line: This is not a banking or financial application, it's some kind of 360-degree personal feedback system.

EDIT:
Adding more requirements, hoping to make it more clear:

This database will be in production environment, where developers don't have access;

When the database is restored, developers should not be able to recover the data;

The DBA should not be able to view the data by SELECT'ing the rows on the tables;

EDIT 2: Bounty info.
Bounty went to the answer with more upvotes, although my personal feel is that none of the answers provided addressed the question correctly. For this reason, I'm granting the bounty but not marking the answer as correct.

答: I would load the keys into an obfuscated dll and use active directory information to authenticate the user's key.  if done properly, the user will never know their key and it couldn't be decompiled to discover the keys.</p>


答:
Change lists are an awesome concept. Only a set of coherent changes (which solves one thing) should be part of a single change list which is checked in together.

To add to my answer: Ideally you should be able to build a change lists of your files, pass it over to a clean enlistment (which is totally synced with the repo) apply the change list and build it before checking in. If your team mates aren't bothered to do it make it as part of the code review process.

Title: not checking in from the project root


答:
I think it really depends on what kind of software you are writing.

Is it something you can leverage by using the mobile device native API's (like multitouch, rotation, compass, etc...) or it doesn't matter ?

Do your application need to be online to work or it should work offline ?

Today you have some great HTML/CSS/JS tools to work with and, as the browser became the ubiquotous user interface, and with the progression of Atwood's Law, you can create nice interfaces with relatively easy.

Take a look on jQuery, jQuery UI, KnockOut JS and many others like flot you can use to create both online or offline applications with.

For some mobile devices, like iPhone or Android phones you can create simple applications where you can load a remote or local URL using the native browser.

If your application will only work online, stick with the technology you know, but learn some god dammit javascript, since it's the assembly language for the web.

PS: On a side note, Scott Hanselman has a great list of cool javascript libraries.


答:
To answer the question: There is more to it than that.

One important aspect of an interface is the intent.

An interface is "an abstract type that contains no data, but exposes behaviors" - Interface (computing) So if this is a behavior, or a set of behaviors, that the class supports, than an interface is likely the correct pattern.  If, however, the behavior(s) is(are) intrinsic to the concept embodied by the class, then you likely do not want an interface at all.

The first question to ask is what is the nature of the thing or process that you are trying to represent.  Then follow on with the practical reasons for implementing that nature in a given way.


答:
The only thing needed beyond naive subclassing is a way to seal classes, i.e. a way to make it impossible to add subclasses to a hierarchy.

How would you approach this problem in a language like C# or Java?

There isn't a good way to do this, but if you're willing to live with a hideous hack then you can add some explicit type checking to the abstract base class' constructor. In Java, this would be something like

```<code>protected ConsList() {
    Class<?> clazz = getClass();
    if (clazz != Empty.class && clazz != ConsCell.class) throw new Exception();
}
</code>```

In C# it's more complicated because of the reified generics - the simplest approach might be to convert the type to a string and mangle that.

Note that in Java even this mechanism can theoretically be bypassed by someone who really wants to via the serialisation model or sun.misc.Unsafe.

Body:
The only thing needed beyond naive subclassing is a way to seal classes, i.e. a way to make it impossible to add subclasses to a hierarchy.

How would you approach this problem in a language like C# or Java?

There isn't a good way to do this, but if you're willing to live with a hideous hack then you can add some explicit type checking to the abstract base class' constructor. In Java, this would be something like

protected ConsList() {
    Class<?> clazz = getClass();
    if (clazz != Empty.class && clazz != ConsCell.class) throw new Exception();
}

In C# it's more complicated because of the reified generics - the simplest approach might be to convert the type to a string and mangle that.

Note that in Java even this mechanism can theoretically be bypassed by someone who really wants to via the serialisation model or sun.misc.Unsafe.


答:
You can achieve this by using the visitor pattern, which will supplement pattern matching. For example

```<code>data List a = Nil | Cons { value :: a, sublist :: List a }
</code>```

can be written in Java as

interface List<T> {
    public <R> R accept(Visitor<T,R> visitor);

    public static interface Visitor<T,R> {
        public R visitNil();
        public R visitCons(T value, List<T> sublist);
    }
}

final class Nil<T> implements List<T> {
    public Nil() { }

    public <R> R accept(Visitor<T,R> visitor) {
        return visitor.visitNil();
    }
}
final class Cons<T> implements List<T> {
    public final T value;
    public final List<T> sublist;

    public Cons(T value, List<T> sublist) {
        this.value = value;
        this.sublist = sublist;
    }

    public <R> R accept(Visitor<T,R> visitor) {
        return visitor.visitCons(value, sublist);
    }
}
```

Sealing is achieved by the Visitor class. Each of its methods declares how to deconstruct one of the subclasses. You could add more subclasses, but it would have to implement accept and by calling one of the visit... methods, so it would either have to behave like Cons or like Nil.

Body:
You can achieve this by using the visitor pattern, which will supplement pattern matching. For example

data List a = Nil | Cons { value :: a, sublist :: List a }

can be written in Java as

interface List<T> {
    public <R> R accept(Visitor<T,R> visitor);

    public static interface Visitor<T,R> {
        public R visitNil();
        public R visitCons(T value, List<T> sublist);
    }
}

final class Nil<T> implements List<T> {
    public Nil() { }

    public <R> R accept(Visitor<T,R> visitor) {
        return visitor.visitNil();
    }
}
final class Cons<T> implements List<T> {
    public final T value;
    public final List<T> sublist;

    public Cons(T value, List<T> sublist) {
        this.value = value;
        this.sublist = sublist;
    }

    public <R> R accept(Visitor<T,R> visitor) {
        return visitor.visitCons(value, sublist);
    }
}

Sealing is achieved by the Visitor class. Each of its methods declares how to deconstruct one of the subclasses. You could add more subclasses, but it would have to implement accept and by calling one of the visit... methods, so it would either have to behave like Cons or like Nil.


答:
Interfaces are really important but try to control the number of them that you have.

Having gone down the road of creating interfaces for just about everything it is easy to end up with 'chopped-up spaghetti' code.  I defer to the greater wisdom of Ayende Rahien who has posted some very wise words on the subject:

http://ayende.com/blog/153889/limit-your-abstractions-analyzing-a-ddd-application

This is his first post of a whole series so keep reading!


问:
Exceptions or Error codes
We are building a web service(SOAP, .Net) which would be talking to (mostly) native clients (windows, C++) and we are wondering what is the best way to communicate errors to the client (e.g. SomethingBadHappened like login service not available or something like user not found) and haven't been able to decide between throwing exception to the client or using some kind of error code model to do the above.

What you would prefer on the handling on the client side: receiving a error code or handling a ServerFault exception which contains the reason for the error?

1) Why are we thinking exception: Because it would make server side code a lot more uniform

2) Why are we thinking error codes: Because we think it makes more sense from the client side perspective.

If 2) is really true we would probably want to go for error codes than exceptions? Is that the case here?

Also, would the answer change if we were talking to managed clients instead of native clients?

答:
If it's a web service, you can't exactly cause the server to throw an exception that will be caught by the client.  At the interface, your server basically has to return some sort of error code, even if that's a string that says An exception occurred. Type %s, message %s, stack trace %s.

As for the client side, you could have your response reading code check the response to see if it contains an error and raise an exception on the client side.  That's a very good way to do it, in languages with good exception handling at least.  C++, though, does not have good exception handing, and it's a good idea to stay as far away from C++ exceptions as possible.  If you can't use a better language, then just stick to error codes.

Title: Exceptions or Error codes


问:
What is the logic for setting the version numbers in an app?
I would like to know what's the logic for setting the versions in an application that you're developing?

I mean from 1.0 to 1.1 or 1.7 to 2.0

答:
A new version is introduced when the feature set and/or previous functionality of an application is changed.

Numbers after dot are for smaller changes. For example, you've modified the registration form only, and the rest of the app remains the same.

Numbers before dot indicate more significant changes, like big functionality changes, or adding a new set of features, etc.

Besides numbers, the version might also have identifiers like Beta or Alpha, which indicate whether the current version is complete, or is still being worked on and might have some flaws.

Take a look at wiki article for more info.


答:
In general, they could mean whatever you want them to mean. Unfortunately, they are often used simply as marketing tools (Version 2 is out, so all of our clients should buy it!). A better use for them is in implementing semantic versioning. That is, giving those versions specific meanings that are useful to your development and QA teams. Technically, you can make those meanings whatever you'd like, but there are some best practices.

OSGi has a nice whitepaper on semantic versioning. While some of the concepts mentioned there are mainly applicable to OSGi, the rest are pretty general.

For example, changing a major version number (1.0 -> 2.0) usually means that the two pieces of software are not backwards compatible.

Title: What is the logic for setting the version numbers in an app?

Body:
I would like to know what's the logic for setting the versions in an application that you're developing?

I mean from 1.0 to 1.1 or 1.7 to 2.0


答:
Version numbers are defined as major.minor.revision which can have any arbitrary meaning, but generally when referring to applications:

Revision = Bug fix

Minor = Feature fixes and small adjustments

Major = New features and other large changes

When referring to an API, a major upgrade is usually an interface change that will break users of the API.  A minor upgrade is typically a change to the functionality behind API calls but the interface remains the same.


问:
How should I arrange my javascript files?
I think this is best described using an image.

So it dawned on me that perhaps this isn't the best or most logical way to  organise files.

The way it is currently, as you can see is just a dumping ground. The only reason complexify has it's own folder is that it's a submodule in Git.

So should I be using a /lib folder with jquery & jqueryui and perhaps a /plugins with all the plugins in? Where would my files live?

Are there any accepted practises for file structure in this situation where you have a core library, a number of plugins and then some of your own code?

PS, I realised just now I have two copies of jQueryUI.

答:
yes, put 3rd party not-your-code files in directories so you can keep them separate from your files. A common naming convention is 'lib' or 'libs' with each 3rd party library in its own sub-directory (so you can directly update the files from their own source repo with a little more control).

You can put your files anywhere you like then, usually in the root.


问:
Replacing Multiple Inhertance with delegation
I was going through "Object Oriented Modelling and Design" by James Rumbaugh et al and it said that in languages where multiple inheritance is not supported like Java three mechanisms can be used as workarounds

Delegation using aggregation of roles

Inherit the most important

class and delegate the rest Nested Generalization

I couldnt understand the examples given in the text. Could any one please explain this with an example. I know that "diamond problem" is  a problem within multiple inheritance and java supports multiple inheritance of interfaces.

答:
My observation is that a lot of folk misuse multiple inheritance without working through composition type questions.

The "classic" OO example of a car leads to this problem.  For example, we'll say that a car breaks down to the following parts:

it's a vehicle

there are tires

there is an engine

there is a chassis

there are seats

and so on...

so we'll define a class that looks like this:

```<code> public class Car : Vehicle, Tires, Engine, Chassis, Seats {}
</code>```

All well and good, but it presents some significant problems with encapsulation and constructors / destructors.  And it doesn't accurately represent what a car looks like in the real world.

If we start asking composition questions then we'll see some nuances here that weren't at first obvious.

is a car a vehicle? (yes)

is a car a tire or set of tires? (no, it has a set of tires)

is a car an engine? (no)

is a car a seat? (no)

etc ...

So now our class can look something like this:

```
public class Car : Vehicle
{
   public Tires tires;  //ie, myCar _has_ a set of tires.
   protected Engine engine;
   private Chassis chassis;
   protected Seats seats;
}
```

Which is also all well and good.  But now we start scratching our heads and say "you know, I really wish that when I instantiate a car that it has to have tires, an engine, and a chassis."

So now we can turn Tires, Engine, and Chassis into interfaces and we'll have the following class.  I'm prefixing the interfaces with "I" to make the distinction more clear.

```
public class Car : Vehicle, ITires, IEngine, IChassis
{
   protected Seats seats;
}
```

Interfaces are like contracts.  When a class implements an interface, it's guaranteeing it will provide certain methods and behaviors.

And now things really are all well and good.  Our model of the car accurately reflects the real world representation of the same Object, including some guarantees about the resemblance between the two courtesy of the Interfaces.  We have avoided the icky issues that multiple inheritance can create.

That's not to say that multiple inheritance is always bad.  However, it's not really needed most of the time which is why languages like Java and C# don't allow for multiple inheritance.

Body:
My observation is that a lot of folk misuse multiple inheritance without working through composition type questions.

The "classic" OO example of a car leads to this problem.  For example, we'll say that a car breaks down to the following parts:

it's a vehicle

there are tires

there is an engine

there is a chassis

there are seats

and so on...

so we'll define a class that looks like this:

 public class Car : Vehicle, Tires, Engine, Chassis, Seats {}

All well and good, but it presents some significant problems with encapsulation and constructors / destructors.  And it doesn't accurately represent what a car looks like in the real world.

If we start asking composition questions then we'll see some nuances here that weren't at first obvious.

is a car a vehicle? (yes)

is a car a tire or set of tires? (no, it has a set of tires)

is a car an engine? (no)

is a car a seat? (no)

etc ...

So now our class can look something like this:

public class Car : Vehicle
{
   public Tires tires;  //ie, myCar _has_ a set of tires.
   protected Engine engine;
   private Chassis chassis;
   protected Seats seats;
}

Which is also all well and good.  But now we start scratching our heads and say "you know, I really wish that when I instantiate a car that it has to have tires, an engine, and a chassis."

So now we can turn Tires, Engine, and Chassis into interfaces and we'll have the following class.  I'm prefixing the interfaces with "I" to make the distinction more clear.

public class Car : Vehicle, ITires, IEngine, IChassis
{
   protected Seats seats;
}

Interfaces are like contracts.  When a class implements an interface, it's guaranteeing it will provide certain methods and behaviors.

And now things really are all well and good.  Our model of the car accurately reflects the real world representation of the same Object, including some guarantees about the resemblance between the two courtesy of the Interfaces.  We have avoided the icky issues that multiple inheritance can create.

That's not to say that multiple inheritance is always bad.  However, it's not really needed most of the time which is why languages like Java and C# don't allow for multiple inheritance.


问:
Associativity in C
```<code> int i = 2*5/2;
 int j = 2*(5/2);
 printf("%d\n,%d\n",i,j);
</code>```

Variable Associativity: when I run this program, the first statement gives me i = 4; Shouldn't it give me 2, because according to BODMAS rule / is evaluated before *, so the variable should have been evaluated as (5/2)=2 and then 2*2=4?

I know this is a noob question, but this never fails to surprise me.

答:
The BODMAS rule is misleading. D(ivision) has equal rank with M(ultiplication). So because they have equal associativity they evalute from left to right.

Therefore 2*5/2 == 10/2 == 5.

A(ddition) and S(ubtraction) also have equal rank so the rule should more look like (B)(O)(DM)(AS). But that is less mnemonic.

Title: Associativity in C


答:
In C, multiplication and division have equivalent precedence.  Operator Precedence

i in your example should return 5 since the operations will be

2 * 5 = 10

10 / 2 = 5

Consider it a very important lesson to use parenthesis whenever order of evaluation is critical.

Relying upon the implicit truncation of the integer value may (but probably won't) have compiler specific behavior depending upon whether the C99 standard has been implemented.  Kevin Cline posted an SO link that goes into further detail.

Some folk (like me) avoid relying on functionality that can change with the compiler.  Others are more familiar with the compilers they are using and safely rely upon that type of functionality.  YMMV.

Title: Associativity in C

Body:
```<code> int i = 2*5/2;
 int j = 2*(5/2);
 printf("%d\n,%d\n",i,j);
</code>```

Variable Associativity: when I run this program, the first statement gives me i = 4; Shouldn't it give me 2, because according to BODMAS rule / is evaluated before *, so the variable should have been evaluated as (5/2)=2 and then 2*2=4?

I know this is a noob question, but this never fails to surprise me.


问:
Is the time spent customizing your dev machine environment worth it?
There are times when I am working on programming project and I get the itch to change some stuff in my environment (OSX or Linux). Vim might not being doing exactly
what I want, so instead of doing it the round about way I've been doing for a
couple months (sometimes years) I go and figure out the right way. Or I may be
doing something long handed in bash and I say to myself why don't I figure out
a better way.

The thing is when I go off and do this hours can fly by. Sometimes I
get stuck on trying to get what I want. I'll know I'm really close, so I don't give
up. I usually always get it eventually, but its after hours of tinkering and
googling. I hate the feeling of giving up and having to deal with something I
know could work better.

When I'm done I have a warm feeling knowing that my environment is a little more smooth
and personalized, but I wonder could my time be better spent. Where do I draw
the line? It seems with the all the UNIX-style tools there is an endless amount
to learn.

Always thought the sign of a superior programmer is someone who goes out of
their way to make the computer bend to their will. Am I doing it right? I figure
the bash shell, unix/linux, and vim will be around forever, so I see it as an investment.

But then again I just spend 3 hours trying to get some stupid thing the vimperator firefox
plugin to work right.

So I wondering what this community think about this.

答:
It's pretty inefficient to have each developer setting up his or her own environment. But the environment you work in does matter. Here are some ways to get the most out of it:

Do it when you've just joined a project, so any time you put in setting things up right will help you for your entire time on the project.

Fix something, not just for yourself, but the whole team. But before getting too eager about fixing things, make sure it's something your teammates will appreciate.


问:
SVN command line client: checkout refused when LDAP password changed “svn: OPTIONS of” (repo) “authorization failed” (but works in TortoiseSVN)
When using the command line/terminal svn client, a colleague is getting "svn: OPTIONS of " [repo] "...authorization failed" error message when they attempt to checkout the repo to be their local working copy.

They used to be able to do this but have recently had to change their password (periodic routine security policy). And it stopped working. NOTE: The svn check command does ask for a password everytime (which they supply - i.e. their new one.)

BUT strangely they have no problem with Tortoise SVN, it works on that. They supply their usual login and new password and it works.

Our setup is a virtualised CentOS Linux machine with several Linux user accounts where development takes place and the SVN central repo is on a separate server, authentication is using our LDAP login (i.e. the same corporate login used to login to our Windows machines). We login as Linux users to our development server from our Windows machines, using standard terminal SSH tools, e.g. PuTTY or MobaXTerm or CygWin.

When I change my password I don't get the same problem, I am able to checkout.

I have seen many questions about this error message from searching various forums on google but none have provided me with a solution as yet.

One of the solutions I found suggests to clear or remove a local cache containing authentication, in a .subversion folder, we tried this but still the same problem. Also tried checking out to another folder.

So it seems we have clean out any trace of cached passwords but yet it still rejects.

Could there be another place on our CentOS Linux machine that caches the login
What is meant by OPTIONS (could it be a setting somewhere on our development machine or on the SVN repo server?)
Could it be a HTTP Proxy cache of my colleague's credentials stored somewhere - so we need to clear that when a password is changed?

(Mistakenly posted on superuser.com (which is about users), so closed it there and moved it here)

答:
The root cause is most likely a character set issue. To explain, our SVN setup uses LDAP authentication meaning that the login/password we use for SVN is the same as what we use for our corporate Windows PC network account login, which popular convenient arrangement only needing one account for both. However, we usually set/update our password via the usual Windows password change (CTRL-ALT-DEL) and we believe that the ISO character set in Windows is different from that used for the SVN CLI in Linux.

Our password wouldn't work because it contained a pound symbol which can be interpreted differently under a different character set or key mapping in Windows LDAP password changing compared to Linux LPAP SVN authentication due to mismatch in character set used. (Credit to WanDisco folk for assisting us with the investigation, in fairness we simultaneously arrived at the same conclusion while on a call, don't work for them but use their services, I should give credit where it's due.)


答: Always put () around any expressions, even if they "should work".  Make more maintainable and stable code.  Same with {}.</p>

Title: Associativity in C


问:
What makes a component or product "enterprise" software vs non-enterprise ready?

Possible Duplicate:

What is enterprise software, exactly?

What does “enterprise” means in relation to software architecture?

What makes a component or product "enterprise" software vs non-enterprise ready? Is it difficult to use? Is it support contacts? Is it reputation? Is it a level of testing? Is it integration support? Is it marketing? Is it the focus on the customer of the product?

What makes a piece of software "enterprise" software, rather than something that is for general consumption?

For example, Derby DB is for developers, and small apps, but it's not an "enterprise database".

答:
I think the following article on wikipedia describes it well:
http://en.wikipedia.org/wiki/Enterprise_software

The meaning of "enterprise software" is quite fuzzy, but I can summarize that enterprise software is a collection of integrated tools targeted to solve common business tasks & to optimize the whole process rather than a tool or a set of tools for specific use, like "derby DB".


答:
It's a buzzword. Plenty of non-enterprise software is used in plenty of places; often more successfully.

That said, there are three key components that can apply:

Scalability. If your database can't (easily) grow with the business to handle the size of data, and concurrent connections then you're not enterprise.

Reliability. If you can't supply the 99.9999% that really critical business systems require, then you're not enterprise.

Flexibility. This doesn't apply to databases so much but more to SAP or Peoplesoft sort of apps. If a business needs to change in order to adapt to a piece of software's way of doing things (rather than vice versa), the software isn't going to sell in an enterprise environment.

Body:
Possible Duplicate:

What is enterprise software, exactly?

What does “enterprise” means in relation to software architecture?

What makes a component or product "enterprise" software vs non-enterprise ready? Is it difficult to use? Is it support contacts? Is it reputation? Is it a level of testing? Is it integration support? Is it marketing? Is it the focus on the customer of the product?

What makes a piece of software "enterprise" software, rather than something that is for general consumption?

For example, Derby DB is for developers, and small apps, but it's not an "enterprise database".


答: In database terms it is because it has features that smaller organizations don't need (or want to pay for) that support scaliblity, performance, advanced analytics, etc.</p>

Title: What makes a component or product "enterprise" software vs non-enterprise ready?


问:
How can I prevent users from merging origin/X into Y in git?
Is it possible to force git to only merge remote tracking branches into the corresponding local branch? E.g. assume origin/X tracks X on origin and corresponds to local X and the same for origin/Y and Y. I want to prevent users to do git checkout Y; git merge origin/X. Is it possible? How?

Edit:

To make it clear: The workflow is not the problem. People try to merge the wrong branches because they forgot to checkout the correct branch before merging. It is not about "offenders" or pushing to the central repo. It's just people forgetting at which branch they are. The last "incident" was literally:

"I should commit and push real quick before I leave.

git add .

git commit -am 'Feature Y'

git push origin

Whoops, whats that. It tells me to merge branch origin/X first. OK whatevs.

git merge origin/X

Whoops, whats that now. Lots of merge conflicts. What have I done. I better call somebody..."

The user was working in branch Y and did not understand what the git push origin was saying. It told it that origin/X needed merging and that's what he did, because he wanted to "push real quick". In the case above branch X was one commit ahead of the local X, so pushing all branches yielded the "needs merging" error.

I adjusted the "workflow" now to always push a branch explicitly, e.g. git push origin Y instead of just git push origin, but that's not curing the problem. It should (usually) not be allowed without a warning to merge origin/X with Y. For merging feature branches X and Y can be merged.

答:
As git is distributed, there is no way to prohibit users to do it locally, and I'm not even sure if it's possible with local hooks.

And because a user doesn't have to push all local refs, there is no way to prevent it on the server either.

Edit:

You are talking about mistakes. Git allows users to fix their mistakes and undo the error, but that requires them to notice it. Like I said in the comments you could try to use hooks for this, but there is no pre-merge hook or something.


答:
Strange but, no-one mentioned security as important feature to be Enterprise Ready.

There are some very important concerns when deploying any system in an enterprise. The top priority should be Security, followed by Scalability, Reliability and Efficiency.

More detailed information and definitions can be found in Wiki, and from SE - when software is enterprise ready?

To be short: "Enterprise ready" means: If it crashes or leaks the information then enterprises/customers using it will possibly sue you.


问:
Does multiple inheritance violate Single Responsibility Principle?
If you have a class which inherits from two distinct classes, does not this mean that your subclass automatically does (at least) 2 things, one from each superclass?

I believe there is no difference if you have multiple interface inheritance.

To be clear, I believe that if subclassing multiple classes violates SRP, then implementing multiple (non-marker or basic interface (e.g. Comparable)) interfaces violates SRP too.

答:
Not in my opinion.  To me, a single responsibility is "model a user of my application".  I may need to deliver that data via a web service, and store it in a relational database.  I could provide that functionality by inheriting a couple of mix-in classes.

That doesn't mean the class has three responsibilities.  It means that part of the responsibility to model a user requires supporting serialization and persistence.


答:
Somewhat. Let's focus on the main principle for SRP:

A class should only have one reason to change.

Multiple inheritance doesn't force this, but tends to lead to it. If the class overrides or implements its base classes, that tends to be more reasons for it to change. In this way, interface multiple inheritance tends to be more troublesome than class inheritance. If two classes are inherited but not overridden, then the reasons to change exist in the base classes not the new class.

The places where multiple inheritance does not violate SRP is when all but one of the base types aren't something that the class is implementing, but act as a trait that the class happens to have. Consider IDisposable in C#. Things that are disposable don't have two responsibilities, the interface just acts as a view into classes that share the trait but have decidedly different responsibilities.

Title: Does multiple inheritance violate Single Responsibility Principle?

Body:
If you have a class which inherits from two distinct classes, does not this mean that your subclass automatically does (at least) 2 things, one from each superclass?

I believe there is no difference if you have multiple interface inheritance.

To be clear, I believe that if subclassing multiple classes violates SRP, then implementing multiple (non-marker or basic interface (e.g. Comparable)) interfaces violates SRP too.


问:
Have you ever found yourself using a specific tool in favor of another just because it looks better?
I found that this was the case with Eclipse.
When I first started learning Java a lot of people told me to start with NetBeans because it's easier, comes with a lot of predefined functionality and most of the configuration is done by default. Indeed it seemed like an easy IDE but I just hated the way it looked. The UI to me was horrible.

Then I downloaded Eclipse. I was pretty impressed with it. Everything looked shiny, fonts looked awesome and the UI in general was amazing compared to NetBeans'. So I stayed with Eclipse.

Has something like this ever happen to you? Should the UI be of such a relevance to a programmer, is this bad ? The problem of the UI extends to everything for me, not only IDE's (e.g. even on linux I have to customize the WM the way I want before starting working with it).

答:
A couple years ago I 'refreshed' a product's GUI - moving it from a bland Win95-ish look to something more modern.  The app still worked essentially the same as it did - same menus, same toolbar layout - it just had a slicker color scheme and more modern looking icons and controls.  A number of users commented on how the app was easier to use with the new GUI.

Thats just the nature of GUI's.

A cleaner GUI makes the available functionality more readily understood to the end user, and thus easier to figure out.  It also looks more modern and up to date, providing the end user with extra confidence in the quality of the app.


问:
Developing software for a company outside a company
I work for an IT company as a developer. We are currently working on a large software project, a multi-vendor automatic database clustering solution. We've upheld good coding standards and as a result our code is highly modular and reusable. Many of the modules we've developed could be of great benefit to the open-source community.

There are quite a few developers on our team that contribute to various open-source projects but so far we have not been successful with persuading the employer to consider open-sourcing some of the modules.

A few of us decided that we'd like to contribute code to open-source community while at the same time develop code for the company. Since our employer is not sympathetic towards this cause, contributing code we write during work hours is probably not an option. We have decided to take an alternate approach, write code during our spare time that we can use for both the company and open-source community.

We would like to know what are the caveats of this approach, pottential legal issues and whether someone has a similar experience so we could elaborate our plan further before putting it on the table at work.

答:
Your contract probably says something like "we own you body and soul hah hah" (in slightly more legal language)

How enforceable this is depends on where you live and how many lawyers your employer has.  But generally the courts have ruled on the: "job uses computer, hobby uses computer, therefore job and hobby are some thing, therefore employee steal from company" logic.


答:
In a very narrow sense, the answer is "Yes": assuming that your base classes or interfaces are designed for a single purpose, inheriting both of them does create a class with multiple responsibilities. However, whether or not it is "a bad thing" depends on the nature of the classes or interfaces that you are inheriting.

You can partition your classes and interfaces into two major groups - the ones addressing the essential complexity of your system, and the ones addressing its accidental complexity. If you inherit from more than one "essential complexity" classes, it is bad; if you inherit from one "essential" and one or more "accidental" classes, it is OK.

For example, in a billing system you could have classes for representing invoices and billing cycles (they address the essential complexity) and classes for persisting objects (they address the accidental complexity). If you inherit like this

```<code>class BillingCycleInvoice : public BillingCycle, public Invoice {
};
</code>```

it is bad: your BillingCycleInvoice has a mixed responsibility as it relates to the essential complexity of the system.

On the other hand, if you inherit like this

```<code>class PersistentInvoice : public Invoice, public PersistentObject {
};
</code>```

your class is OK: technically, it services two concerns at once, but since only one of them is essential, you can write off inheriting the accidental one as the "cost of doing business".

Body:
In a very narrow sense, the answer is "Yes": assuming that your base classes or interfaces are designed for a single purpose, inheriting both of them does create a class with multiple responsibilities. However, whether or not it is "a bad thing" depends on the nature of the classes or interfaces that you are inheriting.

You can partition your classes and interfaces into two major groups - the ones addressing the essential complexity of your system, and the ones addressing its accidental complexity. If you inherit from more than one "essential complexity" classes, it is bad; if you inherit from one "essential" and one or more "accidental" classes, it is OK.

For example, in a billing system you could have classes for representing invoices and billing cycles (they address the essential complexity) and classes for persisting objects (they address the accidental complexity). If you inherit like this

class BillingCycleInvoice : public BillingCycle, public Invoice {
};

it is bad: your BillingCycleInvoice has a mixed responsibility as it relates to the essential complexity of the system.

On the other hand, if you inherit like this

class PersistentInvoice : public Invoice, public PersistentObject {
};

your class is OK: technically, it services two concerns at once, but since only one of them is essential, you can write off inheriting the accidental one as the "cost of doing business".


答: If you have any sort of non-compete agreement with your employer, inform your employer of your intentions before creating anything and get your outside project excluded from the agreement (in writing, please). IANAL, but this seems especially important if you'll be doing this project with some of your co-workers. (Your co-workers should make the same arrangement with your employer.)

Title: Developing software for a company outside a company

Body:
I work for an IT company as a developer. We are currently working on a large software project, a multi-vendor automatic database clustering solution. We've upheld good coding standards and as a result our code is highly modular and reusable. Many of the modules we've developed could be of great benefit to the open-source community.

There are quite a few developers on our team that contribute to various open-source projects but so far we have not been successful with persuading the employer to consider open-sourcing some of the modules.

A few of us decided that we'd like to contribute code to open-source community while at the same time develop code for the company. Since our employer is not sympathetic towards this cause, contributing code we write during work hours is probably not an option. We have decided to take an alternate approach, write code during our spare time that we can use for both the company and open-source community.

We would like to know what are the caveats of this approach, pottential legal issues and whether someone has a similar experience so we could elaborate our plan further before putting it on the table at work.


问:
Should I change language to stop becoming stale?
I'm an ASP.Net/C# programmer using SQL Server as a back end.

I am the Technical Director of the company, I'm extremely happy in everything I do and consider the languages and system we use to be perfect for what we do.

In the back of my mind though I know that over time programmers can become stale. I remember as a wee youngster that all those "old" developers were past it and couldn't keep up with the youngsters.

So considering I'm happy in everything I'm doing. What options are there for keeping up with everything and avoiding becoming stale.

One particular idea that I use is to let all the new developers use and showcase the things that they think are cool. If anything catches my eye then absolutely it will be something we all use going forward.

Thoughts?

答:
Learning a new language and/or framework will open new ideas and horizon to do your work more enjoyable. Not getting stale and learning some new bits every day keep software developer happy.

I do belief that - a real, passionate developer always look at learning new cutting edge technology and introducing/sharing that with colleagues.

My suggestion is too look at recent trends in ASP.NET web development and advancement in client side scripting. Relatively new trend with MVC and Web API frameworks are getting more and more popular with a community support behind.

For example: jQuery and KnockoutJs libraries can easily be applied on existing asp.net projects, by improving presentation in no time :)

However, there is a learning curve that we all go though.