问:
IoC containers and service locator pattern
I am trying to get an understanding of Inversion of Control and the dos and donts of this. Of all the articles I read, there is one by Mark Seemann (which is widely linked to in SO) which strongly asks folks not to use the service locator pattern.

Then somewhere along the way, I came across this article by Ken where he helps us build our own IoC.

I noticed that is is nothing but an implementation of service locator pattern.

Questions:

Is my observation correct that this implementation is the service locator pattern?

If the answer to 1. is yes, then Do all IoC containers (like Autofac) use the service locator pattern?

If the answer to 1. is no, then why is this differen?

Is there any other pattern (other than DI) for inversion of control?

Consolidation of answers:

Answer 1. Kelly: The service locator pattern is indeed used for the initial Resolve call. The service locator pattern has to be used at least once.

Answer 2. Eric: Simply calling Ioc.Resolve(ISomeInterface) doesn't mean that the IoC container is being used as a Service Locator. After all, Resolve() has to be called somewhere, right?

Answer 3. Tungano:  No, his code contains a constructor receiving a dependency... No, a container doesn't 'use' any pattern. It's really up to the programmer using the container to use a pattern. It's all in how you wire it together. Basically you can both use a container for DI and Service locator.

Answer 4. Gnat: ...factory and lookup... [can be used for inversion of control.]

I have learnt, thanks to the above answers that IoC itself uses Service Locator Pattern. This is not inherently harmful. Using the IoC can be done in a number of ways (including the Service Locator Pattern). This is the part we need to take care and use other options of injecting the dependency.

答:
1) No, his code contains a constructor receiving a dependency:

```<code>public BuildDirectoryStructureService(IFileSystemAdapter fileSystemAdapter)
</code>```

The IoC container is injecting the dependency.

If it used the service locator the BuildDirectoryStructureService would self obtain the dependency. For example:

```<code>public BuildDirectoryStructureService()
{
   this.fileSystemAdapter = Locator.Current.Resolve<IFileSystemAdapter>();
}
</code>```

An IoC container can be used as a service locator.

2 & 3)

No, a container doesn't 'use' any pattern. It's really up to the programmer using the container to use a pattern. It's all in how you wire it together.

Basically you can both use a container for DI and Service locator.

4) You can do constructor injection and still not really have inversion of control. You can ask for concrete types in a constructor. Dependencies you inject may not have a workable abstraction for multiple implementations and such.

Inversion of control is aligned with the Hollywood principle, don't call us, we'll call you. Instead of operating a service you let the service "call back" on you over an interface it defines.

Body:
1) No, his code contains a constructor receiving a dependency:

public BuildDirectoryStructureService(IFileSystemAdapter fileSystemAdapter)

The IoC container is injecting the dependency.

If it used the service locator the BuildDirectoryStructureService would self obtain the dependency. For example:

public BuildDirectoryStructureService()
{
   this.fileSystemAdapter = Locator.Current.Resolve<IFileSystemAdapter>();
}

An IoC container can be used as a service locator.

2 & 3)

No, a container doesn't 'use' any pattern. It's really up to the programmer using the container to use a pattern. It's all in how you wire it together.

Basically you can both use a container for DI and Service locator.

4) You can do constructor injection and still not really have inversion of control. You can ask for concrete types in a constructor. Dependencies you inject may not have a workable abstraction for multiple implementations and such.

Inversion of control is aligned with the Hollywood principle, don't call us, we'll call you. Instead of operating a service you let the service "call back" on you over an interface it defines.


问:
Examples of Finite State Machines
I'm looking for good examples of finite state machines; language isn't particularly important, just good examples.

Code implementations are useful (generalized pseudo-code), but it's also very useful to gather the various uses of FSM's.

Examples don't necessarily need to be computer based, for example Mike Dunlavey's Railroad networks example, is very useful.

答:
I have found that thinking about/modelling a lift (elevator) is a good example of a finite state machine.  It requires little in the way of introduction, but provides a far from trivial situation to implement.

The states are, for example, at the ground floor, at the first floor etc, and moving ground to first floor, or moving third to ground floor but currently between floor 3 and 2, and so on.

The effect of buttons in the lift cage and at the floors themselves provide inputs, the effect of which depend on both the button that is pressed along with the current state.

Each floor, except the top and bottom, will have two buttons: one to request the lift to go up, the other to go down.

ContentLicense: CC BY-SA 3.0

Title: Examples of Finite State Machines


问:
Continous Delivery TFS
Is it possible to achieve Continuous Delivery using TFS e.g. Windows Service? There are > 1000 posts on how to use msdeploy with TFS for WEB projects.

I am trying to understand why there are no resources such as blogs, articles, msdn or best practises for Continuous Delivery for Windows service using TFS.

I am not sure tow to achieve the following without any working reference materials. This is so frustrating.

Archive existing codebase on Remote server for Service as well for Web project not on Integration Server please!

How To Stop services on Remote server not on Integration Server

Copy New code Base on Remote Server

Start Services

答: Msdeploy is the worst thing you'll ever to do to yourself. It is very very hard to get the IIS versions and configurations right for it to work as expected. I would definitely use something like 7-zip to zip the code and xcopy to copy it and of course powershell to remote to the box. You can then manage IIS using powershell commands. You could also try alternatives like albacore if you don't mind learning ruby (in my opinion, ruby is way better and object oriented than powershell is)</p>

Title: Continous Delivery TFS


问:
what will EcmaScript 6 bring to the table for us
Our company ported moderate chunks of business logic to JavaScript. We compile the code with a minifier, which further improves performance. Since the language is dynamically typed, it lends itself well to obfuscation, which occurs as a byproduct of minification. We went to great efforts to ensure it positively screams, performance-wise. We can now do what we did before, faster, better, with less code, on more platforms. In summary, we are very satisfied with the current state of the language.

I personally love the language especially for its cross-platform nature. So naturally, I read up a lot about the state of JavaScript compilers, performance and compatibility across as many browsers and platforms as I have time to research.

The one theme which has been growing louder and louder these days, is the news about ECMAScript 6. So far, what I have been able to gather is that ES6 promises a better development experience; firstly by enabling new ways to do things, secondly by reporting errors early. This sounds great for those who are still waiting for the language to meet their needs before jumping on board.

But we have already jumped on board in a big way. Sure, I expect that we will have to do ongoing maintenance and feature revisions on our code through the years, and that we would obviously make use of best practices at the time. But I don't see us refactoring major portions of it to take advantage of language features that are mostly intended to boost developer productivity.

I keep wondering, what impact will the language advances ultimately have on our existing, well-written, well-performing code base? Is there something I am missing? Is there something we ought to look out for? Does anyone have tips or guidance on how we should approach the ecmascript.next finalization? Should we care?

答:
what impact will the language advances ultimately have on our existing, well-written, well-performing code base?

Hardly any.

One of the reasons that the progress of ECMAScript specs is slow (compared to languages like python, ruby etc.) is they care very (and I mean very) much about the tons of existing code out there, which mustn't break. Lots of proposal which looked as progressive were rollbacked once it has been shown it can break the web. Other langauges do not have such burden, they can issue incompatible new version, user of app can do the right setup, but web is another story.

Maybe someone more competent can add more, I am only telling as a member of mailing list where ECMAScript 6 development is discussed between TC39 commitee members, as well as plain developers.


答:
Simply calling Ioc.Resolve(ISomeInterface) doesn't mean that the IoC container is being used as a Service Locator. After all, Resolve() has to be called somewhere, right?

The clue is where and how many times is IoC.Resolve() is being called? If it's being called all over the place, in the dependent objects themselves, then that's a sign that the IoC container is being misused as a Service Locator. If Resolve() is being called in one central location (typically called the 'composition root'), then it's most likely being used correctly.

The article you mentioned doesn't talk about when and where to call Resolve(), it just explains what happens after it's called.

Title: IoC containers and service locator pattern

Body:
I am trying to get an understanding of Inversion of Control and the dos and donts of this. Of all the articles I read, there is one by Mark Seemann (which is widely linked to in SO) which strongly asks folks not to use the service locator pattern.

Then somewhere along the way, I came across this article by Ken where he helps us build our own IoC.

I noticed that is is nothing but an implementation of service locator pattern.

Questions:

Is my observation correct that this implementation is the service locator pattern?

If the answer to 1. is yes, then Do all IoC containers (like Autofac) use the service locator pattern?

If the answer to 1. is no, then why is this differen?

Is there any other pattern (other than DI) for inversion of control?

Consolidation of answers:

Answer 1. Kelly: The service locator pattern is indeed used for the initial Resolve call. The service locator pattern has to be used at least once.

Answer 2. Eric: Simply calling Ioc.Resolve(ISomeInterface) doesn't mean that the IoC container is being used as a Service Locator. After all, Resolve() has to be called somewhere, right?

Answer 3. Tungano:  No, his code contains a constructor receiving a dependency... No, a container doesn't 'use' any pattern. It's really up to the programmer using the container to use a pattern. It's all in how you wire it together. Basically you can both use a container for DI and Service locator.

Answer 4. Gnat: ...factory and lookup... [can be used for inversion of control.]

I have learnt, thanks to the above answers that IoC itself uses Service Locator Pattern. This is not inherently harmful. Using the IoC can be done in a number of ways (including the Service Locator Pattern). This is the part we need to take care and use other options of injecting the dependency.


问:
What's a nice explanation for pointers?
In your own studies (on your own, or for a class) did you have an "ah ha" moment when you finally, really understood pointers? Do you have an explanation you use for beginner programmers that seems particularly effective?

