问:
Choosing between CL and Python for web development
I'm coming from a Java background and after I read this little essay by Paul Graham I started wondering about picking up a new language namely Common Lisp to speed up my work (I'm a web developer).

I'm writing pet projects currently but I have some business plans for the future. Paul speaks about LISP in his essay as a "Secret weapon". I don't know if this statement is true after 10 years but I dipped my toes into a nice CL tutorial and it looks like that LISP may be superior for web development.

Paul also mentions Python as a nice choice which I actually familiar with. My question is: which one should I choose for my future web projects?

What I was thinking about:

I'm not going to develop desktop applications so I can choose whatever language I prefer.

python seems to have a very large community thus a mutch more libraries / frameworks compared to lisp

I found out that lisp has some functionality (like macros) which cannot be found anywhere else

I mostly work alone or with 1-2 other programmers but finding someone with lisp knowledge can be hard

So what do you think?

答:
Lisp is the language you hear when standing close and listening to the voices coming from the ivory towers. Other languages, such as PHP, might not be as elegant or powerfull, but they are like a common tongue, easy and forgiving.

While Lisp has influenced many languages, it never made it to mainstream. Why? Because many developers didn't understand the concepts of the language, to them it seemed rather obscure. Lisp is hard to understand for the vast masses of developers. Have you ever seen a job description requiring Lisp as a programming language? I haven't. "Why" you ask? Because it's hard to maintain and read for many people. In Lisp, you can much more often not tell immediatelly what an expression is doing by simply looking at it. It lacks a certain kind of simplicity, that's why it never became common tongue.

Nevertheless, Lisp has had an impact on many languages. I do recommend learning it for academical purposes. It widens your mental borders so you can often think about problems from a different point of view. However, I wouldn't recommend using it for web applications, unless you're carrying out a feasibility study for a university. It's lacking support in tools and libraries compared to the other options. If you want to acquire practical skills that will eventually yield some money and can be presented on your resumee, then by all means pick Python. You'll benefit from Lisp as well but it's less practical and more academic in nature, although your overall programming style might benefit from it.

Also, there's a renaissance of functional languages these days. You could also look into F# for .NET or Scala on the JVM if you want to pick up some functional concepts.

So make your choice. If both were real languages, which of these would you rather learn:
Latin/Ancient Greek or French/German/Italian/Spanish/Chinese/Arabic?


问:
GCC vs clang/LLVM -- pros and cons of each
What are the pros and cons of GCC vs clang/LLVM?</p>

答: Today (8/11/2011), GCC supports a lot more of the C++0x features than Clang does. If you want those features, it's a no-brainer; GCC is your option.</p>

ContentLicense: CC BY-SA 3.0


答:
If you want to emphasize what Paul Graham was talking about, I would advocate in favor of Lisp. The difference in approach and mindset espoused by the Lisp family of languages has far more potential to have an impact on you as a programmer on the whole, because of the encouragement to think differently. And while I haven't done so myself, it looks like web development in Lisp is pretty well supported: See this question over at SO.

Python is a great language, and I'm not at all going to knock it. There are plenty of good web frameworks and tools for Python, and it will be easier to find people who are already familiar with it, when you need to.

Ultimately, because of the current environment, choosing Lisp seems to always come down to a question of "Do you want to use what you want, or do you want to use what the industry already uses?" What's your answer to that question?

Title: Choosing between CL and Python for web development

Body:
I'm coming from a Java background and after I read this little essay by Paul Graham I started wondering about picking up a new language namely Common Lisp to speed up my work (I'm a web developer).

I'm writing pet projects currently but I have some business plans for the future. Paul speaks about LISP in his essay as a "Secret weapon". I don't know if this statement is true after 10 years but I dipped my toes into a nice CL tutorial and it looks like that LISP may be superior for web development.

Paul also mentions Python as a nice choice which I actually familiar with. My question is: which one should I choose for my future web projects?

What I was thinking about:

I'm not going to develop desktop applications so I can choose whatever language I prefer.

python seems to have a very large community thus a mutch more libraries / frameworks compared to lisp

I found out that lisp has some functionality (like macros) which cannot be found anywhere else

I mostly work alone or with 1-2 other programmers but finding someone with lisp knowledge can be hard

So what do you think?


问:
Can we develop ASP.NET MVC application with MySQL as the database?
I have mostly seen ASP.NET websites using MSSQL as database. Even I developed one some time ago. Why only MSSQL, when MySQL, a free alternative is available. So, the question is, IS it possible to integrate a MySQL database as easily as MSSQL with ASP.NET application or we need to use some API for doing so ??</p>

答: ASP.NET as a web technology and is not tied to any specific database.  As such, you can use NHibernate or standard data access methods to connect to MySQL on the backend.</p>


答:
If you are switching from one database to another during the course of a project you might have some purely database related tasks (data migration) to perform if you used Sql Server specific types. Also, if you wrote stored procedures, you have to rewrite them all.

Otherwise, and for new projects, no problem at all. Just use the ADO.NET connector:
http://dev.mysql.com/downloads/connector/net/

And, as Ryan wrote, with ADO.NET you can connect to any database you want as long as someone wrote the connector for it. And there are... many.

Title: Can we develop ASP.NET MVC application with MySQL as the database?

Body: I have mostly seen ASP.NET websites using MSSQL as database. Even I developed one some time ago. Why only MSSQL, when MySQL, a free alternative is available. So, the question is, IS it possible to integrate a MySQL database as easily as MSSQL with ASP.NET application or we need to use some API for doing so ??</p>


答:
Lisp is just a tool, just like every other language. Does it have useful features, sure. At the same time, it is possible to have the same output with just about any other language, it just may take more time and code. The main problem with Lisp is that you'll HAVE to get, at least, VPS hosting, as there isn't a shared host (that I know of) that supports any variety of Lisp on their platform.

One thing I would suggest is, that since you are a Java programmer, take a look at Groovy ( or even Scala). They will allow you to use your Java libraries and APIs and will provide an increase in productivity.


答:
Given a choice between common lisp and python, the best pragmatic advice I can give is learn python. While the technologist in me thinks everyone who programs should learn lisp, I don't think learning it will help you "speed up [your] work".

If you learn lisp, I believe it will make you a better programmer in the long run. However, learning lisp for the reasons you state won't get you any closer to your immediate goals IMO. If you want a practical, pragmatic solution, learn Python. There simply aren't enough tools or opportunities to use lisp to help you in your day-to-day tasks unless you day-to-day tasks involve customizing emacs.

On the other hand, if you have time to study and learn, and are willing to put up with the ramifications of your choice (a dearth of tools,  harder to find co-workers who get lisp, etc), go with lisp. It really is a terrific language.


问:
Standard/Proper way of counting lines of code?
How should I count the lines of code in a project?

In C++ for example, should I count the lines of the header files with my class definition? Should I count the header of a (non standard) library I am linking against?

In Qt (or any other GUI framework), should I count the lines of the form's design?

Should I count the Makefile too?

I ask because it is a simple way to measure the size of the project and/or effort involved. Even though a GUI file is not code per se the programmer might have spent hours doing it.

EDIT Most of you did not understand the question and/or are assuming that I want to use the magical number of LOC as the ONE AND ONLY metric to rate a project or even a day of work.

I consider a negative LOC day a very nice day. It means I've somehow managed to understand and model the problem better and more efficiently. Comments like "Why do you need this" are not interesting.

Like it or not, the number is out there, Wikipedia says Windows XP is rated at 45M LOC, Linux 2.6.35 at 13.5M, I could go on.

Maybe I could have asked better.

Anyway, my original intent was to know how those numbers in Wikipedia were calculated and not the subjective nature of them.

I found this in a MSDN blog, very useful as it shows how VS2008 does it:

答:
You should probably look here for your answer:

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

http://msquaredtechnologies.com/m2rsm/docs/rsm_metrics_narration.htm


答:
You say it's a simple way to measure the size of a project. If you want to measure the size, why not just get the sum of the filesizes of all files that participate in the project? Or you could break it down by file types (headers, generated code, binaries such as image files, makefiles, etc...).

Measuring a project by the number of bytes it is vs. LOC helps you avoid problems where very simple lines of code (such as x=1; or {) get counted the same as very long lines. It's not perfect though, so you might want to take subcounts by different resource types, and also by number of resources of various types.

Measuring actual effort involved will never be the same as the size of the projet itself. What if 5 hours of effort were spent tweaking the values of 6 variables to get the behaviour just right? The total size of the project (by number of bytes or LOC or whatever) might not even change at all, but there was still effort spent to make changes.

Title: Standard/Proper way of counting lines of code?

Body:
How should I count the lines of code in a project?

In C++ for example, should I count the lines of the header files with my class definition? Should I count the header of a (non standard) library I am linking against?

In Qt (or any other GUI framework), should I count the lines of the form's design?

Should I count the Makefile too?

I ask because it is a simple way to measure the size of the project and/or effort involved. Even though a GUI file is not code per se the programmer might have spent hours doing it.

EDIT Most of you did not understand the question and/or are assuming that I want to use the magical number of LOC as the ONE AND ONLY metric to rate a project or even a day of work.

I consider a negative LOC day a very nice day. It means I've somehow managed to understand and model the problem better and more efficiently. Comments like "Why do you need this" are not interesting.

Like it or not, the number is out there, Wikipedia says Windows XP is rated at 45M LOC, Linux 2.6.35 at 13.5M, I could go on.

Maybe I could have asked better.

Anyway, my original intent was to know how those numbers in Wikipedia were calculated and not the subjective nature of them.

I found this in a MSDN blog, very useful as it shows how VS2008 does it:


答: There is no perfect way to count code. Find a method and use it, and use it consistently. If you use one mechanism for one project and a different mechanism for another project, the numbers mean nothing. If you use the same system for all of your projects, the numbers still mean nothing but at least they give you a rough idea of the project size relative to each other.


答: Your application can connect to the database just as easily, but you may be missing out on some of the Visual Studio integrations for SQL Server (SQL Server Projects). If you don't care or aren't too attached to them, then it doesn't matter. </p>


问:
What does Google or Microsoft get by hosting JS files on their Content Delivery Networks (CDN)?
As you know Google, Microsoft and jQuery.com offer JS files on their CDN. To do this, they must need to operate significant servers which must come at a cost to them. Why do they do this and what do they get from it?</p>

答:
JS files distributed in CDN is very heavily cached (i.e. unless you cleared your browser cache, they're practically download once and stays forever for any website that uses the same URL), and so it reduces the overall amount of Internet traffic. For Google or Microsoft, since many of their own popular products uses those javascript libraries anyway, the additional cost of hosting a CDN is probably minimal (how many people does not use any Google services at all?); and the social advantage is significant.

Installing a CDN-hosted jQuery library is slightly easier than installing it in your own server and in some circumstances it might be impossible to host your own files. jQuery.com obviously intends to promote their javascript library and more websites using jQuery means a step closer to world domination more plugins developers, more jQuery books sold, more donation, and more developers contributing to the library.


问:
Using automated bdd-gui-tests to keep user-documentation-screenshots up do date?
Are there developpers out there, who (ab)use the CaptureScreenshot() function
of their automated gui-tests to also create uptodate-screenshots for the userdocumentation?

Background: Whithin the lifetime of an application, its gui-elements are constantly changing.

It makes a lot of work to keep the userdocumentation uptodate, especially if the example data
in the pictures should match the textual description.

If you already have automated bdd-gui-tests why not let them take screenshots at certain points?

I am currently playing with webapps in dotnet+specflow+selenium, but this topic also applies to
other bdd-engines (JRuby-Cucumber, mspec, rspec, ...)
and gui-test-Frameworks (WaitN, WaitR, MsWhite, ....)

Any experience, thoughts or url-links to this topic would be helpfull.
How is the cost/benefit relation? Is it worth the efford? What are the Drawbacks?

See also:

Is it practical to retroactively write specifications documenting a system via automated acceptance tests?

[Update 2017-12-13]

I have shifted from dotnet to android where localized screenshots for the appstore may also be a topic that could be generated by the bdd tests. My apps are translated to non ascii-languages like arabic (with right-to-left reading), japanese, chinese, bengali.

答:
I had one gig where I wrote an automated test script explicitly to generate new screenshots, and it worked quite well. Whenever the GUIs changed I merely ran that test,  then copied the images to the website. It proved to be a much better system than to regenerate the screenshots by hand.

This method also guaranteed that the screenshots were consistent. We developed cross-platform software, so before we did this we had some screenshots from windows, some from various linux systems, all of which had different window borders, different login accounts, etc. By running a script we could get a cohesive set of images that told a story rather than a bunch of random screenshots that may or may not be related.


问:
Should one test for algorithmic complexity? If so, how?
Let's say I am implementing something simple like searching a sorted list/array. The function (in c#) would look similar to:

```<code>static int FindIndex(int[] sortedList, int i);
</code>```

I could implement and test this in terms of functionality, but for obvious reasons I would usually prefer a binary search over a linear search or something intentionally stupid.

So my question is: Should we attempt to write tests that guarantee performance in terms of algorithmic complexity and if so, how?

I have started making arguments on both sides of the "should you" part of this question, but I'd like to see what people say without my arguments to prompt them.

In terms of "how", that gets very interesting:) You could see parameterizing the comparison operator and having a test whose comparison operator counts comparisons or something like that. But just because you can doesn't mean you should...

Has anyone else considered this (probably)? Thanks.

答:
Passing in the comparator and having that keep track of the number of times it is called will work for simple purposes such as checking that the number of comparisons when doing a search in a fixed input (say new int[] { 1,2,3, ... , 1024 }) stays below 10. That'll at least make clear your intentions about how the algorithm is supposed to behave.

I don't think unit tests are the right way to go to verify that your algorithm is O(log n); that would need a lot of random data generation, some curve fitting, and probably gnarly statistics to determine whether a bunch of data points fits the expected runtime. (For this algorithm it's probably doable, but if you start getting to sorting etc it will become difficult to repeatably hit the worst case scenarios).

OwnerDisplayName: Tobias Brick

ContentLicense: CC BY-SA 4.0


答:
As an addition to the arguments already presented (tracking, goodwill, and so on) I'd also add the argument of easier bugfixing.

If an application uses version X of library Y where a bug get's introduced and company Z is able to fix the bug and upload it to their CDN then everybody is happy. If the application is hosted locally, then the client has to ensure that the new version get's into their product. In the meantime, the might raise a support issue that has to be answered by company Z. This takes time and resources. If the error instead never actually manifests on the client side (becuase the library has already been updated) then there is a real business value for company Z: less time needed to support the product.

Title: What does Google or Microsoft get by hosting JS files on their Content Delivery Networks (CDN)?

Body: As you know Google, Microsoft and jQuery.com offer JS files on their CDN. To do this, they must need to operate significant servers which must come at a cost to them. Why do they do this and what do they get from it?</p>


答:
For the most part, it doesn't really matter as long as you have a standard and are consistent among projects in the same programming language. You should generally create a document that explains how to count source lines of code and how to configure any tools that you use to use this method.

In C++ for example, should I count the lines of the header files with my class definition?

I would. You did write them after all, and they are used in the build process of your software.

Should I count the header of a (non standard) library I am linking against?

Yes, you can, if you are tracking code reuse. If you have the capability to count lines of code from other projects (either your own or open-source projects), you can consider that code reuse and use it when computing various reuse-related metrics.

In Qt (or any other GUI framework), should I count the lines of the form's design?

If you wrote them, I say yes. If they were automatically generated, then perhaps. If you do it once, you should do it consistently. Perhaps you want to consider counting generated code separately than hand-written code.

Should I count the Makefile too?

I would say no, as it's a supporting tool and not part of your built application. Again, going back to the GUI framework question, if it's autogenerated, perhaps you want to count it separately. Or perhaps you want to count "build scripts" separately and include things like Makefiles, Ant scripts, and so forth.


问:
Sign Language Recognition
I am a final year undergraduate student of Information Technology. My team and I have taken up "Sign Language Recognition" as our Final Year Project. We have just started with it and we are in the phase of information gathering (gathering data). We plan to use Instrumented Gloves as the input device. But we do not have much knowledge in the area.

Also, we came across the following methods for training the system for actual recognition of gestures and hence sign language.

Neural Networks

Symbolic Learning Algorithms

Hidden Markov Models

Instance Based Learning

Grammar based techniques

Please tell me which of them I should use for sign recognition.

Also, tell me about Instrumented Gloves and is there any specific variety which we should choose for our project?

答:
Borrowing heavily from the comments: I think you should look into existing image recognition algorithms. Personally, I would simply implement an existing open source one. Once you have some understanding of and comfort with one, train it on a single sign.

Use the output from your gloves to generate an image.  To that end I would look for a glove that provides output easily translatable to an image, such as a table of bit representing the location of the digits.  Then pass the images into the image recognition software.

Once those two are working together, your gloves and image recognition software, you should move on to whatever User Interface you want, such as speech or text output.

Finally keep adding signs, testing after each addition, till your semester is up, or the system performance degrades too much.

Title: Sign Language Recognition