For example, when beginners first encounter pointers in C, they might just add &s and *s until it compiles (as I myself once did). Maybe it was a picture, or a really well motivated example, that made pointers "click" for you or your student. What was it, and what did you try before that didn't seem to work? Were any topics prerequisites (e.g. structs, or arrays)?

In other words, what was necessary to understand the meaning of &s and *, when you could use them with confidence? Learning the syntax and terminology or the use cases isn't enough, at some point the idea needs to be internalized.

Update: I really like the answers so far; please keep them coming. There are a lot of great perspectives here, but I think many are good explanations/slogans for ourselves after we've internalized the concept. I'm looking for the detailed contexts and circumstances when it dawned on you.

For example:

I only somewhat understood pointers
  syntactically in C. I heard two of my
  friends explaining pointers to another
  friend, who asked why a struct was
  passed with a pointer. The first
  friend talked about how it needed to
  be referenced and modified, but it was
  just a short comment from the other
  friend where it hit me: "It's also
  more efficient." Passing 4 bytes
  instead of 16 bytes was the final
  conceptual shift I needed.

答: A pointer is a sticky note that tells you where something useful is. It contains the location of the thing and tells you how big the thing is (in C, anyway). So a double pointer is like a sticky note that says "There's a six pack in the fridge". You have to actually go get the six pack to figure out if it's Coke or Budweiser.</p>

ContentLicense: CC BY-SA 2.5

Title: What's a nice explanation for pointers?


问:
quick approach to migrate classic asp project to asp.net
Recently we got a requirement for converting a classic asp project to asp.net.

This one is really a very old project created around 2002/2003. It consists of around 50 asp pages. I found very little documentation for this project, FSD and design documents for only a few modules.

Just giving a quick look into this project my head start to hurt. It is really a mess. I checked the records and found none of the developers who worked on this project work for the company anymore.

My real pain is that this is an urgent requirement and I have to provide an estimated deadline to my supervisor.

I found a similar question classic-asp-to-asp-net, but I need some more insight on how to convert this classic asp project to asp.net in the quickest possible way.

答:
Well an estimate is not a promise. Just let your boss know that any estimate you make about codebase you don't know and a technology you don't know is going to be very inaccurate. Make him aware of the risk level.

What makes the conversion so urgent? Perhaps you can add something to the existing codebase to remove the urgency and buy yourself time for a proper port?

Some tips:

Map out what the system does before touching it. Create a test script that you can use to check all the features. You are bound to make mistakes, try to find them fast. Perhaps it will reveal parts you don't need to port.

Setup an IIS application that runs asp and asp.net side-by-side. Then attempt to port page for page while keeping the thing as a whole working (you may need to put the .NET bits in a separate virtual directory under the same path, I forgot).

First attempt a near line-by-line port for as much as possible before you start to redo or redesign parts of the code. ASP.NET WebForms aspx pages are the best fit for this. I would not port to MVC, which does not have a page based model.

Just stick with ASP's inline code style as you move the code over to the ASPX pages. Ignore ASPX's code behind or move some trivial unshared functions to it.

For pages you ported create a routing rule to redirect X.asp requests to X.aspx transparently.

If code is in VBscript then consider porting to VB.NET, you can keep a lot of the typeless stuff around (option strict off). If it's jscript, go for C#, dynamic and type inference is your friend there.

ASP pages typically use COM components as libraries. You can usually keep using those dependencies from .NET even if there are better ways in the BCL. If you can initially postpone migrating libraries do so.

Examine each page and the pattern within, is it mostly disjoint with other pages or is it using some include based scheme to setup code modules and such. Such included ASP pages might be directly convertable to class files. Typically classes with only static methods (modules in VB.NET).

Only after completing the line-by-line port start doing redesign. Probably best to make a plan once you get there, you'll know a lot more about the codebase. Now is the time to start modernizing.

I've worked with a system where a similar conversion was half done. Parts were .NET, parts were classic ASP. It could be a valid strategy, port the pages you have new requirements for and nothing more. Eventually the classic ASP all get converted or lesser useful ones fade away.

It ain't gonna be 'quick', trust me ;-)


问:
My father is a doctor. He is insisting on writing a database to store non-critical patient information, with no programming background
So, my father is currently in the process of "hacking" together a database using FileMaker Pro, a GUI based databasing tool for his small (4 doctor) practice. The database will be used to help ease the burden on reporting from medical machines, streamlining quite a clumsy process.

He's got no programming background, and seems to be doing everything in his power to not learn things correctly. He's got duplicate data types, no database-enforced relationships (foreign/primary key constraints) and a dozen other issues. He's doing it all by hand via GUI tool using Youtube videos.

My issue is, that whilst I want him to succeed 100%, I don't think it's appropriate for him to be handling these types of decisions. How do I convince him that without some sort of education in these topics, a hacked together solution is a bad idea? He's can be quite stubborn and I think he sees these types of jobs as "childs play"

How should I approach this? Is it even that bad an idea - or am I correct in thinking he should hire a proper DBA/developer to handle this so that it doesn't become a maintenance nightmare?

NB: I am a developer consultant of 4 years and I've seen my share of painful customer implementations.

Update:

So it's a few years later now, and I've had time to reflect on this question. My dad ended up implementing a solution using Google Docs, FileMaker Pro and some email hooks. He set the whole thing up himself, and he says he is getting immense value from it.

If you are an experienced developer, you are perhaps reading that description and cringing. But I learnt a pretty good lesson from the whole thing actually - that people only care about the results, and not the implementation. All my dad cares about is the fact he doesn't need to enter patient information down on paper manually, and can instead quickly fill out a Google docs form. What's great is he's looking to hire a junior dev/ops person to focus solely on automation within his practice.

答:
he sees these types of jobs as "childs play"

I am a developer consultant of 4 years

For your own well-being and your father's personal development let him fail. John's answer is rock-solid and you should mention enough to keep your father from getting on the wrong side of the law, or at least enough that he should know better. But this whole "humility" thing isn't something you can lecture to people and expect them to learn it. It's a very important life-lesson to try your hardest and utterly fail. Failure is a very powerful teacher. And he might gain some respect for his son's profession.

And hey, if he manages to cobble something that works well enough (and doesn't violate any laws), all the more power to him.


问:
What to do when a sprint is finished early?
What to do when a sprint is finished early?

At the moment our Scrum team works off stories from the backlog, if the sprint is finished early.

What happens with stories taken from the backlog? Will the stories be added to the current Sprint ? If yes, what if these stories won't be finished in time. Is the Sprint failed then?

答:
What my team does is pull tasks in from the backlog that are reasonably small enough to complete with respect to how early we finished.  If we're done with that, we give our QA team time to catch up with their testing, and the developers get a "free day" - we can use this to look into other issues not related to the current sprint, topics we want to research, configure/reconfigure our environments, etc.

Don't put a whole ton of work in just because you've finished early.  Stick to what your team has committed to do in this sprint, and if extra work gets finished, that's an awesome plus.


问:
MVC or Extract Service Layer
we have an application that is built with .Net MVC.  We are now tasked with exposing API's to third parties.  Members on our team want to just continue down our current path and just use more controllers so we can reuse the backend of our current application.  Logic tells me we need to create a seperate service layer when more clients are going to be accessing it, but .Net MVC seems to take care of all of this.  Is it really acceptable architecture to use controllers in a stand alone application to expose API's and what would be the potential gains of extracting the service layer out?</p>

答:
You could use regular controllers to create an API. I would consider not mixing it with your application though and put it in a separate project/process.

Your existing controller code may be a bit too intimate with the application for it to serve as a general purpose API.

How would they "reuse the backend of our current application" if everyting is in controllers? From the new API controllers call to existing controllers? RedirectToAction? I think this will very easily fall down and you unnecessarily include infrastructure (MVC) in your model of reuse.

I think creating a service layer is a form of 'reusing the backend'. A service layer would mean extracting some bits you want to reuse. Make the service layer agnostic of MVC.

The service layer can potentially be used in desktop apps, console apps. The next gen cool web framework etc. For unit tests it can be very handy to set up test cases free of having to mock out an application framework.

OwnerDisplayName: Lizzard

Title: MVC or Extract Service Layer


问:
Alternatives to sql like databases
These days computers usually have 2GB or 4GB memory.

I like to use some secure client server model, and well an sql database is likely candidate.

On the other hand I only have about 8000 records, who will not frequently be read or written in total they would consume less then 16 Megabyte.

And it made me wonder what would be good secure options in a windows environment to store the data work with it multi-client single server model, without using SQL or mysql?

Would for well such a small amount of data maybe other ideas better?

Because I like to keep maintenance as simple as possible (no administrators would need to know sql maintenance, as they dont know databases in my target environment).

Maybe storing in xml files or.. something else.

How others would go if ease of administration is the main goal?

Oh and it should be secure to, the client server data must be a bit secure (maybe NTLM files shares https or...etc)

Maybe I should say something of the use, it would be like client ask for a single record and retrieves an answer a single byte is returned those clients won't launch complex questions, only the maintenance server side might require record editing, clients will only ask not change records. And clients wont perform advanced queries.

答: If your data model is a simple one or if you do not want to use SQL, you can use Berkeley DB. It basically is an optimized map, which is to be embedded directly in your application; it has APIs for many programming languages, it supports very well multithreaded access and scales to large amounts of data (not distributed like NoSQL key-value databases). </p>

Title: Alternatives to sql like databases


问:
Computer vision algorithms (how is this possible?)
I recently stumbled across a company that has created what appears to be a computer vision technology that is capable of detecting shoplifting automatically and alert its users.

LINK

Watching some of the videos and examples provided by the company has left me completely baffled and amazed as to how on earth they may have achieved this functionality.

I understand that no-one here will be able to tell me exactly how this may have been achieved but is anyone aware - and could point me to - research in this field or alternatively perhaps provide details as to how something like this could be implemented or guidance of where one might start?

My understanding was the computer vision algorithms were many years away from being this  sophisticated. Is this sort of application really possible? Anyone willing to hazard a guess at how they achieved this?

答: Actually this company uses a hybrid of computer vision and manual review in India.  It is not pure computer vision especially for elements like sweethearting.  In fact I know one retailer who has quite a problem with this system not due to the system performance I store but the bandwidth shipping video to India.  This manual coding is how they reduce errors and is a typical tech inquest with some vendors now.</p>


问:
Sharing authentication methods across API and web app
I'm wanting to share an authentication implementation across a web application, and web API. The web application will be ASP.NET (mostly MVC 4), the API will be mostly ASP.NET WEB API, though I anticipate it will also have a few custom modules or handlers.

I want to:

Share as much authentication implementation between the app and API as possible.

Have the web application behave like forms authentication (attractive log-in page, logout option, redirect to / from login page when a request requires authentication / authorisation).

Have API callers use something closer to standard HTTP (401 - Unauthorized, not 302 - Redirect).

Provide client and server side logout mechanisms that don't require a change of password (so HTTP basic is out, since clients typically cache their credentials).

The way I'm thinking of implementing this is using plain old ASP.NET forms authentication for the web application, and pushing another module into the stack (much like MADAM - Mixed Authentication Disposition ASP.NET Module). This module will look for some HTTP header (implementation specific) which indicates "caller is API".

If the header "caller is API" is set, then the service will respond differently than standard ASP.NET forms authentication, it will:

401 instead of 302 on a request lacking authentication.

Look for username + pass in a custom "Login" HTTP header, and return a FormsAuthentication ticket in a custom "FormsAuth" header.

Look for FormsAuthentication ticket in a custom "FormsAuth" header.

My question(s) are:

Is there a framework for ASP.NET that already covers this scenario?

Are there any glaring holes in this proposed implementation? My primary fear is a security risk that I can't see, but I'm similarly concerned that there may be something about such an implementation that will make it overly restrictive or clumsy to work with.

答:
I don't quite understand what it is you actually want to share.

I'd assume you won't find a framework cause what you want to do is not that hard to solve.

1) A third party application is -only- going to touch your general purpose API. It uses API authentication only (through forms authentication, api key usage, take your picking).