答:
Because many Microsoft or Google products use that resource, and they need a CDN for their own products.  Since nearly every person is going to have downloaded that file from the CDN using their servers anyhow (and it's cached on that users computer until it expires) allowing other sites to use the CDN doesn't really cost them anything extra.

It fosters goodwill.

And as a slight bonus, if you get the file from another site prior to using the Microsoft or Google product that uses it, the loading of the Microsoft or Google product will be slightly faster since it's one less file to download.


问:
Do you throw an argumentexception or argumentnullexception from private methods?
I was just reviewing some code I wrote a while back, and can see that I have a couple of private methods that throw argumentnullexceptions and/or argumentexceptions if there are issues with the methods parameters.

I guess my rationale is that helps future proof the application if someone attempts to "misuse" the method in future. However, given it is a private method and the people who are likely to call this method can see the associated comments and code, it is just unnecessary to throw this. It certainly doesn't hurt to have them, although it does add clutter.

My feeling is that these exceptions are generally more useful on something like a API that is going to be exposed publically.

答:
Like everything else it depends....

If the public methods are simple wrappers that call the private method (along the lines of a private overloaded method) then it may make sense to throw an exception in the private method instead of checking in each public one.

Generally if it doesn't meet the above definition then I wouldn't usually check the arguments / throw an exception on a private method.  Although there are other cases I generally do this in a private method prior to performing some expensive operation that could fail part way through if the arguments are invalid.


答:
You are coming from Java background, so why not checking Clojure programming language?

It is a modern Lisp dialect that lives on the JVM, so you have access to tons of JARs out there.

While you aren't going to find polished and production ready web frameworks like Django and Rails in Clojure universe (at least right now), but programmers are using Noir and Compojure web frameworks.

You can also deploy your Clojure web apps on Heroku platform.

Clojure is highly rewarding but the learning curve is really steep. Are you ready to learn functional programming (assuming you aren't familiar)? to live out side the OOP world?

Python is the safe side: it is mature, tons of books, many web frameworks, huge knowledge pool and easy to learn.

So the decision is really yours.


答:
I have had an ASP.NET/C#/MySQL web app running in production for about 3 years now. It runs well. I also use it for all of my side jobs too. The ADO.NET connector plugs in to visual studio and works just as well as the SQLSERVER connector. There are a few gotchas though. 1st, there is not a free equivalent of SQLSERVER's Management Studio as far as I have found. I use Aqua Data Studio, but it costs a bit. There are some free RDMSs for MySQL, but they are by no means comparable to Management Studio. I hear eclipse has a plugin for MySQL that is pretty good and free, and I haven't tried that one. Also, in MySQL you can not ALTER a stored procedure, you can only drop and create. This causes a few pains in the A in visual studio.

The ADO.NET MySQL connector is fully polymorphic with the System.Data and the System.Data.SqlClient namespaces so it is easy to have multiple versions of a database for SQLSERVER and MySQL simultaneously. This is useful if you have a customer who is a MS crony who says crap like, "We are a microsoft only shop!" as if he actually knows what he is talking about. This happens more than you might realize. Then, you can just use your old SQLSERVER code instead without having to do any additional coding--if you have a good design to begin with.

My last critique is that MySQL is notorious for not maintaining backwards compatibility between the .NET connector and different versions of their DB engine. This is fine as long as you are deploying the server with MySQL on it, but if you are deploying the site to a hosting provider, beware!

It is worth the extra effort in my opinion, though it has some of the inherent flaws that many open source projects have. It is, in my experience, just as scalable and faster than ms sqlserver, while if you know T-SQL, you will pickup on the MySQL syntax relatively quickly.


问:
Small companies and software licensing
Small companies with small budgets may not have have the money to invest in expensive software licenses that they may need for a given development project.  This is even more so if the project was a loss-leader to drum up more business and the price of the development product cannot be renegotiated without potentially harming relationships, when it is discovered later that some proprietary expensive software license is needed for a very small yet crucial part of the application.

I have dealt with this in the past by cleverly using trial versions of software in potentially unethical ways just trying to delay or prevent purchasing the license.

What creative ways do smart software engineers work around this problem when the money to invest would be hard to acquire without breaking laws or stealing?

UPDATE:  To give some context of a situation where free or open source isn't available, you have a signature pad peripheral device that comes with an integration plugin to Adobe Acrobat Professional.  To use this device properly a PDF needs to be created with Acrobat and its accompanying plugin.  The trial works fine for creating the PDF but what happens if the customer wants to modify the PDF a year from now?  You basically just punted that problem down the road.

答:
Use open source software?

If you want commercial software some companies offer deals to startups that can reduce the cost significantly, e.g. Microsoft has the BizSpark program.

[NB Full disclosure - I work for Microsoft. I'm suspect other suppliers have similar deals but I don't know for sure, but obviously if you work in a different stack you should check for relevant deals.]

Title: Small companies and software licensing


答:
Thad Starner (now at GA Tech) was able to get this to work with HMMs and a cap-mounted video camera back in 1995. I imagine you'll have some good luck along those lines with the massive increase in processing power and sensors since then.

Thad Starner and Alex Pentland. Real-time american sign language recognition from video using hidden markov models. In Proceedings of International Symposium on Computer Vision, Coral Gables, FL, USA, 1995. IEEE Computer Society Press.

You're going to have to do a lot of data cleaning/filtering before it gets to the HMM, however. This is a signal-processing task and it may be suitable to use fuzzy logic to categorize the inputs (look at how mouse-gesture recognition is done) and something like a NN to downsample the data.

Title: Sign Language Recognition

Body:
I am a final year undergraduate student of Information Technology. My team and I have taken up "Sign Language Recognition" as our Final Year Project. We have just started with it and we are in the phase of information gathering (gathering data). We plan to use Instrumented Gloves as the input device. But we do not have much knowledge in the area.

Also, we came across the following methods for training the system for actual recognition of gestures and hence sign language.

Neural Networks

Symbolic Learning Algorithms

Hidden Markov Models

Instance Based Learning

Grammar based techniques

Please tell me which of them I should use for sign recognition.

Also, tell me about Instrumented Gloves and is there any specific variety which we should choose for our project?


问:
What are the key differences between software engineers and programmers?
What are the key differences between software engineers and programmers?</p>

答:
It's up to the company really, as I don't think there's a legal framework to enforce a denomination or another, or at least not that I am aware of and this might vary from country to country (for instance, the use of the term "engineer" is actually fairly regulated in France, but there are variants that are allowed for the "abusive" cases).

That being said the general trend goes like this:

A programmer position is usually the one of a professional hired to to produce the code of a computer program. It will imply that you know how to write code, can understand an algorithm and follow specifications. However, it usually stops there in terms of responsibility.

A developer position is usually considered a super-type of the programmer position. It encompasses the same responsibilities, plus the ability to design and architect a software component, and to write the technical documentation for it (including specifications). You are able to  - at least technically - lead others (so, programmers), but not necessarily a team (there comes the fuzz...)

An engineer position would usually imply that you are a developer who has a specific type of degree, some knowledge of engineering, and is capable of designing a system (as in: a combination of software components/modules that together form a whole software entity). Basically, you see a wider picture, and you are capable of designing and explaining it and separating it into smaller modules.

However, all this is arguable, and as I said, there's no legal requirement that I am aware of in US/UK countries. That being said, in France you can only call yourself an "engineer" if you come from an engineering school (recognized by the Commission des Titres d'Ingenieurs or something like that). You cannot say that you have an "Engineer Degree", but you can say that you have a "Degree in Engineering" if you have studied a discipline that falls under the portemanteau of engineering and technologies.

It might be that some countries have a similar distinction, I just don't really know.

Back to the software engineer title... Once, one of my teacher told our class - and rightly so - that there's no such thing, as of today, as so-called "software engineering". Because engineering something (be it a building, a vehicle, a piece of hardware...) means you are capable of envisioning its design and all the phases of its production, and to predict with accuracy the resources you will need, and thus the cost of the production.

This is true of most "true" engineering disciplines. There are fluctuations, of course (the prices of the materials will vary over time, for instance), but there are very finite theoretical models (for design and planning) and empirical models (for pretty much keeping any of the former within accessible constraints) that allow you to predict the termination date of a project and its resource usage.

The major problem with software is that it is not there yet. We want to aim for software engineering, but we're not there yet, really. Because we have a very fluid and dynamic environment, very variable constraints for projects, and still a lack of maturity in retrospect in our processes. Sure we could say we get better at it (highly arguable with hard-data, though), but we've only been at it since the 60s (earlier projects were actually closer to hardware-only computers, thus closer to real engineering, ironically). Whereas we've been building motored vehicles for more than a century, vehicles in general for a few millennias, and building for even more millennias (and have been pretty damn good at it actually in some part of the world, making you feel like we're ridiculous kids playing with our new flashy software toys in comparison).

We fail to systematically predict deadlines accurately, we fail to systematically predict costs accurately, we fail to systematically identify and mitigate inherent and external risks efficiently and deterministically. The best we can manage to do is produce good enough guesstimates, and accommodate for some buffer, while trying our best to optimize the processes to reduce cycles and overhead.

But see, maybe that's what engineering is. And that's what, when someone talks about a "software engineer", they should think of and aim for.

So that seems hardly interchangeable with the simple act of programming routines, or the more advanced act of developing applications.

Still, everything is a matter of trends. Lately it's pretty common to have an horizontal dev team where everybody on the team is a Senior Software Developer (yes, capitals, because that makes us feel special, doesn't it?), without real distinction of age (fair enough, in my opinion) and not so much distinction of skills (uh-oh...) and responsibilities (now that can't be good, apart purely for PR buzz).

It's also sometimes just a force of habit and specific to an industry's culture and jargon. More positions for embedded software production use titles for software engineers. Mostly because it would probably imply that you will always have to deal to a certain extent with the hardware as well in this field, so you obviously deal with other aspects of the production and of the whole "system" you produce. Not just the bits going nuts inside it. On the other hand of the spectrum, you don't really see the term engineer being used in financial software production positions. It's either because is a mimetic evolution of this industry from one of its predecessors (say, embedded engineering find its roots in automobile engineering, for instance), or because they just want to give more or less credit/weight to a position.

And to be sure to loose everybody in the fog, you'll then find other titles mixing both (like "Software Development Engineer" or "Software Engineer in Test"!), and then other ones emphasizing even more crazy bridges with other domains (think of "Software Architect" and how "software architecture" might be a shameless theft of vocabulary). And keep them coming: Release Engineer, Change Development Manager, Build Engineer (that one goes ffaaarrrrrr out there as well). And sometimes just simply "engineer".

Hope that helped, though it's not really an answer.

Oh, and that means your new company is either trying to lure you in with a new title or that they don't really care about titles, or that you really are going to have a higher-level position. The only way of knowing is to read your job spec, talk to them and eventually give it a shot and judge for yourself. I'd hope it's the latter option and that you're happy with it (and potentially cash more in on it). ;)