2) Your own application through user actions will redirect to login page and such and have it's own picking of authentication (form authentication probably). This is about stuff the user can potentially enter through the address bar of the webbrowser. If your application happens to use your general purposed API under the hood you are not going to redirect the user to your login page on ajax calls. Your application should handle/prevent this for the user. A user is not going to make API calls through his/her browser's address bar.

So for your application to be able to use your general purpose API, the general purpose API would only need to support the same authentication scheme (form authentication). Or your application would have to fetch the user's api key or something to use after the user logged in.

You can easily create an Authorize attribute in MVC that will checks multiple options, first for an api-key, then for a forms authentication based cookie token. If it finds nothing your general purpose API should or needs to throw 401s only.

Your application would pick them up from ajax call failures and could decide to move the user over to the login page.


问:
Top down or bottom up approach?
I'm an interface designer and now I'm working with a team of programmers to develop a new CMS for a heavy media site.

As I've started developing a specification list for a prototype it turned out a very big one. I do realize now that the client-side will be JS heavy, with lots of DnD and other "cool designer stuff". The CMS will even include a small project management system for its users, nothing big like Basecamp, but with a live feed of comments etc.

The problem is the the team has now separated. Someone is proposing the existing backend solution used in other CMS, someone is proposing to rewrite everything from scratch. The point to keep the code is that it is faster, the point to rewrite is to make it better for the proposed design (include Node.js and other stuff I don't actually get).

The question is — can the UI specs influence back-end? The guys that propose to use the existing solution did everything with the Yii framework (as far as I know), and they say that everything on server is not affected by this "interface coolness". Others say that it does, that even autosave can't work without server load.

答:
Top to bottom for sure.

The UI, or UX is a lot closer to the user and what the user expects of the application. How the user works with the application should determine what is required from the backend.

In a way you could see a UX design as a backend challenge, it's up to the backend folks to communicate if they can or can not deliver.

With their imposed constraints the UX design may have to do concessions and adapt. But always try go for the best possible solution and lower the bar only when needed. Do not speculate about what the backend may find too hard or not. Let them tell you.

If they have significant existing code already on the shelve, just talk your designs through with them and see what they can support. Always go back to your customer/stakeholders though for decisions, even if some compromise on usability can save a bit of work it may not be what they want. They might insist on the more expensive path if they see value in it.

Title: Top down or bottom up approach?


问:
Queuing RPC calls
I'm designing a system which listens to JSON RPC calls from clients, piles them up inside a list, and if the list gets full it will store them in a DB and keep receiving calls.

My original plan is to listen to the RPC calls from Perl with the JSON-RPC and put them in an array. The clients do some long polling in another server to get responses as they appear.

What is this blocking/non-blocking thing?

Should I do a script for node.js to listen to the calls?

What do you think is a good practice in this case?

The goal is to listen as much calls as possible.

答:
Blocking or non-blocking is about whether or not you want to wait for a call to complete. Non-blocking calls typically do work on another thread so the thread invoking it can resume doing other stuff. Blocking calls are more common. One reason to make a blocking call is wanting to make sure the call succeeded without error before continuing on the next thing.

I can't tell you to use node.js or not. I don't think the technology matters, you could do this with most programming environments.

What you describe basically is buffering. I would do it non-blocking unless something is really expensive (maybe parsing the rpc call is). This way you guarantee you won't miss any call.

If you do it non-blocking, because there is significant work, I would use a thread pool for it, typically they end up blocking if the pool can't keep up.

You will need to synchronize with some locking to allow multiple threads to store stuff in your buffer (that's why I'd rather do it blocking on a single thread) and you will lose ordering of your calls which may or may not be important.

Using a double buffer you can flush your buffer to the DB while also still receive new calls. You may need to lock shortly while flipping buffers after a flush.

Title: Queuing RPC calls


问:
Reuse Business Logic between Web and API
We have a website and two mobile apps that connect through an API. All the platforms do the exactly same things. Right now the structure is the following:

Website. It manages models, controllers, views for the website. It also executes all background tasks. So if a user create a place, everything is executed in this code.

API. It manages models, controllers and return a JSON. If a user creates a place on the mobile app, the place is created here. After, we add a background task to update other fields. This background task is executed by the Website.

We are redoing everything, so it's time to improve the approach. Which is the best way to reuse the business logic so I only need to code the insert/edit/delete of the place & other actions related in just one place?

Is a service oriented approach a good idea? For example:

Service. It has the models and gets, adds, updates and deletes info from the DB.

Website. It send the info to the service, and it renders HTML.

API. It sends info to the service, and it returns JSON.

Some problems I have found:

More initial work? Not sure..

It can work slower. Any experience?

The benefits:

We only have the business logic in one place, both for web and api.

It's easier to scale. We can put each piece on different servers.

Other solutions

Duplicate the code and be careful not to forget anything (do tests!)

DUplicate some code but execute background tasks that updates the related fields and executes other things (emails, indexing...)

A "small" detail is we are 1.3 person in backend, for now ;)

答:
Barely a question in here but some thoughts:

You ask: "More initial work?" compared to what? This background task stuff sounds link more trouble to setup.

The background task solution is coming down to the same thing, invoke common/shared code. Only you do it indirectly. How is that be a better or more maintainable solution?

Working mostly with background tasks also complicates scenarios where you need to know the outcome of a task. The waiting and marshaling of return values is going to be a burden and add complexity.

Then you ask: "It can work slower. Any experience?" setting up background tasks to be handled by another process is never going to be faster then invoking the task directly and immediately (preferably in the same process).

The scaling benefit you propose does introduce having to cross process boundaries, or worse network boundaries, constantly. I would prefer creating an in process service layer if possible. And create a middle tier if really needed.

Code duplication is never a solution as far as I am concerned, it's asking for a maintenance disaster.


答:
You mentioned 2 different use cases, each have a different answer

First, I want to note that the server-side framework is irrelevant if the data is exposed through a REST API because data will most likely be fetched through AJAX requests anyway.

Top-Down if designing new interfaces:

APIs are usually defined based on real-world use cases. They should only expose a limited number of routes for accessing data, and those routed should be defined by how they will be used. In the case of adding new functionality, it would probably be easiest to mock up the general layout to get a better idea how it will be used.

Bottom-Up for existing interfaces:

I don't think I need to go into extensive detail about how dumb it would be to design all of the existing functionality if you already have a working implementation. There are plenty of articles online and real-world examples that prove that the time/energy investment if a full re-write usually isn't worth it (ex PERL 6).

Even if the back-end devs decide to use a different framework, it's much easier to adapt existing implementations to a new platform/framework/language than it is to draft new ones from scratch. Don't forget to consider the significant time investment that went into battle testing the existing implementations.

The key to adapting the existing code is to identify and rip out the unnecessary parts. Once that's done, how can the UI be designed to incorporate the existing functionality.

Title: Top down or bottom up approach?

Body:
I'm an interface designer and now I'm working with a team of programmers to develop a new CMS for a heavy media site.

As I've started developing a specification list for a prototype it turned out a very big one. I do realize now that the client-side will be JS heavy, with lots of DnD and other "cool designer stuff". The CMS will even include a small project management system for its users, nothing big like Basecamp, but with a live feed of comments etc.

The problem is the the team has now separated. Someone is proposing the existing backend solution used in other CMS, someone is proposing to rewrite everything from scratch. The point to keep the code is that it is faster, the point to rewrite is to make it better for the proposed design (include Node.js and other stuff I don't actually get).

The question is — can the UI specs influence back-end? The guys that propose to use the existing solution did everything with the Yii framework (as far as I know), and they say that everything on server is not affected by this "interface coolness". Others say that it does, that even autosave can't work without server load.


答:
The CSV parser used in the jquery-csv plug-in

It's a basic Chomsky Type III grammar parser.

A regex tokenizer is used to evaluate the data on a char-by-char basis. When a control char is encountered, the code is passed to a switch statement for further evaluation based on the starting state. Non-control characters are grouped and copied en masse to reduce the number of string copy operations needed.

The tokenizer:

```<code>var tokenizer = /("|,|\n|\r|[^",\r\n]+)/;
</code>```

The first set of matches are the control characters: value delimiter (") value separator (,) and entry separator (all variations of newline). The last match handles the non-control char grouping.

There are 10 rules that the parser must satisfy:

Rule #1 - One entry per line, each line ends with a newline

Rule #2 - Trailing newline at the end of the file omitted

Rule #3 - First row contains header data

Rule #4 - Spaces are considered data and entries should not contain a trailing comma

Rule #5 - Lines may or may not be delimited by double-quotes

Rule #6 - Fields containing line breaks, double-quotes, and commas should be enclosed in double-quotes

Rule #7 - If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote

Amendment #1 - An unquoted field may or may

Amendment #2 - A quoted field may or may not

Amendment #3 - The last field in an entry may or may not contain a null value

Note: The top 7 rules are derived directly from IETF RFC 4180. The last 3 were added to cover edge cases introduced by modern spreadsheet apps (ex Excel, Google Spreadsheet) that don't delimit (ie quote) all values by default. I tried contributing back the changes to the RFC but have yet to hear a response to my inquiry.

Enough with the wind-up, here's the diagram:

States:

initial state for an entry and/or a value

an opening quote has been encountered

a second quote has been encountered

an un-quoted value has been encountered

Transitions:

a. checks for both quoted values (1), unquoted values (3), null values (0), null entries (0), and new entries (0)

b. checks for a second quote char (2)

c. checks for an escaped quote (1), end of value (0), and end of entry (0)

d. checks end of value (0), and end of entry (0)

Note: It's actually missing a state. There should be a line from 'c' -> 'b' marked with state '1' because an escaped second delimiter means the first delimiter is still open. In fact, it would probably be better to represent it as another transition. Creating these is an art, there's no single correct way.

Note: It's also missing an exit state but on valid data the parser always ends on transition 'a' and none of the states are possible because there is nothing left to parse.

The Difference between States and Transitions:

A state is finite, meaning it can only be inferred to mean one thing.

A transition represents the flow between states so it can mean many things.

Basically, the state->transition relationship is 1->* (ie one-to-many). The state defines 'what it is' and the transition defines 'how it's handled'.

Note: Don't worry if the application of states/transitions doesn't feel intuitive, it's not intuitive. It took some extensive corresponding with somebody much smarter than I before I finally got the concept to stick.

The Pseudo-Code:

```<code>csv = // csv input string

// init all state & data
state = 0
value = ""
entry = []
output = []

endOfValue() {
  entry.push(value)
  value = ""
}

endOfEntry() {
  endOfValue()
  output.push(entry)
  entry = []
}

tokenizer = /("|,|\n|\r|[^",\r\n]+)/gm

// using the match extension of string.replace. string.exec can also be used in a similar manner
csv.replace(tokenizer, function (match) {
  switch(state) {
    case 0:
      if(opening delimiter)
        state = 1
        break
      if(new-line)
        endOfEntry()
        state = 0
        break
      if(un-delimited data)
        value += match
        state = 3
        break
    case 1:
      if(second delimiter encountered)
        state = 2
        break
      if(non-control char data)
        value += match
        state = 1
        break
    case 2:
      if(escaped delimiter)
        state = 1
        break
      if(separator)
        endOfValue()
        state = 0
        break
      if(newline)
        endOfEntry()
        state = 0
        break
    case 3:
      if(separator)
        endOfValue()
        state = 0
        break
      if(newline)
        endOfEntry()
        state = 0
        break
  }
}
</code>```

Note: This is the gist, in practice there's a lot more to consider. For example, error checking, null values, a trailing blank line (ie which is valid), etc.

In this case, the state is the condition of things when the regex match block finishes an iteration. The transition is represented as the case statements.

As humans, we have a tendency to simplify low level operations into higher level abstracts but working with a FSM is working with low level operations. While states and transitions are very easy to work with individually, it is inherently difficult to visualize the whole all at once. I found it easiest to follow the individual paths of execution over and over until I could intuit how the transitions play out. It's king of like learning basic math, you won't be capable of evaluating the code from a higher level until the low level details start to become automatic.

Aside: If you look at the actual implementation, there are a lot of details missing. First, all impossible paths will throw specific exceptions. It should be impossible to hit them but if anything breaks they will absolutely trigger exceptions in test runner. Second, the parser rules for what is allowed in a 'legal' CSV data string are pretty loose so the code needed to handle a lot of specific edge cases. Regardless of that fact, this was the process used to mock the FSM prior to all of the bug fixes, extensions, and fine tuning.

As with most designs, it's not an exact representation of the implementation but it outlines the important parts. In practice, there are actually 3 different parser functions derived from this design: a csv-specific line splitter, a single-line parser, and a complete multi-line parser. They all operate in a similar manner, they differ in the way they handle newline chars.

Title: Examples of Finite State Machines

Body:
I'm looking for good examples of finite state machines; language isn't particularly important, just good examples.

Code implementations are useful (generalized pseudo-code), but it's also very useful to gather the various uses of FSM's.

Examples don't necessarily need to be computer based, for example Mike Dunlavey's Railroad networks example, is very useful.

Body:
The CSV parser used in the jquery-csv plug-in

It's a basic Chomsky Type III grammar parser.

A regex tokenizer is used to evaluate the data on a char-by-char basis. When a control char is encountered, the code is passed to a switch statement for further evaluation based on the starting state. Non-control characters are grouped and copied en masse to reduce the number of string copy operations needed.

The tokenizer:

var tokenizer = /("|,|\n|\r|[^",\r\n]+)/;

The first set of matches are the control characters: value delimiter (") value separator (,) and entry separator (all variations of newline). The last match handles the non-control char grouping.

There are 10 rules that the parser must satisfy:

Rule #1 - One entry per line, each line ends with a newline

Rule #2 - Trailing newline at the end of the file omitted

Rule #3 - First row contains header data

Rule #4 - Spaces are considered data and entries should not contain a trailing comma

Rule #5 - Lines may or may not be delimited by double-quotes

Rule #6 - Fields containing line breaks, double-quotes, and commas should be enclosed in double-quotes

Rule #7 - If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote

Amendment #1 - An unquoted field may or may

Amendment #2 - A quoted field may or may not

Amendment #3 - The last field in an entry may or may not contain a null value

Note: The top 7 rules are derived directly from IETF RFC 4180. The last 3 were added to cover edge cases introduced by modern spreadsheet apps (ex Excel, Google Spreadsheet) that don't delimit (ie quote) all values by default. I tried contributing back the changes to the RFC but have yet to hear a response to my inquiry.

Enough with the wind-up, here's the diagram:

States:

initial state for an entry and/or a value

an opening quote has been encountered

a second quote has been encountered

an un-quoted value has been encountered

Transitions:

a. checks for both quoted values (1), unquoted values (3), null values (0), null entries (0), and new entries (0)

b. checks for a second quote char (2)

c. checks for an escaped quote (1), end of value (0), and end of entry (0)

d. checks end of value (0), and end of entry (0)

Note: It's actually missing a state. There should be a line from 'c' -> 'b' marked with state '1' because an escaped second delimiter means the first delimiter is still open. In fact, it would probably be better to represent it as another transition. Creating these is an art, there's no single correct way.

Note: It's also missing an exit state but on valid data the parser always ends on transition 'a' and none of the states are possible because there is nothing left to parse.

The Difference between States and Transitions:

A state is finite, meaning it can only be inferred to mean one thing.

A transition represents the flow between states so it can mean many things.

Basically, the state->transition relationship is 1->* (ie one-to-many). The state defines 'what it is' and the transition defines 'how it's handled'.

Note: Don't worry if the application of states/transitions doesn't feel intuitive, it's not intuitive. It took some extensive corresponding with somebody much smarter than I before I finally got the concept to stick.

The Pseudo-Code:

csv = // csv input string

// init all state & data
state = 0
value = ""
entry = []
output = []

endOfValue() {
  entry.push(value)
  value = ""
}

endOfEntry() {
  endOfValue()
  output.push(entry)
  entry = []
}

tokenizer = /("|,|\n|\r|[^",\r\n]+)/gm

// using the match extension of string.replace. string.exec can also be used in a similar manner
csv.replace(tokenizer, function (match) {
  switch(state) {
    case 0:
      if(opening delimiter)
        state = 1
        break
      if(new-line)
        endOfEntry()
        state = 0
        break
      if(un-delimited data)
        value += match
        state = 3
        break
    case 1:
      if(second delimiter encountered)
        state = 2
        break
      if(non-control char data)
        value += match
        state = 1
        break
    case 2:
      if(escaped delimiter)
        state = 1
        break
      if(separator)
        endOfValue()
        state = 0
        break
      if(newline)
        endOfEntry()
        state = 0
        break
    case 3:
      if(separator)
        endOfValue()
        state = 0
        break
      if(newline)
        endOfEntry()
        state = 0
        break
  }
}

Note: This is the gist, in practice there's a lot more to consider. For example, error checking, null values, a trailing blank line (ie which is valid), etc.

In this case, the state is the condition of things when the regex match block finishes an iteration. The transition is represented as the case statements.

As humans, we have a tendency to simplify low level operations into higher level abstracts but working with a FSM is working with low level operations. While states and transitions are very easy to work with individually, it is inherently difficult to visualize the whole all at once. I found it easiest to follow the individual paths of execution over and over until I could intuit how the transitions play out. It's king of like learning basic math, you won't be capable of evaluating the code from a higher level until the low level details start to become automatic.

Aside: If you look at the actual implementation, there are a lot of details missing. First, all impossible paths will throw specific exceptions. It should be impossible to hit them but if anything breaks they will absolutely trigger exceptions in test runner. Second, the parser rules for what is allowed in a 'legal' CSV data string are pretty loose so the code needed to handle a lot of specific edge cases. Regardless of that fact, this was the process used to mock the FSM prior to all of the bug fixes, extensions, and fine tuning.

As with most designs, it's not an exact representation of the implementation but it outlines the important parts. In practice, there are actually 3 different parser functions derived from this design: a csv-specific line splitter, a single-line parser, and a complete multi-line parser. They all operate in a similar manner, they differ in the way they handle newline chars.


答:
I've encountered this before (many times) and what I've ended up doing preferring is:

Take the BL out of the website.
Make the website a consumer of the API.
Treat the website as just some other client of your API.  Your API IS the service.

If you find yourself thinking that you need special API methods just for the website, think again!  If its good for the goose, it is good for the gander.  If you really really really need special functionality for the website I would suggest that what you've really found is a difference in "user profile" and therefore this is a situation where the API should still support the "special" functions, but then you control them via authorisation.

Not convinced?

Take the paradigm a step further ...

The phone app is running on a platform where bytecode is executed, the app lives in the phone and consumes API services via HTTP/JSON

The website is an app running on a platform where HTML+Javascript is the executed, the app lives in a the browser and consumes API services via HTTP/JSON

Same same!

Extend that to tablets, TVs, other phone platforms, plugins, third party apps, mashups, ...

Lots of different user experiences all plugged into a common API.

Your app IS the API.  The website is just one client (of many)

Title: Reuse Business Logic between Web and API

Body:
We have a website and two mobile apps that connect through an API. All the platforms do the exactly same things. Right now the structure is the following:

Website. It manages models, controllers, views for the website. It also executes all background tasks. So if a user create a place, everything is executed in this code.

API. It manages models, controllers and return a JSON. If a user creates a place on the mobile app, the place is created here. After, we add a background task to update other fields. This background task is executed by the Website.

We are redoing everything, so it's time to improve the approach. Which is the best way to reuse the business logic so I only need to code the insert/edit/delete of the place & other actions related in just one place?

Is a service oriented approach a good idea? For example:

Service. It has the models and gets, adds, updates and deletes info from the DB.

Website. It send the info to the service, and it renders HTML.

API. It sends info to the service, and it returns JSON.

Some problems I have found:

More initial work? Not sure..

It can work slower. Any experience?

The benefits:

We only have the business logic in one place, both for web and api.

It's easier to scale. We can put each piece on different servers.

Other solutions

Duplicate the code and be careful not to forget anything (do tests!)

DUplicate some code but execute background tasks that updates the related fields and executes other things (emails, indexing...)

A "small" detail is we are 1.3 person in backend, for now ;)


问:
Internal and external API architecture
The company I work for maintains a successful SaaS product that grew "organically" over the years. We are planning to expand the line with a suite of new products that will share data with the existing product. To support this, we are looking to consolidate business logic into a single place: a web service layer. The WS layer will be used by:

The web applications

A tool to import data

A tool to integrate with other client software (not an API per se)

We also want to create an API that can be used by our customers that are capable of using it to create their own integrations. We are struggling with the following question:

Should the internal API (aka the WS layer) and the external API be one in the same, with security and permission settings to control what can be done by who, or should they be two separate applications where the external API just calls the internal API like any other application? So far in our debate it seems that separating them may be more secure, but will add overhead.

What have others done in a similar situation?

答:
I've encountered this before (many times) and what I've ended up doing preferring is:

Take the BL out of the website. Make the website a consumer of the API. Treat the website as just some other client of your API. Your API IS the service.

If you find yourself thinking that you need special API methods just for the website, think again! If its good for the goose, it is good for the gander. If you really really really need special functionality for the website I would suggest that what you've really found is a difference in "user profile" and therefore this is a situation where the API should still support the "special" functions, but then you control them via authorisation.

Not convinced?

Take the paradigm a step further ...

The phone app is running on a platform where bytecode is executed, the app lives in the phone and consumes API services via HTTP/JSON

The website is an app running on a platform where HTML+Javascript is the executed, the app lives in a the browser and consumes API services via HTTP/JSON

Same same!

Extend that to tablets, TVs, other phone platforms, plugins, third party apps, mashups, ...

Lots of different user experiences all plugged into a common API.

Your app IS the API. The website is just one client (of many)

Title: Internal and external API architecture


问:
How do you take into account usability and user requirements for your application?
Our team supports BackOffice application: a mix of WinForm and WPF windows. (about 80 including dialogs). Really a kind of a Swiss Army Knife. It is used by developers, tech writers, security developers, testers.

The requirements for new features come quite often and sometimes we play Wizard of Oz to decide which GUI our users like the most. And it usually happens (I admit it can be just my subjective interpretation of the reality) that one tiny detail giving the flavor of good usability to our app requires a lot of time. This time is being spent on 'fighting' with GUI framework making it act like we need. And it very difficult to make estimations for this type of tasks (at least for me and most members of our team). Scrum poker is not a help either.

Management often considers this usability perfectionism to be a waste of time. On the other hand an accumulated affect of features where each has some little usability flaw frustrates users. But the same users want frequent releases and instant bug fixes. Hence, no way to get the positive feedback: there is always somebody who is snuffy.

I constantly feel myself as competing with ourselves: more features -> more bugs/tasks/architecture. We are trying to outrun the cart we are pushing. New technologies arrive and some of them can potentially help to improve the design or decrease task implementation time but these technologies require learning, prototyping and so on.

Well, that was a story. And now is the question:

How do you balance between time pressure, product quality, users and management satisfaction?

When and how do you decide to leave the problem with not a perfect
but to some extent acceptable solution, how often do you make these
decisions?

How do you do with your own satisfaction? What are your priorities?

P.S.
Please keep in mind, we are a BackOffice team, we have neither dedicated technical writer nor GUI designer. The tester have joined us recently.
We've much work to do and much freedom concerning 'how'. I like it because it fosters creativity but I don't want to become too nerdy perfectionist.

答:
Step 1) You need to get the users of the product clamoring to management that they need more of your development time and so that they can have the UI tweaked just the way they want it.