ContentLicense: CC BY-SA 2.5


问:
Should organizations penalize developers for the amount of defect reports filed against code they worked on?
Should organizations penalize developers for defect reports filed against their work products?

I was having a discussion with my friend where he asks if a manager taking the number of defects filed against a developer is justified. My take is no, because developers can introduce defects, but by holding those against him can cause unnecessary negative feelings in the developer's mind.

What are the problems with penalizing developers based on defects that they inject? Does your organization penalize developers for creating defects in work products?

答:
Although I don't agree with the premise ...

It would could only be feasible if you rewarded the programmer that takes on more technically challenging features as well - "higher risk, higher reward". Otherwise why would a programmer ever take on challenging work in that environment, since any technical challenge is a liability (not an opportunity for reward).

I agree that it would create a very hostile environment as well.  In my experience a significant amount of defects are due to requirement ambiguity or just a lack of a requirement.  So I think this could also lead to those defects being explicitly assigned back to the business analyst, systems engineer, or project sponsor and they should be subject to that the same penalty - which wouldn't be a bad thing.


答:
If you don't want to pay, either write code to do the same thing, find the lib that probably already does the same exact thing in your O.S., or go open source. The only problem with the open source stuff is that you are usually on your own when it comes to figuring out how to use a library. Their documentation is usually sub par, and the developers usually have jobs so they can't talk to you. For everyone that writes software to sell, there are usually 2 who write the same thing for a hobby and host it on github or something.

Also, most companies are willing to negotiate on price once they realize that the choice is either, you buy at a low price or they get nothing.

Title: Small companies and software licensing

Body:
Small companies with small budgets may not have have the money to invest in expensive software licenses that they may need for a given development project.  This is even more so if the project was a loss-leader to drum up more business and the price of the development product cannot be renegotiated without potentially harming relationships, when it is discovered later that some proprietary expensive software license is needed for a very small yet crucial part of the application.

I have dealt with this in the past by cleverly using trial versions of software in potentially unethical ways just trying to delay or prevent purchasing the license.

What creative ways do smart software engineers work around this problem when the money to invest would be hard to acquire without breaking laws or stealing?

UPDATE:  To give some context of a situation where free or open source isn't available, you have a signature pad peripheral device that comes with an integration plugin to Adobe Acrobat Professional.  To use this device properly a PDF needs to be created with Acrobat and its accompanying plugin.  The trial works fine for creating the PDF but what happens if the customer wants to modify the PDF a year from now?  You basically just punted that problem down the road.


问:
How is Delphi XE2 going to work across platforms?
So I've been reading a little about Delphi XE2 and I probably will go to the world tour thing in Chicago coming up later this month and ask this question if no one can answer it here.

What I wonder is how is my Delphi code going to be executed on a Mac? Is something else going to have to run (i.e. virtual machine) in order for the program to run?

答: For the iOS build, Delphi XE2 will be leveraging the ARM port of Free Pascal. See http://delphimax.wordpress.com/2011/08/04/delphi-64bit-os-x-and-iphone-native/#comment-749</p>


问:
Importance of hobby projects
I want to know, how important is it to program in your spare time? Is it necessary to work your 9-5 as a programmer and then get home and work on your hobby to become a better programmer?

This said, I know you only get better at programming by, well, programming.

Do prospective employers take hobby programming into account in an interview or do they ask this just out of curiosity?

I feel guilty for not having a hobby project, but everything I can think of doing has already been done. So I am kind of in two minds about this, start something that has already been done or leave it until I come up with something original?

答:
Others have covered a lot, but I want to focus on this part:

I feel guilty for not having a hobby project, but everything I can think of doing has already been done. So I am kind of in two minds about this, start something that has already been done or leave it until I come up with something original?

It seems to me that this misses the point of a "hobby project." It's certainly true that many hobby projects are created for others, or at least with public consumption in mind -- these projects require a certain amount of consistent work over time, and can be daunting for that reason. After all, who wants to make yet another under-supported, low-quality something-or-other that ultimately gets abandoned after a couple of months?

But, there's no reason that your hobby project has to do anything useful for anyone at all. For instance, I recently started learning Haskell, purely because it's so drastically different from the imperative languages I'm used to, and it's really easy to get set up. I also just started learning the Redcode assembly-ish language, used in the programming game Core War, again out of curiosity.

This, in turn, has led me to look into creating a Notepad++ plugin to provide better syntax highlighting features for Redcode, which has led me to consider learning a bit of C++. Drawing on my comparative familiarity with .NET, I am now pondering getting myself set up with Visual C++.

And the thing is, none of this really "matters," at least not as a project. Hell, I'm not sure you could even call it a project per se, so much as a bunch of stuff I'm kind of messing with because it caught my attention. I mean, you'll need a little time and organization to make sure you actually get something out of it, but no one will care if I stop having time for Haskell once school starts.

And no one will care if it turns out that plugin development for Notepad++ is harder than I expected, and I give up -- indeed, I looked into Perl before I dove into Redcode, and I abandoned it pretty quickly because I had difficulty getting the environment set up properly. Did this show a lack of persistence? Yeah. But nobody cares, because it's my hobby, and that means I get to play with whatever I feel like.

So don't feel like you need to pick some hobby project that will teach you Marketable Skills -- that's just turning your free time into more unpaid work time. The skills come as a result of what you do, but they're not the reason. I understand declarative programming better now, and how assembly languages work, and how programs use DLLs. And I've learned a bunch of stuff about the Windows command prompt, and other things that you wouldn't have thought were connected to anything I've mentioned thus far.

The point being, find something completely new, and see if it's as interesting as it seems. If it is, great, and if it's not, move on. Have you ever had even the slightest curiosity about compilers or interpreters? Go take a look at LOLCODE. If it makes you as happy as it makes me, then it's time to start learning about compilers. And hey, maybe you should go back and think about syntax highlighting again. In fact, this will probably be the next project I start.

If that's not your thing, try something lower-level than you're used to. Or higher-level. It doesn't matter. The only thing that does matter is that when you look at it, you think "Fun!"

Title: Importance of hobby projects


答:
MS Express editions/BizSpark/DreamSpark(if you're a student)/open source. The thing you have to remember is that very few development products are actually necessary to develop with. They are nice/speed up dev times, but you can make almost any type of software with notepad and compile it with command line if you have no other choice. There are plenty of options out there. You should never feel that stealing/pirating is one.

Re: Your update:

I would try to find an open-source alternative to Acrobat. I have been using one called PDFJet with quite a bit of luck. Once you find that you will probably have to write code to make it operate with the plugin that you mentioned. This should not be too hard as they should have a published API. I don't believe this is unethical either because you are not de-compiling and reverse-engineering or anything, you are using a published API to create an interface.

Title: Small companies and software licensing


问:
Example for explaining object-oriented concepts
What are some good examples for illustrating the concepts of object-oriented programming? I'm talking about sample classes, classes that would have inheritance, overriding, etc.

The only one I can ever think of is of animals. A base Animal class, with Cow that have a different makeCry method or something like that. It sucks. What do you guys use?

答:
The classic set of objects I've always seen is Vehicle (base), Car, Truck, Airplane.

Edited to expand on the objects.

Vehicle could have a method numberOfWheels, which returns an integer.  The Car numberOfWheels would return 4.  The Truck numberOfWheels could return 4, 6, 10, or 18, depending on the type of truck.  The Airplane numberOfWheels would return 17  for a jet airliner (I think).

Another method could be engineType, which returns a String.  The Car engineType would return either "gasoline" or "diesel".  The Truck engineType would return either "gasoline" or "diesel".  The Airplane engineType would return either "gasoline" or "jet".

You could certainly come up with more methods that vehicles have in common.


答: Google makes money when people use the Internet. Their entire business model is to give users what they want quickly, so those same users will click on ad{sense, words, mob} advertising. If they host jQuery et al on their CDN, it makes it easier for everyone who builds content (probably with the aforementioned ads) to build it so that it responds quickly and looks good</p>


答:
Off the top of my head: You're making a game, something like SimCity.

You've got a base class called building, and subclasses called residential, commercial, utility, or whatnot.

All buildings have a location, value, and land-tax (you're mayor remember).

Residential buildings provide living space.

Commercial buildings provide working space.

Utility buildings provide services.

The calculateValue and calculateLandTax functions would be handled differently for residential and commercial buildings.

Title: Example for explaining object-oriented concepts

Body:
What are some good examples for illustrating the concepts of object-oriented programming? I'm talking about sample classes, classes that would have inheritance, overriding, etc.

The only one I can ever think of is of animals. A base Animal class, with Cow that have a different makeCry method or something like that. It sucks. What do you guys use?


问:
Do you obfuscate your email address in open-source code to prevent spamming?
I've been thinking of releasing a few projects, and most authors in the community leave their email address right in the code, often as is or using commonly used schemes like "meATNOSPAMgmail.com", which sort of gets my paranoia flag up...

When releasing source code publicly, does it often lead to your email address being parsed by spam bots, and if so how do you obfuscate it ?

答:
Real world experience: I contributed some code to VNC many years ago (like 1998 or something) and my unobfuscated email address ended up in the standard readme.txt that was distributed and installed with every copy of VNC. Back then (and in the following years) there were certainly some spam worms that looked through all files on the user's computer for email addresses. My address was one of those, as well as all the others listed in that file. I get a lot of spam. At one point, some 20% of the total spam I got was "from" a forged address in that same readme.txt file.

So the answer is yes, releasing your email address in public software results in more spam. However, many kinds of other things also result in more spam too, so I don't think it's actually worth worrying about. I still use the same email address I've used since 1996, and rely on multiple layers of spam filters to filter out the crap.


答: I once had to teach children these concepts. The projects were mostly simple video-games which lent itself very nicely to basic OOD/OOP. You had Sprite which was a root of a hierarchy. It would have attributes such as size, speed, and health and these would often be overriden to have different values in different subclasses. Common methods that all Sprites had (but sometimes overrode) would be things like move. Then you had subclasses such as GoodGuy, BadGuy, and sometimes we'd have a Scenery class (for sprites that just moved around in the background). Sometimes BadGuy would have further subclasses such as BossBadGuy and BigBossBadGuy which would override some of the BadGuy methods (such as attack, die, respawn).


答:
I'm an amateur web developer with no college education (yet) working on my own personal project.  I was invited to my first interview for a programming job a couple weeks ago because I was working on my own personal project.

Taking this anecdotal evidence into account, working on my personal "hobby" project has been the best thing I've done to advance my career in development...after enrolling in college.

So, yes, interviewers certainly take into account your personal projects, otherwise they wouldn't have even bothered talking to me.

Title: Importance of hobby projects

Body:
I want to know, how important is it to program in your spare time? Is it necessary to work your 9-5 as a programmer and then get home and work on your hobby to become a better programmer?

This said, I know you only get better at programming by, well, programming.

Do prospective employers take hobby programming into account in an interview or do they ask this just out of curiosity?

I feel guilty for not having a hobby project, but everything I can think of doing has already been done. So I am kind of in two minds about this, start something that has already been done or leave it until I come up with something original?


问:
How do I view Scala code without all the syntactic sugar?
I have been studying Scala, but what I keep running into is the optimization of syntax.  I'm sure that will be great when I am an expert, but until then.. Not so much.

Is there a command or a program that that would add back in all/most of the code that was optimized away? Then I would be able to read the examples, for example.

答:
You can use -print when compiling Scala, and it will print a de-sugared version of the code. Unfortunately, you'll see that Scala has syntactic sugar for good reason.

Let's see a very simple example:

```<code>object T {
  def first[A : Ordering](l: List[A]): A = {
    val s = l.sorted
    s(0)
  }
}
</code>```

And the output:

```<code>package <empty> {
  final object T extends java.lang.Object with ScalaObject {
    def first(l: List, evidence$1: scala.math.Ordering): java.lang.Object = {
      val s: List = l.sorted(evidence$1).$asInstanceOf[List]();
      s.apply(0)
    };
    def this(): object T = {
      T.super.this();
      ()
    }
  }
}
</code>```

You'll often see things like <empty> -- these are compiler annotations, not valid Scala code. For example, a parameter in a case class will have its getter tagged with <stable> <caseaccessor> <accessor> <paramaccessor>. Also, a case class will have a number of methods marked <synthetic>, to indicate they were created by the compiler.

Also, the this constructor you see here is not valid Scala code, exactly. In this case, the "normal" Scala constructor (which is the body of the class, trait or object) is moved inside such a this method -- which is how Java itself sees things.

So, this is mixture of Scala and Java, with a bit of compiler internals sprinkled over it. But it will show the de-sugared stuff.

Body:
You can use -print when compiling Scala, and it will print a de-sugared version of the code. Unfortunately, you'll see that Scala has syntactic sugar for good reason.

Let's see a very simple example:

object T {
  def first[A : Ordering](l: List[A]): A = {
    val s = l.sorted
    s(0)
  }
}

And the output:

package <empty> {
  final object T extends java.lang.Object with ScalaObject {
    def first(l: List, evidence$1: scala.math.Ordering): java.lang.Object = {
      val s: List = l.sorted(evidence$1).$asInstanceOf[List]();
      s.apply(0)
    };
    def this(): object T = {
      T.super.this();
      ()
    }
  }
}

You'll often see things like <empty> -- these are compiler annotations, not valid Scala code. For example, a parameter in a case class will have its getter tagged with <stable> <caseaccessor> <accessor> <paramaccessor>. Also, a case class will have a number of methods marked <synthetic>, to indicate they were created by the compiler.

Also, the this constructor you see here is not valid Scala code, exactly. In this case, the "normal" Scala constructor (which is the body of the class, trait or object) is moved inside such a this method -- which is how Java itself sees things.

So, this is mixture of Scala and Java, with a bit of compiler internals sprinkled over it. But it will show the de-sugared stuff.


答:
I don't believe that there is anything unethical about using a trial version of software for development and deployment.

I've certainly been caught in the situation where purchase order processing of run-time licenses for a library we used was so slow (we only ever ordered just-in-time so we could pay as late as possible) that we routinely installed the trial version. That gave us one month from install to get the dongle to the customer.

It also had the side effect that the customer knew that while they could use the software immediately, they would lose significant functionality after the trial ran out, giving them added incentive to sign the project off and pay us. *8')

Of course, this assumes that you aren't just hiding the true cost of your application by requiring some other expensive component, that would be unethical.

Title: Small companies and software licensing


答:
Generally when you're doing a "loss leader" to drum up business you are already going down the wrong path.  Business is the exchange of goods or services for money.  If the project isn't bringing in enough money to buy or lease software, you need to re-evaluate your business plan rather then use pirated goods.

Companies can be burned alive if word gets out that they steal other products, especially if you're charging someone for your end result.

Title: Small companies and software licensing


问:
Library version control best practices
I may be violating some StackOverflow terms by asking a question which is more likely to yield discussion than a clean answer.  Here goes, however.

I've developed some software for a small company that isn't a software house (so we don't already have a lot of processes in place).  It is in Turbo Pascal (Delphi 2009) and my source is version controlled (CVS).

I use several third party components (graphing, TCP comms, etc.)  In Delphi, the default behavior is for the source for these to be stored in an include folder under the the Delphi IDE program files folder.

It's now time to pass this project off to another developer.  Now he'll have to install the IDE + components in order for them to appear correctly when editing forms in this application.  But I'd like our production build process to be automated and I'd like a build server to be able to perform a code checkout and compile.

This means I think I really need to put all the source code (or at least the DCUs where I don't have the source files) for these 3rd party addons in source control.  I think they should be part of the CVS module for the software project being developed (i.e. not their own source controlled module).

I think we need to be able (as a small company) to point a future developer at the repository, and say "Check out this module" and he'll have everything he needs to be able to compile from the command line without doing anything else. (i.e. portability to new dev environments is important)

Is this sensible, or would it be more scalable for us to keep each library in its own version controlled state and then in the build script, pull the source code for this project, and the correct version of the source code for each library?

Thanks in advance, and my apologies for the rambling nature of the question.

Duncan

答:
I will also chime in with how we do things at my company. We have one repository for the main project, and a separate repository for all of our Delphi components.

When I create a new release of the main project, I tag the release in both the project and component repositories.

I also have a build script which checks out either the trunk or a specified tag for both repositories, and then builds a release version of the project.

If the components you use in your project are only used in that one project, then I think it would make more sense to keep them with the project. On the other hand, if you use these third party components with other projects, then maybe it makes more sense to keep them in a separate repository.

OwnerDisplayName: Duncan

Title: Library version control best practices


答:
I find that programming in my spare time serves two purposes:

1) It allows me to accomplish something personally rewarding, without the restraints of work projects. This is especially important when I've been dealing with difficult and frustrating problems with my work projects.

2) It gives me an opportunity to broaden and sharpen my programming skills, as I am free to create whatever I wish.

All the same, I think it is also important to balance this out with some non-computer hobbies. For me, it's maintaining the creek and trails behind my house.

Title: Importance of hobby projects


答:
How should I count the lines of code in a project?

If this is just a rough measure of work then all I would do is:

```<code># This assumes you build obj/lib/executables into a seprate tree hierarchy
find . | xargs wc -l
</code>```

In C++ for example, should I count the lines of the header files with my class definition? Should I count the header of a (non standard) library I am linking against?

I would count everything in your source tree that you build. But not the stuff that you link against (you can count that separately).

In Qt (or any other GUI framework), should I count the lines of the form's design?
  Should I count the Makefile too?

Any thing that is part of the project that involved effort to write should probably be counted. If there is something really huge that took no effort I may manually remove its count from the total. But this is not something I would spend a lot of time on working out what the best things to count are.

Body:
How should I count the lines of code in a project?

If this is just a rough measure of work then all I would do is:

# This assumes you build obj/lib/executables into a seprate tree hierarchy
find . | xargs wc -l

In C++ for example, should I count the lines of the header files with my class definition? Should I count the header of a (non standard) library I am linking against?

I would count everything in your source tree that you build. But not the stuff that you link against (you can count that separately).

In Qt (or any other GUI framework), should I count the lines of the form's design?
  Should I count the Makefile too?

Any thing that is part of the project that involved effort to write should probably be counted. If there is something really huge that took no effort I may manually remove its count from the total. But this is not something I would spend a lot of time on working out what the best things to count are.


问:
Unit Testing For Different Environments
How does one do unit testing for multiple environments that behave differently?

Here is my problem. I have a PHP class for which I'd like to create unit tests. The class provides shortcuts for manipulating folders. On Linux, you can set the folder permissions without a problem, on Windows, you can't at all.

Knowing this, what is the best practice for creating a unit test for this class? The test suite could be run on either Windows or Linux, but if you test the folder settings on Windows, the test will fail. Do you just live with the failing test, make it conditional on the OS, omit testing it altogether, or something else?

答:
Create unit tests for both!  You need to know that it is working code!

PHP has a great unit testing tool known as PHPUnit, which offers a few ways of doing this.  My recommendation would be to group the tests that are OS-specific with that OS name.

```<code>/**
 * @group linux
 */
class LinuxTest extends PHPUnit_Framework_TestCase {
    // all tests within this class will be in the group, linux
}

class MixedTests extends PHPUnit_Framework_TestCase
{
    public function testSomeTestThatAlwaysRuns()
    {
        // this test is not in a group
    }

    /**
     * @group windows
     */
    public function testWindowsOnlyCase()
    {
        // this test is in the group, windows
    }
}
</code>```

Then, when in linux, run all tests except for tests in "windows" and vice-versa.  This will run all tests that should run on both platforms, and will only exclude those for the given group.

```<code>phpunit --exclude-group windows
phpunit --exclude-group linux
</code>```

Also, you can exclude multiple groups:

```<code>phpunit --exclude-group windows,mac
</code>```

Title: Unit Testing For Different Environments

Body:
Create unit tests for both!  You need to know that it is working code!

PHP has a great unit testing tool known as PHPUnit, which offers a few ways of doing this.  My recommendation would be to group the tests that are OS-specific with that OS name.

/**
 * @group linux
 */
class LinuxTest extends PHPUnit_Framework_TestCase {
    // all tests within this class will be in the group, linux
}

class MixedTests extends PHPUnit_Framework_TestCase
{
    public function testSomeTestThatAlwaysRuns()
    {
        // this test is not in a group
    }

    /**
     * @group windows
     */
    public function testWindowsOnlyCase()
    {
        // this test is in the group, windows
    }
}

Then, when in linux, run all tests except for tests in "windows" and vice-versa.  This will run all tests that should run on both platforms, and will only exclude those for the given group.

phpunit --exclude-group windows
phpunit --exclude-group linux

Also, you can exclude multiple groups:

phpunit --exclude-group windows,mac


问:
What workflow do you use with asp.net web forms development and your design department
I work at a place that has a clear separation between designers and developers.  We're a fairly new start-up and we're trying to figure out what would be the best workflow for our team.  We're a small company with a total of about 11 employees, three of which are designers (they deal with the HTML, CSS, some jQuery), and three developers primarily working with ASP.NET Web Forms. I am one of the developers and don't have a knack for design, but I am comfortable enough with CSS and jquery/Javascript to understand the mechanics and whatnot.

So, currently we wait for the designers to provide us with HTML structure clobbered together with server-side includes, js, jquery, css, etc.

Typically we try to work around their stuff and begrudgingly try to keep their structure roughly the same with the consequence of forcing us to have a lot of hacks in place to work with it.  Yes, this means using their Server-Side Includes mixed in with our .aspx pages, amongst other things that seem to go against the general asp.net web forms flow.

There have been times when I have changed the includes into a user control and had their common HTML out in master pages, etc. All of which was consequently followed by a lot of barking from the design team.  Their main complaint being that master pages and user controls make their maintenance of the site more difficult.

I can see their point of view, and I wouldn't like it either if people messed with my workflow either, which I guess I am doing so with them.

I have tried several times to approach them about moving site structure that complements the asp.net web forms environment we programmers are working with, but every time the subject of working with master pages comes up, the design team throws a near tantrum.

Our current approach is simply forcing us to put together a lot of hacks and work-arounds so that it gels with their design and frankly it's getting frustrating and just adding more unnecessary technical dept to our projects.

My question is simply this: what workflow works best for you and your design team?

Do your designers know how to use master pages, etc.

Is it unreasonable to have designers understand the mechanics of how master pages and user controls work, and in general how ASP.NET puts a page together?  (I don't feel this is an unreasonable expectation of them...)

So, what do you guys think?

答:
Where I work our designers make their layouts (usually in Photoshop) and hand us a picture of what some of the pages on a site are supposed to look like.  It is then our job to translate that picture into a website.

Advantages (at least from my perspective):

We get to keep a separation of concerns (designers make it look pretty, I make it work technically)

The designers don't have to know html / css so much

I don't inherit any "special" html / css / javascript from someone else.  If I want "special" code, I can make it myself (I'm not saying that designers aren't necessarily incapable of writing good html, etc. , just that generally they do not approach the problem with the same perspective and goals as a programmer.)

Disadvantages / More work for developers

Sometimes this leads to the developers having to come up with interesting (some good, some not) solutions to do what the designers have invented.

Sometimes we just have to tell the designers that their idea just isn't going to happen.  This puts the burden on us to explain why it doesn't work and to suggest alternatives.

We have to treat the designers like clients sometimes and work with them to make sure that their vision of the website and what we make are the same or close enough (ie. UI functionality like color changes on mouse hover).

I like this approach because I don't have to come up with good / pretty designs.  I get to take a nice design and translate it to something that isn't going to be a technical disaster for the developers to maintain.

TL/DR: Developers do the technical stuff, designers make pretty pictures


答:
Is it unreasonable to have designers understand the mechanics of how
  master pages and user controls work, and in general how ASP.NET puts a
  page together?

Yes, it is, beyond general conceptualization.

Your application should have sufficient separation of concerns so that the designers don't have to think about the way your website works (the underlying mechanics) in order to produce a classy, effective design.  They do need to know what you want (via a story board or similar communicative device), and it's very good if they know CSS and HTML, but the actual website machinery is the responsibility of the developer.

The corrolary is that you should leave design work to designers.  Graphic design and layout is pretty much a completely different skill set than programming.  As a programmer, you do have to know something about human factors (i.e. what constitutes an effective user interface), but in general the use of color, style and such things should be left to the designer.

Note: Your integration work would go much easier if you were using ASP.NET MVC instead of ASP.NET; less shoe-horning would be required, and you could use your designer's templates as-is, with much less hacking.  ASP.NET MVC is better suited for doing this sort of thing, because you don't have to fit your templates into ASP.NET's world view.

Title: What workflow do you use with asp.net web forms development and your design department

Body:
I work at a place that has a clear separation between designers and developers.  We're a fairly new start-up and we're trying to figure out what would be the best workflow for our team.  We're a small company with a total of about 11 employees, three of which are designers (they deal with the HTML, CSS, some jQuery), and three developers primarily working with ASP.NET Web Forms. I am one of the developers and don't have a knack for design, but I am comfortable enough with CSS and jquery/Javascript to understand the mechanics and whatnot.

So, currently we wait for the designers to provide us with HTML structure clobbered together with server-side includes, js, jquery, css, etc.

Typically we try to work around their stuff and begrudgingly try to keep their structure roughly the same with the consequence of forcing us to have a lot of hacks in place to work with it.  Yes, this means using their Server-Side Includes mixed in with our .aspx pages, amongst other things that seem to go against the general asp.net web forms flow.

There have been times when I have changed the includes into a user control and had their common HTML out in master pages, etc. All of which was consequently followed by a lot of barking from the design team.  Their main complaint being that master pages and user controls make their maintenance of the site more difficult.

I can see their point of view, and I wouldn't like it either if people messed with my workflow either, which I guess I am doing so with them.

I have tried several times to approach them about moving site structure that complements the asp.net web forms environment we programmers are working with, but every time the subject of working with master pages comes up, the design team throws a near tantrum.

Our current approach is simply forcing us to put together a lot of hacks and work-arounds so that it gels with their design and frankly it's getting frustrating and just adding more unnecessary technical dept to our projects.

My question is simply this: what workflow works best for you and your design team?

Do your designers know how to use master pages, etc.

Is it unreasonable to have designers understand the mechanics of how master pages and user controls work, and in general how ASP.NET puts a page together?  (I don't feel this is an unreasonable expectation of them...)

So, what do you guys think?


答:
First, a company that doesn't understand the old adage You have to spend money to make money is a company that doesn't deserve to be in business; speaking from experience working at a horrible tiny company that wouldn't pay any money for anything, no matter how much it would help, this is incredibly short-sighted and indicative of a management issue at the very core.

To directly answer your question, there are legal ways around this depending on what you're talking about.  For development, you can either use open-source technologies (lots of free IDEs, Databases, pretty much anything for PHP, Java, Python, Ruby and their friends) or make due with the Visual Studio Express editions (not an ideal solution but they work well enough).

If it's something that has no open-source alternative or "limited" trial, then see the first point.  If it's something you need to run your business, then buck up and buy it, or re-evaluate if you really do need whatever requires that software to begin with.  Management/Founders often think they need things that they really don't because they either read about it, somebody mentioned it or they're trying to ride a bandwagon, but if you're unwilling to play by the rules then, quite frankly, you shouldn't be allowed to play at all.

Title: Small companies and software licensing


答:
Whoa. You're changing how you build your house to make it easier on the interior decorators? You need to get your designers out of your development workflow and into their own workflow.

Design is not Development

Leave the designers to do what they do best, which is design. If you have a designer telling you how your application should be structured internally then there is a serious problem. Master pages and user controls are near necessities when building an ASP.NET web site, and you should never have somebody who's wielding the HTML and CSS paintbrush telling you How All That's Gonna Work. They have their own incredibly difficult world to deal with.

Push the designers away, and let them have their own ball game. They want to work in Visual Studio? Fine, hook them up to a separate repository and you pull down the pages you need when you need them.

They have filler data now, because you won't let them touch the real application? Leave it in there until you have real data to replace it with. It isn't hurting anything, and they were probably handing you filler data anyway.

They're using Server-Side-Includes? That's not uncommon - a lot of web designers do this - just look through their HTML and replace it with a user control when you're implementing the that part of the application. Once. You're done. The site works the way it needs to, and the designers still have their own repository using SSI so that they can get their own work done.


问:
Standard/Proper way of counting lines of code?
How should I count the lines of code in a project?

In C++ for example, should I count the lines of the header files with my class definition? Should I count the header of a (non standard) library I am linking against?

In Qt (or any other GUI framework), should I count the lines of the form's design?

Should I count the Makefile too?

I ask because it is a simple way to measure the size of the project and/or effort involved. Even though a GUI file is not code per se the programmer might have spent hours doing it.

EDIT Most of you did not understand the question and/or are assuming that I want to use the magical number of LOC as the ONE AND ONLY metric to rate a project or even a day of work.

I consider a negative LOC day a very nice day. It means I've somehow managed to understand and model the problem better and more efficiently. Comments like "Why do you need this" are not interesting.

Like it or not, the number is out there, Wikipedia says Windows XP is rated at 45M LOC, Linux 2.6.35 at 13.5M, I could go on.

Maybe I could have asked better.

Anyway, my original intent was to know how those numbers in Wikipedia were calculated and not the subjective nature of them.

I found this in a MSDN blog, very useful as it shows how VS2008 does it:

答:
Not sure if this qualifies as an answer, but I think the way you count lines of code should depend on the language used. And maybe you should think of using an alternative measurement, like the percentage of project requirements satisfied.

I worked on a perl project several years ago, and as I added features the code line count actually went down because of code reuse and other factors. So the project at 50% complete actually had more lines of source code than the project at 100% complete.

Perhaps you should count the total lines of code written, and so the count would always go up, because even when you refactor code, and perhaps reduce the line count, you are creating new lines of code to replace the old ones.


问:
What is the relationship between the Dynamic Language Runtime and  C# 4.0?
Let's say I wanted to create a dynamic language compiler/interpreter, a Scheme interpreter perhaps, on the .NET platform as it exists today.  Would I be better off using the Dynamic Language Runtime (DLR), or using C# 4.0 to implement my language's dynamic features? Or do I need both?

I know that there has been other work done in this area, in particular with IronScheme and IronPython.  Both of those languages use the DLR; I believe IronPython uses the most current version of the DLR (which is about a year old), while IronScheme uses an early, heavily modified fork of an early version of the DLR.  But C# 4.0 was not available when these compilers were created.

I've seen Rob Conery's work with Massive, using C# 4.0's dynamic features; it is quite impressive.  But would C# hold up to the full-scale effort of a dynamic language compiler/intepreter?  Are there features in the DLR that are missing from C#, or was the DLR essentially rolled into C# 4.0?  Would I be missing any important features of the DLR if I just used C# 4.0 exclusively?

答:
This is the article I remember reading. msdn.microsoft.com/en-us/magazine/gg598922.aspx

Later the DLR was also included in the .NET Framework 4 to support
  dynamic features in C# and Visual Basic. If you only need the dynamic
  keyword in C# 4, you can simply use the .NET Framework and in most
  cases it will handle all interactions with the DLR on its own. But if
  you want to implement or port a new dynamic language to .NET, you may
  benefit from the extra helper classes in the open source project,
  which has more features and services for language implementers.


答:
From: jimmysch

Robert,

The facts: IronRuby and IronPython both use the DLR, in fact most of
the DLR's features are derived from earlier implementation of
IronPython. I'm not familiar with how what version of the DLR
IronScheme uses. A portion of the DLR (Microsoft.Scripting.Core.dll)
was shipped in .NET 4.0 in System.Core.dll, and that portion is what
C# 4.0 uses for it's "dynamic" keyword support, which is why that
assembly is not present in .NET 4.0 builds of the DLR.

The rest of the
DLR's codebase (Microsoft.Scripting.dll, Microsoft.Dynamic.dll are the
most important) are available for download from this CodePlex project,
or the IronLanguages GitHub project. They provide the APIs for
consumers and producers of hosting languages, while the APIs in .NET
4.0 are for actually doing dynamic dispatch of methods.

To write a dynamic language compiler for .NET 4.0, I'd use C# as the
implementation language and use the DLR as a library for simplifying
common compiler tasks. For a simple example language on the DLR, look
at Sympl.

~Jimmy

http://dlr.codeplex.com/discussions/268746#post656778

Title: What is the relationship between the Dynamic Language Runtime and  C# 4.0?

Body:
Let's say I wanted to create a dynamic language compiler/interpreter, a Scheme interpreter perhaps, on the .NET platform as it exists today.  Would I be better off using the Dynamic Language Runtime (DLR), or using C# 4.0 to implement my language's dynamic features? Or do I need both?

I know that there has been other work done in this area, in particular with IronScheme and IronPython.  Both of those languages use the DLR; I believe IronPython uses the most current version of the DLR (which is about a year old), while IronScheme uses an early, heavily modified fork of an early version of the DLR.  But C# 4.0 was not available when these compilers were created.

I've seen Rob Conery's work with Massive, using C# 4.0's dynamic features; it is quite impressive.  But would C# hold up to the full-scale effort of a dynamic language compiler/intepreter?  Are there features in the DLR that are missing from C#, or was the DLR essentially rolled into C# 4.0?  Would I be missing any important features of the DLR if I just used C# 4.0 exclusively?


答:
The best example I know of is actors on a stage in a play - it also helps you avoid ending up in the inheritance tar pit.

Say we have the play Julius Caesar from William Shakespeare. You could implement it with a bunch of Actor classes, from which e.g. the Calpurnia class is derived. You could have multiple Calpurnia classes (say for different actresses knowing the role of Calpurnia, each with different strength an weaknesses, but all of them able to play - more or less - properly their role).

When during a play of Julius Caesar Calpurnia says the line:

What mean you, Caesar? think you to walk forth?
  You shall not stir out of your house to-day.

The instance of the Calpurnia class (= object) sends a message (= calls a method on) an instance of the Julius Caesar class. Which reacts according to the script (= algorithm implemented in the called method) with the line:

The things that threaten'd me ne'er look'd but on my back; when they shall see
  The face of Caesar, they are vanished.

The instance of the Calpurnia class though has no idea how the Caesar object creates this answer (= encapsulation) and everyone is perfectly aware, that this is not the real Julius Caesar (or Calpurnia) standing on the stage, but actors representing reasonably romanticized versions of the historic persons (= abstraction).

Another participating class in this scenario is the Spectator class. They make heavy use of the fact, that all roles belong to the Actor class and as such instances of them can be watched, listened too or applauded – or booed – irrespective of their concrete subclass (= polymorphism).

And of course there are thousands of different ways on how'd you be able to represent a play(house) in an object oriented fashion...


问:
Can static and dynamically typed languages be seen as different tools for different types of jobs?
Yes, similar questions have been asked but always with the aim of finding out 'which one is better.'

I'm asking because I came up as a dev primarily in JavaScript and don't really have any extensive experience writing in statically typed languages.

In spite of this I definitely see value in learning C for handling demanding operations at lower levels of code (which I assume has a lot to do with static vs dynamic at the compiler level), but what I'm trying to wrap my head around is whether there are specific project contexts (maybe certain types of dynamic data-intensive operations?) involving things other than performance where it makes a lot more sense to go with Java or C# vs. something like Python.

答: I currently program in static type languages (C# and F#), but I enjoy programming in dynamic languages (Smalltalk, Ruby). There are a lot of pros and cons that people associate with one type vs another that are more about the language than when you enforce types. For example, dynamic languages usually have a cleaner, more concise syntax, however F# and OCaml with their type inference system have as clean a syntax as any dynamic language. And with static typing, you have real automatic refactorings and autocomplete, but Smalltalk, with it's entire source code in a database and each method compiled separately, was the first language to really have serious automated refactorings, and it worked great. Ultimately, modern dynamic and static languages today are type safe, which is the most important aspect of your type system, and automatically testing for correctness is done by unit testing, which you'll be doing in both types of languages.</p>

OwnerDisplayName: Erik  Reppen

OwnerDisplayName: jbtule


答:
Software metrics are, generally, a fairly subjective wreck massively open to interpretation and reinterpretation. Probably the only really meaningful one to an outsider is defects filed per year per release.

Lines of code will vary between programmers, languages, commenting style, bracing style, corporations, and levels of experience.

Of course, the more you write, the more bugs have a chance to surface, so LoC growth is proportional to the potential number of bugs.

That said:

wc -l *.lisp

is how I count my LoC, and it serves as a rough metric of "how much work have I done".

Another way is churn, which is the # of added, removed, and modified lines over time in a codebase. That can be extracted from your version control system.


问:
One language to rule them all? (Them being platforms.)
I have been discussing a project with a client and they want to use a single language to deploy to as many platforms as possible.

(I am not sure that it's such a good idea, because each platform offers a different user experience and UI metaphor. In some cases, screen sizes vary as well. Also, iPhone is out of the running no matter what language we use. But, I digress...)

The project is going to display an arbitrary block of text each day and will track if the user has "read" it. Some other features on the table are "nags" and the ability to go to another days' text.

I know Flash from the CS3 days, and I think that translates into AIR, but I dont know if AIR can do what we want.

On the other hand, I have (a) little experience with Java or Python, but those seem like good contenders also.

Which language should I use here? Why?

Edit:

This is going to run on desktop platforms too.

答:
With .NET, Mono, GTK#, MonoTouch and Mono for Android you can reach the large majority of platforms with any .NET language and have a native looking UI on each.

.NET will get you

ASP.NET for the Web

Silverlight for the Web on Windows and Mac (Moonlight from Mono gets you on Linux too!)

Silverlight for Windows Phone 7

Mono with GTK# will get you

Mac OSX

Linux

Others perhaps, but less native looking.  I hear some have gotten on the Wii with Mono . . .

MonoTouch for the iPhone, iPad, etc.

MonoDroid for the Android

BlackBerry .NET - first I heard of it, but they say .NET on the BlackBerry, I am assuming with QT.

Can't think of any other major platforms you are missing there.  You?  Of course this points out frameworks that you can use to target all these platforms.  I'll let you choose the language.  C#, Oxygene or VB.NET are the most popular on .NET.  Oxygene (included in Delphi Prism) has the added benefit of being partially compatible with Delphi native for native Windows development, but if you want to use IronRuby or F# we won't stop you.


答:
Yes, definitely.

Dynamic typing has definite advantages in cases where you want to be able to treat everything as one single type.  Serialization/deserialization is one of the classic examples.  This is why so much Web programming is done in dynamically-typed scripting languages: they're well-suited to a task which involves a whole lot of converting all sorts of data to and from strings.

For application programming, on the other hand, static languages work much better because trying to treat everything as one single type is not frequently a requirement.  You often want to have efficient data structures with data represented as itself and not getting converted to other types very frequently.  This makes the features of dynamic typing a drawback instead of a benefit, which is why applications are almost exclusively written in statically typed languages.

Title: Can static and dynamically typed languages be seen as different tools for different types of jobs?

Body:
Yes, similar questions have been asked but always with the aim of finding out 'which one is better.'

I'm asking because I came up as a dev primarily in JavaScript and don't really have any extensive experience writing in statically typed languages.

In spite of this I definitely see value in learning C for handling demanding operations at lower levels of code (which I assume has a lot to do with static vs dynamic at the compiler level), but what I'm trying to wrap my head around is whether there are specific project contexts (maybe certain types of dynamic data-intensive operations?) involving things other than performance where it makes a lot more sense to go with Java or C# vs. something like Python.


问:
How far should I take email address validation when the cost of bad emails is high?
When it's more important to prevent typos than to cover 100% of all possible email addresses, what syntactic email validations do you do?

Imagine this:

You're with the local gas & electric company.  10% of new
  installations are cancelled because the customer is not home and it
  costs your company $50 a pop.  You start taking email addresses with
  the new install orders so that you can send reminder emails the day
  before the appointment.  You bring that number to 0% when you have a
  deliverable email.  The only problem is that 15% of all the emails
  you take bounce back because of some typo.  Email addresses are
  recorded by call center agents who talk to the customer over the
  phone.

In this case, it's important to collect a valid email address.  It's also not all that bad if someone cannot successfully use an email address like:

```<code>"Big Momma D.'s #1 CA$H Maker, BOY!!!"@naturalhistory.museum
</code>```

My guess is that Big Momma D. can't use this email anywhere and either doesn't really use email, or has more conventional email address to use.

This is related to this more general question:
How far should I take e-mail address validation?

Let's throw a few more assumptions on here:

This is in the US, so it's unlike people will have email addresses like 漢字@gmail.com (good luck communicating that to a call center agent in Austin, Texas)

Validation emails are not suitable, since the customer is only in contact with us by phone

答: You should simply test sending an email to the given address. If the email is valid, it should reach the user's inbox and the user can click on a link to validate the email and continue registration. If the user did not receive the registration email, then they would notice that they typed something wrong. This procedure is pretty much standard nowadays.</p>


答:
Having a pet application is a great way to force yourself to learn parts of your current platform that you may not have thought about. For example, you might be a great C# developer working on an ASP.Net application at work. But if you have a guy on your team dedicated to CSS, you might not ever learn it properly. However, if you have a pet web project, you will have to learn how to do CSS. This is true for a whole host of technologies that you will run into if you have your own project where you are the sole developer.

For a great write up on all the benifits of pet applications, check out this post.

Title: Importance of hobby projects


答:
First of all, I'd run it through the most basic of regexs for validity.  You can find several options, all with their own problems and features at: http://www.regular-expressions.info/email.html.  (There's an ugly one down the page that implements RFC 822)

However, what you have here is a business problem, not a computing problem.  The solution is simple:  "Your appointment for installation is XXXXXX.  Should you miss this appointment without contacting us, you will be billed $50.00, and will have to reschedule."

Title: How far should I take email address validation when the cost of bad emails is high?

Body:
When it's more important to prevent typos than to cover 100% of all possible email addresses, what syntactic email validations do you do?

Imagine this:

You're with the local gas & electric company.  10% of new
  installations are cancelled because the customer is not home and it
  costs your company $50 a pop.  You start taking email addresses with
  the new install orders so that you can send reminder emails the day
  before the appointment.  You bring that number to 0% when you have a
  deliverable email.  The only problem is that 15% of all the emails
  you take bounce back because of some typo.  Email addresses are
  recorded by call center agents who talk to the customer over the
  phone.

In this case, it's important to collect a valid email address.  It's also not all that bad if someone cannot successfully use an email address like:

```<code>"Big Momma D.'s #1 CA$H Maker, BOY!!!"@naturalhistory.museum
</code>```

My guess is that Big Momma D. can't use this email anywhere and either doesn't really use email, or has more conventional email address to use.

This is related to this more general question:
How far should I take e-mail address validation?

Let's throw a few more assumptions on here:

This is in the US, so it's unlike people will have email addresses like 漢字@gmail.com (good luck communicating that to a call center agent in Austin, Texas)

Validation emails are not suitable, since the customer is only in contact with us by phone


答:
Nothing is 100%. One day the email server is up. The next it is down. Person used their cable company email and when they moved, no more email. How can you catch jan@someemailserver.com when it should be jan? Oh, the customer service person would catch this since she's speaking to a female and assumes it's jan instead. Only problem is this is the husband's email; he's the one who's going to be at the house.

You should consider a text message.

Or have phone call reminders go out the day before. And then the service tech calls when they are leaving for the call.

Trust me. I just moved and had every service and delivery you can think of: furniture, cable, alarm system, water softener. They all call ahead.

And that 15% failure is attributed to bad email address and not a failure to be home?


答:
The way I look at it is, if you can work naturally within a statically typed language, then static typing is the way to go. In general, the purpose of a type system is to prevent you from performing operations with undefined semantics - like (string) "hello" + (bool) true. Having the extra level of safety preventing you from performing these operations can be a good way to prevent bugs in your code, even without extensive unit tests. That is, type-safety provides another level of confidence in the semantic correctness of your code.

But type systems are very hard to get right. I don't believe there is a perfect type system in nature at the time of this writing. (By "perfect type system", I mean a strict type system, that doesn't require verbose code annotations, that generates no false-positive type errors, and whose type errors are easy for the programmer to understand.) Further, it can be difficult to understand the really good type systems that do exist. When I was learning Haskell, I can't tell you the number of obscure type errors that I got while attempting to write what looked (to me) like correct code. Usually the code wasn't actually correct (which is a point in favor of the type system), but it took a lot of work to understand the error messages from the compiler, so that I could correct the underlying problems. In OO languages, you may eventually find yourself thinking "this argument should be contravariant with the input type, not covariant!", or (more likely) reverting to typecasts to escape from the bounds of the type system. Type systems can get much trickier than you'd think.

For what it's worth, it's my understanding that the difficulty in coming up with good type systems is part of what motivated Gilad Bracha to include pluggable type-system support in Newspeak.


答:
Sorry, I can't resist the Dijkstra quote:

My point today is that, if we wish to count lines of code, we should
  not regard them as "lines produced" but as "lines spent": the current
  conventional wisdom is so foolish as to book that count on the wrong
  side of the ledger.

Look, if you really must count lines, just use wc -l, apply a fudge factor, and if anybody knows a better way, let them do it !