Tweaking the UI to perfection is a notoriously time consuming activity, and your issues in this regard are pretty typical.  But it's not your battle to justify the required time to management, it's the Users' job to do so.  In essence, they need to plead to management and persuade them that investing X time in Y feature benefits the company.  Not your argument to make, it's theirs.

Hint:  This is how you balance some of the pressures you mention in the first question.

Step 2) Start consolidating / migrating on fewer UI technologies.  The no-brainer choice is to migrate towards WPF.  It's easier to get the whiz-bang functionality from WPF as opposed to Winforms, and WPF will receive more updates than Winforms ever will.  No, you didn't necessarily ask about this part but you need to consolidate in order to get better at creating your estimates.

Even a line in the sand of "all future development shall be WPF" is a step in the right direction.

Hint: This is how you gain credibility with your estimates which will help you with balancing multiple, conflicting pressures.

Step 3) Learn to negotiate for "good enough."  We all want perfection but it's a very expensive state to achieve.  Learning to get by with good enough is the key to your second question.  How often do you do that?  On pretty much every single requirement....

Truth be told, perfection is gold plating.  It's awesome.  It's really pretty and nice to look at.  But most of the time?  You and the users don't need it.

Once you accept the reality that there is more work to accomplish than can be done, you start to recognize the gold-plating, er perfection, for the time sink that it is with a corresponding low benefit-to-effort payoff.

Step 4) Recognize that you're not paid to create perfection.  No, you're really not.  You're paid to meet the needs of your users.  Understand that there is a tipping point.  Nailing one requirement really, really, really, really well is honestly not as good as nailing four requirements really well.  The medical field uses the term "triage" for situations like this.  You take care of the urgent priorities first; stabilize them; and quickly move to the next most urgent priority.  No, you never get a patient back to perfect health in that situation.

There is a phrase (or a Kōan) that says "Better is the enemy of Good."  And the initial interpretation to work with is that it's always possible to make a solution "better."  The key is in identifying what is "good enough."


答:
Use one API

If you're implementing the service API as a REST layer, just add authentication to the routes that are protected.

You'll probably want to use a development framework that doesn't bake in too much 'magic'. Something where you can define routes directly without a whole lot of reverse engineering.

Think something like Node.js/Express, python/pylons, python/google app engine, etc.

I recently implemented this on Google App Engine for a REST/Datastore API and I don't think it could have been easier. Controllers are implemented as classes and their subsequent HTTP requests (ie GET/POST/PUT/DELETE) are implemented as methods of those classes. I managed to implement basic-auth as a decorator. That made adding an authentication requirement to a request as simple as attaching the @basicAuth decorator.

That way, I could make incoming GET requests public add an auth requirement to POST/PUT/DELETE requests on the same controller for that model.

If you know how to speak in REST, life becomes a lot easier because REST support is already inherently baked into ever webserver (ie HTTP is just a type of REST API). You can even opt for transparent gzip compression if you're sending a lot of data across the wire.

Title: Internal and external API architecture

Body:
The company I work for maintains a successful SaaS product that grew "organically" over the years. We are planning to expand the line with a suite of new products that will share data with the existing product. To support this, we are looking to consolidate business logic into a single place: a web service layer. The WS layer will be used by:

The web applications

A tool to import data

A tool to integrate with other client software (not an API per se)

We also want to create an API that can be used by our customers that are capable of using it to create their own integrations. We are struggling with the following question:

Should the internal API (aka the WS layer) and the external API be one in the same, with security and permission settings to control what can be done by who, or should they be two separate applications where the external API just calls the internal API like any other application? So far in our debate it seems that separating them may be more secure, but will add overhead.

What have others done in a similar situation?


问:
Saving all hits to a web app
Are there standard approaches to persisting data for every hit that a web app receives? This would be for analytics purposes (as a better alternative to log mining down the road).

Seems like Redis would be a must. Is it advisable to also use a different DB server for that table, or would Redis be enough to mitigate the impact on the main DB?

Also, how common is this practice? Seems like a no brainer for businesses who want to better understand their users, but I haven't read much about it.

答:
Use a service layer

tl;dr - log errors on the server-side, log analytics by sending an ajax request to a data tracking service from the client-side.

Just create a thin service layer to track data and fire an AJAX request to it from your site.

The request will contain all the data you want, just create a database to log the specific attributes you want.

Isn't that the basic concept behind most statistic tracking services? A request contains a lot of information about the user.

It won't provide error tracking but that's what the server logs are supposed to be for in the first place.

Title: Saving all hits to a web app


问:
JavaScript and callback nesting
A lot of JavaScript libraries (notably jQuery) use chaining, which allows the reduction of this:

```<code>var foo = $(".foo");
foo.stop();
foo.show();
foo.animate({ top: 0 });
</code>```

to this:

```<code>$(".foo").stop().show().animate({ top: 0 });
</code>```

With proper formatting, I think this is quite a nice syntactic capability. However, I often see a pattern which I don't particularly like, but appears to be a necessary evil in non-blocking models. This is the ever-present nesting of callback functions:

```<code>$(".foo").animate({
    top: 0,
}, {
    callback: function () {
        $.ajax({
            url: 'ajax.php',
        }, {
            callback: function () { ... }
        });
    }
});
</code>```

And it never ends. Even though I love the ease non-blocking models provide, I hate the odd nesting of function literals it forces upon the programmer.

I'm interesting in writing a small JS library as an exercise, and I'd love to find a better way to do this, but I don't know how it could be done without feeling hacky. Are there any projects out there that have resolved this problem before? And if not, what are the alternatives to this ugly, meaningless code structure?

答:
I personally like this style, as an added bonus you get named functions, which is really helpful for debugging:

```<code>$(".foo").animate({
    top: 0,
}, {
    callback: animateCallback
});

function animateCallback() {
    $.ajax('ajax.php', ajaxCompleted);
}

function ajaxCompleted() {
    // ...
}
</code>```

In my experience, more often than not you don't actually want to have anonymous functions. I found myself time and time again triggering events on buttons for example, because I bound a particular function as an event listener, instead of an independent function.

Title: JavaScript and callback nesting

Body:
I personally like this style, as an added bonus you get named functions, which is really helpful for debugging:

$(".foo").animate({
    top: 0,
}, {
    callback: animateCallback
});

function animateCallback() {
    $.ajax('ajax.php', ajaxCompleted);
}

function ajaxCompleted() {
    // ...
}

In my experience, more often than not you don't actually want to have anonymous functions. I found myself time and time again triggering events on buttons for example, because I bound a particular function as an event listener, instead of an independent function.


问:
What is a real-world use case of using a Chomsky Type-I (context-sensitive) grammar
I have been having some fun lately exploring the development of language parsers in the context of how they fit into the Chomsky Hierarchy.

What is a good real-world (ie not theoretical) example of a context-sensitive grammar?

答:
As far as I know, context-sensitive grammars are used in natural language processing, only. Programming language interpreters and compilers do not try to parse a context-sensitive grammar because of the complexity (even if some attempt has been done in the past).

Maybe, you can find some example of real use in one of these libraries:

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

http://opennlp.sourceforge.net/projects.html

http://nltk.org/

http://nlp.stanford.edu/nlp/javadoc/javanlp/

ContentLicense: CC BY-SA 4.0


问:
Is the carriage-return char considered obsolete
I wrote an open source library that parses structured data but intentionally left out carriage-return detection because I don't see the point. It adds additional complexity and overhead for little/no benefit.

To my surprise, a user submitted a bug where the parser wasn't working and I discovered the cause of the issue was that the data used CR line endings as opposed to LF or CRLF.

Hasn't OSX been using LF style line-endings since switching over to a unix-based platform?

I know there are applications like Notepad++ where line endings can be changed to use CR explicitly but I don't see why anybody would want to.

Is it safe to exclude support for the statistically insignificant percentage of users who decide (for whatever reason) to the old Mac OS style line-endings?

Update:

To clarify, supporting Windows line endings (ie CRLF) doesn't require CR token recognition. For efficiency purposes the lexer matches on a per-char basis. By silently ignoring CR chars, the CRLF token simplifies to LF. As such, the CRLF token itself could be considered an anachronism all its own but that's not what this question is about.

The last OS that provided system-wide support for CR style line endings was Mac OS 9. Ironically, the only application that still uses it as the default in OSX is Microsoft Excel.

答:
There is a good practice where you are "liberal in what you accept, and conservative in what you send".

In other words, if there is a chance (however small it will be) that someone will give you a cr line ending (and expect it to work correctly) , you'll need to support it.

TBH, I can't see how adding CR support would take all that long.

When you see a cr in the lexer peek the next character and if it is a nl, swallow the newline and emit a newline token, if the next character isn't a nl just emit a newline token and continue.


答:
About laziness: you have to balance:

effort in changing code so that CR is safely handled (and then forget about it).

effort in explaining to users why the files they were happy with for decades suddenly crash your app, in finding workarounds that they can use without compromising your sales and in asking for arguments and anwsering to comments right here.

It is up to you to decide which path is the laziest.

Title: Is the carriage-return char considered obsolete

Body:
I wrote an open source library that parses structured data but intentionally left out carriage-return detection because I don't see the point. It adds additional complexity and overhead for little/no benefit.

To my surprise, a user submitted a bug where the parser wasn't working and I discovered the cause of the issue was that the data used CR line endings as opposed to LF or CRLF.

Hasn't OSX been using LF style line-endings since switching over to a unix-based platform?

I know there are applications like Notepad++ where line endings can be changed to use CR explicitly but I don't see why anybody would want to.

Is it safe to exclude support for the statistically insignificant percentage of users who decide (for whatever reason) to the old Mac OS style line-endings?

Update:

To clarify, supporting Windows line endings (ie CRLF) doesn't require CR token recognition. For efficiency purposes the lexer matches on a per-char basis. By silently ignoring CR chars, the CRLF token simplifies to LF. As such, the CRLF token itself could be considered an anachronism all its own but that's not what this question is about.

The last OS that provided system-wide support for CR style line endings was Mac OS 9. Ironically, the only application that still uses it as the default in OSX is Microsoft Excel.


问:
How do you regularly take advantage of VS2010's multi monitor support?
Although I like VS2010's multi monitor support, I seem to have too many accidental window drags, where I unsnap a window without intending to.  This behavior has made me still live in the mental model of vs200X's non-snappable windows.

1) Do you have a particular layout that works for general purpose work?

2) How have you optimised for specific scenarios (SQL, Debugging, Workflow, WPF)

3) Are you aware of any hotkey or utility that will jump to a particular window layout?

4) Are you aware of any way I can reduce the times I accidentialy undock a window?

答:
I undock nearly everything and have one monitor that is a full screen code window and all the other little windows in the other monitor.

In earlier versions of studio I would push all the little windows to one side then stretch the container window across two monitors, but that required you to re-stretch every time the window was minimized.


答:
No. CR is not obsolete (defined as "no longer produced or used"). You yourself have provided evidence of that. It is perhaps uncommon, but not obsolete.

As for "is it safe to exclude support" for CR? As you say, it's not a matter of losing sales, and you can't support every weird character combination and file format in the world, and only you know your software and user base. So I would say that it would be safe to exclude it if you're convinced that the support burden of not adding it (as mouviciel explains) does not outweigh the time burden of adding it. But without knowing a lot more about the product and user base I'm not sure how to be any more specific.


问:
How to handle notifications to several partial views of the same model?
I am working on refactoring an old simulation of a Turing machine.

The application uses a class that contains the state and the logic of program execution, and several panels to display the tape representation and show the state, messages, and the GUI controls (start, stop, program listing, ...).

I would like to refactor it using the MVC architecture that was not used originaly: the Frame is the only way to get access to the different panels and there is also a strong coupling between the "engine" class and the GUI updates in the way of frame.displayPanel.state.setText("halted"); or frame.outputPanel.messages.append("some thing");

It looks to me that I should put the state related code into an observable model class and make the different panels observers.

My problem is that the java Observable class only provides a global notification to the Observers, while I would prefer not to refresh every Observers everytime, but only when the part that specificaly observe has changed.

I am thinking of implementing myself several vectors of listeners (for the state / position, for the output messages, ...) but I feel like reinventing the wheel.

I though also about adding some flags that the observers could check like isNewMessageAvailable(), hasTapeMoved(), etc but it sounds also approximative design.

BTW, is it ok to keep the fetch / execute loop into the model or should I move it in another place? We can think in a theorical ideal way as I am completely revamping this small application.

答:
I chose as suggested by @ALJIMohamed to address the different views via different lists of listeners and I fire different events to the view components that were registered by the controller.

It needs to define several EventObject and EventListener interfaces but I feel it better than making all the views simple observers.


问:
Should Swing knowledge be required from Java programmers?
Swing is an integral part of the Java API. It is also the most popular GUI framework for Java. I still wonder, should every Java programmer still know, or at least be pretty familiar with, Swing (possibly excluding web developers)? There are alternatives (e.g. SWT), but they are not very widely used (compared to Swing).

What do you think about requiring Swing knowledge from Java programmers? If such knowledge is important, to what degree? Are the basics enough or not?

The reason I wonder is because I really don't like Swing but wonder if I still should brush up my skills in it. I'm able to create simple GUIs in it, but I would definitely not say that I know Swing well.

答: Swing is a great GUI framework, probably the most purely OO GUI framework out there, so while it is not a core part of Java, it is an excellent thing to learn if you want to build quality applications. There is plenty of chances to implement design patterns such as decorator, MVC etc. The alternatives are SWT, and C#.</p>


问:
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>

答:
Since you asked this question, I suppose that you have already seen the interests of having an interface hiding multiple implementations. This can be manifested by the dependency inversion principle.

However, the necessity to have an interface or not doesn't depend on the number of its implementations. The real role of an interface is that it defines a contract stating what service should be provided instead of how it should be implemented.

Once the contract defined, two or more teams can work independently. Say you are working on a module A and it depends the module B, the fact to create an interface on B allows to continue your work without worrying about B's implementation because all details are hidden by the interface. Thus, distributed programming becomes possible.

Even though module B has only one implementation of its interface, the interface is still necessary.

In conclusion, an interface hides implementation details from its users. Programming to interface helps to write more documents because contract must be defined, to write more modular software, to promote unit tests and to accelerate development speed.


答:
Is it safe to exclude support for the statistically insignificant percentage of users who decide (for whatever reason) to the old Mac OS style line-endings?

Maybe not too many users will detect it, but there's an elephant in the room: Windows line endings (CRLF). If you support those (I generally do, even though I only use Windows for games), it should be trivial to support the third part of this historic Bermuda triangle.

If you don't support something like this, you should at least mention it in the documentation ("This is not a bug" style) and how to change files to work with your tool in the simplest possible way (dos2unix for example).


问:
What are some good End-User Programming solutions you have seen?
End-User Programming is where regular end users, i.e. non-programmers, are able to customize a program, or create a new one, with minimal training or instruction.

App Inventor for Android is one recent example, but perhaps the most popular example of end-user programming is the spreadsheet.

What examples of end-user programming have you seen used, or believe to be useful? What's the philosophy of the system? What challenges remain?

答:
There's a spectrum of end user customization; the trivial ones (like dragging/dropping the menu items in Office) require little effort, and provide little customization. Progressively more complex customizations require progressively more knowledge and programming skill. At that extreme is my personal favorite

Emacs

Chunks are written in C, but much of it is written in Emacs Lisp, which is fully available to you as the end user. If you take the trouble to learn it, you can customize your editing experience to your hearts' content.


问:
Why does Clang/LLVM warn me about using default in a switch statement where all enumerated cases are covered?
Consider the following enum and switch statement:

```<code>typedef enum {
    MaskValueUno,
    MaskValueDos
} testingMask;

void myFunction(testingMask theMask) {
    switch (theMask) {
        case MaskValueUno: {}// deal with it
        case MaskValueDos: {}// deal with it
        default: {} //deal with an unexpected or uninitialized value
    }
};
</code>```

I'm an Objective-C programmer, but I've written this in pure C for a wider audience.

Clang/LLVM 4.1 with -Weverything warns me at the default line:

Default label in switch which covers all enumeration values

Now, I can sort of see why this is there: in a perfect world, the only values entering in the argument theMask would be in the enum, so no default is necessary. But what if some hack comes along and throws an uninitialized int into my beautiful function? My function will be provided as a drop in library, and I have no control over what could go in there. Using default is a very neat way of handling this.

Why do the LLVM gods deem this behaviour unworthy of their infernal device? Should I be preceding this by an if statement to check the argument?

答:
Having a default label here is an indicator that you're confused about what you're expecting. Since you have exhausted all possible enum values explicitly, the default cannot possibly be executed, and you don't need it to guard against future changes either, because if you extended the enum, then the construct would already generate a warning.

So, the compiler notices that you have covered all bases but appear to be thinking that you haven't, and that is always a bad sign. By taking the minimal effort to change the switch to the expected form, you demonstrate to the compiler that what you appear to be doing is what you are actually doing, and you know it.


答:
Here's a version that suffers from neither the problem clang's reporting or the one you're guarding against:

```<code>void myFunction(testingMask theMask) {
    assert(theMask == MaskValueUno || theMask == MaskValueDos);
    switch (theMask) {
        case MaskValueUno: {}// deal with it
        case MaskValueDos: {}// deal with it
    }
}
</code>```

Killian has explained already why clang emits the warning: if you extended the enum, you'd fall into the default case which probably isn't what you want. The correct thing to do is to remove the default case and get warnings for unhandled conditions.

Now you're concerned that someone could call your function with a value that's outside the enumeration. That sounds like failing to meet the function's prerequisite: it's documented to expect a value from the testingMask enumeration but the programmer has passed something else. So make that a programmer error using assert() (or NSCAssert() as you said you're using Objective-C). Make your program crash with a message explaining that the programmer is doing it wrong, if the programmer does it wrong.

Title: Why does Clang/LLVM warn me about using default in a switch statement where all enumerated cases are covered?

Body:
Consider the following enum and switch statement:

```<code>typedef enum {
    MaskValueUno,
    MaskValueDos
} testingMask;

void myFunction(testingMask theMask) {
    switch (theMask) {
        case MaskValueUno: {}// deal with it
        case MaskValueDos: {}// deal with it
        default: {} //deal with an unexpected or uninitialized value
    }
};
</code>```

I'm an Objective-C programmer, but I've written this in pure C for a wider audience.

Clang/LLVM 4.1 with -Weverything warns me at the default line:

Default label in switch which covers all enumeration values

Now, I can sort of see why this is there: in a perfect world, the only values entering in the argument theMask would be in the enum, so no default is necessary. But what if some hack comes along and throws an uninitialized int into my beautiful function? My function will be provided as a drop in library, and I have no control over what could go in there. Using default is a very neat way of handling this.

Why do the LLVM gods deem this behaviour unworthy of their infernal device? Should I be preceding this by an if statement to check the argument?

Body:
Here's a version that suffers from neither the problem clang's reporting or the one you're guarding against:

void myFunction(testingMask theMask) {
    assert(theMask == MaskValueUno || theMask == MaskValueDos);
    switch (theMask) {
        case MaskValueUno: {}// deal with it
        case MaskValueDos: {}// deal with it
    }
}

Killian has explained already why clang emits the warning: if you extended the enum, you'd fall into the default case which probably isn't what you want. The correct thing to do is to remove the default case and get warnings for unhandled conditions.

Now you're concerned that someone could call your function with a value that's outside the enumeration. That sounds like failing to meet the function's prerequisite: it's documented to expect a value from the testingMask enumeration but the programmer has passed something else. So make that a programmer error using assert() (or NSCAssert() as you said you're using Objective-C). Make your program crash with a message explaining that the programmer is doing it wrong, if the programmer does it wrong.


答:
But what if some hack comes along and throws an uninitialized int
  into my beautiful function?

Then you get Undefined Behavior, and your default will be meaningless. There's nothing that you can possibly do to make this any better.

Let me be more clear. The instant someone passes an uninitialized int into your function, it is Undefined Behavior. Your function could solve the Halting Problem and it wouldn't matter. It is UB. There is nothing you can possibly do once UB has been invoked.


问:
As a software architect, am I supposed to focus that much on analysing the logs and fixing other's bugs?
Since my graduation (late 2005) I was working for the same company as a c++ software engineer. A year ago I was promoted as a software architect but I have found myself involved more and more in qualification and fixing bugs, level 2 support.

50% of my time spent in Notepad++ analysing the software logs and trying to figure out what went wrong. 30% fixing other's bugs and the remaining (if any) reviewing developers spaghetti code.

I started hating this product and thinking about an exit strategy out of this company.

What do you think I can do in this situation? do you other software architect still fixing bugs in the code?

答:
No, you're here to manage the big picture.

You have a management issue: fixing bugs and improving code quality is the job of developpers, as an architect you should be issuing guidelines and actual architecture (UML or whatever floats your boat), then giving regular code reviews to ensure these guidelines are followed correctly.

You may, however, implement and fix bugs on the core architecture.

Example: you'd work on PRISM, MEF etc in a WPF/C# project, but you wouldn't work on the XAML to display the splashscreen.

You'd work on DB design but you wouldn't write stored procedures for CRUD operations.

etc.


答:
Wikipedia article defines software architect as:

a computer programmer who makes high-level design choices and dictates technical standards, including software coding standards, tools, or platforms...

Given above, your estimates "50% of my time spent... analysing the software logs... 30% fixing other's bugs" put you far far off of what software architect is normally expected to do.

I would say above makes the title they gave you about 50+30=80% fake.

Note that per se, activities like analyzing logs or fixing other's bugs could legitimately occupy part of architect's time - provided that these serve the primary purpose of this role - that is, making high-level design choices and establishing technical standards. Actually, this is the case for any kind of software development / maintenance / testing activities.

For example, if analyzing logs led you to an insight on how to make it easier - by improving design, or tooling, or coding standards - this would be perfectly justifiable effort for an architect. Similarly, it could be completely OK for architect to get their hands dirty fixing particular bug(s) - as long as this would result in specific design / process improvements leading to lower bug rate, etc.

On a little more positive note, your question demonstrates at least one skill that is quite important for architect: ability to classify different kind activities and track efforts spent on these. Consider adding to your "toolbox" complementary skills to summarize your observations and estimates and clearly communicate these, especially up the management ladder. :)

Title: As a software architect, am I supposed to focus that much on analysing the logs and fixing other's bugs?

Body:
Since my graduation (late 2005) I was working for the same company as a c++ software engineer. A year ago I was promoted as a software architect but I have found myself involved more and more in qualification and fixing bugs, level 2 support.

50% of my time spent in Notepad++ analysing the software logs and trying to figure out what went wrong. 30% fixing other's bugs and the remaining (if any) reviewing developers spaghetti code.

I started hating this product and thinking about an exit strategy out of this company.

What do you think I can do in this situation? do you other software architect still fixing bugs in the code?


答:
Most people generally agree that a Software Architect should mostly be involved in high level design, setting standards, choosing tools or frameworks, evaluating products, implementing prototypes and Proof Of Concepts, and training and mentoring developers

The reality however is that the title often can be a political appointment to a developer, a special title given to lead developers of projects, or even something as simple as a management-HR workaround to hire a badly needed developer at a salary or rate that HR or upper management would find unacceptable for the Software Developer or Software Engineer title.

In other words, titles are mostly meaningless.


答:
The role of a Software Architect traditionally doesn't have them fixing bugs. Software Architects do help fix design issues in software so if by bug you mean the core way the software was designed lends itself to more fragility or difficulty in expanding/maintaining then it would be the the job of the SA to propose or redesign aspects of the software to solve for that problem.

Given what you said:

50% of my time spent in Notepad++ analysing the software logs and trying to figure out what went wrong. 30% fixing other's bugs and the remaining (if any) reviewing developers spaghetti code.

That is not the role of a true SA and instead is more of what I would have our developer 1 and developer 2 level programmers start with alongside a senior developer. I say that in particular because I find it really helps new developers in our company get into the product and code by working at that level on issues of code quality. Are you a new SA in your company and they are having you do this work to get into the system? If so then maybe that is OK for a short time. If this is your daily work and has been for more than a year, then quite possibly it is time to look for another role.


问:
Should I use a parser generator or should I roll my own custom lexer and parser code?
What specific advantages and disadvantages of each way to working on a programming language grammar?

Why/When should I roll my own? Why/When should I use a generator?

答: The big advantage to writing your own is that you'll know how to write your own. The big advantage to using a tool like yacc is that you'll know how to use the tool. I'm a fan of treetop for initial exploration.</p>


问:
What is meant by 4 GL?
I came across the term 4GL(generation language) in reading about Oracle ADF Busniess components . I want to know what exactly is 4GL ?

This is the actual quote from the book Oracle Fusion Guide:

Oracle ADF Business Components is the business services layer of choice in Oracle Fusion
      application development. Compared to other persistence layers, ADF Business Components
      provides exceptional built-in business application functionality and maximally declarative
      experience that makes it a perfect match for those who seek an end-to-end fourth generation
      language (4GL) Java EE development architecture.

答:
I have almost always referred to 4GL languages as languages in which even a technical analyst can program in such as CASE (Computer Assisted Software Engineering) tools. However, apparently there is more to it than that per Wikipedia.

The company I work for works with Oracle ADF quite a bit and we have our own CASE tool for mobile development and so we also refer to our own language as a 4GL one. Specifically we call it out as such because it includes an IDE that generates code on the back end based on very simple flow charts and scripts. It can manage all the basic interactions with databases, files systems, repository, assets, promotion, history and distribution of the scripts in an easily accessible way. Oracle ADF has a similar system.

Given that I would say a 4GL language is any language that abstracts the details of development into a higher level that allows for more productivity or allows for technical analyst to be able to work with it.

Title: What is meant by 4 GL?


问:
Why does Javascript treat days and months differently?
I've noticed that in JavaScript, when creating a Date, months are zero based, and days aren't.

For example:

```<code>var foo = new Date(2012, 1, 1)
</code>```

produces February 1st 2012

Why is this?

答: Most likely the idea is, that the months are thought of as an index into an array of month names, while days are simply "counted".</p>


问:
Has anyone done CSDP certification?
I was looking at some certifications that can potentially enhance my knowledge and market value as a Software Engineer. IEEE's Certified Software Development Professional (CSDP) caught my attention. When I looked on the net for any user experiences with it I couldn't find anything substantial. Doesn't seem too popular. And I certainly havent heard of anyone in my organization or friends circle who have done it.

I would like to know from community members if anyone has done this certification and their experiences with the same. Was the certification useful in  terms of knowledge. Did it add weight to your resume  (not deadweight!)?

答:
Here's the short and the sweet: It is going to gain momentum.

Alot of employers have placed a great deal of emphasis on past experience, the schools you went to, and -- for lack of a better way of saying "gotten burned".  Contrary to popular belief, software development is not nearly as creative an endeavor was many of us in technology would like to believe.  In the areas where it does allow and even require creativity, it typically requires understanding end user personas/stories, system requirements, business domains, economics, software engineering process and software architecture well before you ever get into the software construction [coding].

Since the rise of the Agile Movement, the consensus has been mistakenly to place emphasis on coding & developer first. This has actually been a misinterpretation of what the Agile Manifesto authors were trying to get at though it might be difficult to glean that from the Manifesto. Agile has borrowed heavily from and even directly adopted LEAN principles. LEAN does focus on the implementation employee, but only from the perspective of the fact that these individuals are closest to the firm's [read: contractual client's] actual customers.

Why is this distinction important? Implementation employees feel the impact of many decisions -- both good and bad -- directly. As such, they're uniquely positioned to make simple changes that can have a dramatic impact on performance and quality. Sadly, they often are not fully engaged for their knowledge of the end-customer, leaving many opportunities to improve performance and product quality on the table. LEAN's mission is to consistently deliver greater value to the end-customer by achieving ever increasing levels of effectiveness through the removal of waste increasing delivery speed and quality improvement. Agile pushed the envelope on waste removal within the software construction space, but true effectiveness from the end-customer [as well as the contractual client's end-user]  perspective has been minimal.

To that end, it is worth noting the positive achievements in speed & quality such as a clear improvement in Code Craftsmanship [blending science and art] have driven us forward  on the construction front, but in the process we've lost sight in what is important -- the customer.  And I don't mean just the end user, but the enterprise's end-customer. Just as in LEAN, everything starts from the actual customer and works its way backwards. So what does this have to do with IEEE's CSDA & CSDP? Plenty.

To begin with, it often takes a person who is rooted in the type of understanding reflected in the engineering disciplines to fully grasp that a process must always be focused on the overall goal while taking into account its actual effectiveness, milestones & quality attributes. If you're missing anyone of those traits, you're falling short of delivering full value to your contractual [enterprise] client, which in turn could generate a tidal wave of events that decrease value to the end-customers/firm's clients.  Not good.

Further, the ability to take on leadership responsibilities [which if you have a self directed team {as Agile mandates} requires everyone be capable of leading to some degree] usually requires a good breadth and depth of understanding of the subject matter at hand, the functions which it interacts with, as well as the the ability to communicate this knowledge to multiple stakeholders from a variety of backgrounds. The reality is that no matter what is in the job the description, people expect that developers are engineers deep down. That they are smart, talented people with breadth and depth to their skillsets, which include mastery of their primary activities, as well as the ability to understand and solve for any contractual client's problem domain.

So why the big ol rant about Agile when discussing the CSDA & CSDP? Simple -- Foundation. If you have a team of CSDA's and CSDP's, even if they somehow cheated, they still will have some decent knowledge of where all the processes and disciplines within Software Engineering go, why they are there, and when to revert back to them as a means of unifying understanding before marching forward in a new direction. That Foundation will create an opportunity for consistent delivery of Software development practices, across SDLC methodologies and ability to pivot between and/or combine SDLC methods quite easily. IEEE has created an avenue for computing professionals -- whether engineering majors, CS graduates, IT pros, or self taught developers -- to unify and demonstrate a basic understanding of the Software Development, Delivery, and Decommissioning process as an Engineering discipline that is worthy of respect and should be treated with deference. And because of these factors, it will gain momentum.

Title: Has anyone done CSDP certification?