问:
Graduate expectations versus reality
When choosing what we want to study, and do with our careers and lives, we all have some expectations of what it is going to be like. Now that I've been in the industry for almost a decade, I've been reflecting a bit on what I thought (back when I was studying Computer Science) programming working life was going to be like, and how it's actually turning out to be.

My two biggest shocks (or should I say, broken expectations) by far are the sheer amount of maintenance work involved in software, and the overall lack of professionalism:

Maintenance: At uni, we were all told that the majority of software work is maintenance of existing systems. So I knew to expect this in the abstract. But I never imagined exactly how overwhelming this would turn out to be. Perhaps it's something I mentally glazed over, and hoped I'd be building cool new stuff from scratch a lot more. But it really is the case that most jobs are overwhelmingly maintenance, bug fixing, and support oriented.

Lack of professionalism: At uni, I always had the impression that commercial software work is very process-oriented and stringently engineered. I had images of ISO processes, reams of technical documentation, every feature and bug being strictly documented, and a generally professional environment. It came as a huge shock to realise that most software companies operate no differently to a team of students working on a large semester-long project. And I've worked in both the small agile hack shop, and the medium sized corporate enterprise. While I wouldn't say that it's always been outright "unprofessional", it definitely feels like the software industry (on the whole) is far from the strong engineering discipline that I expected it to be.

Has anyone else had similar experiences to this? What are the ways in which your expectations of what our profession would be like were different to the reality?

答:
Most of the work you do is not ground-breaking

When at Uni, I worked on AI routines to control soccer-playing robots, I built compilers and hacked on operating system kernels.

But in the real world, 99%* of software development is actually pretty boring. I've always admired architects or builders who, when asked "what do you do for a living?" can point to a building or whatever and say "I did that". But most software developers can't do that. When asked "what do you do for a living?" the closest to that that I've ever been able to come is when I used to work for a company which built software that processed SMS messages for radio stations and the like... I could say, "you know when you text in to a radio station to vote for a song, well I wrote the software that processes those votes and stuff." Still no where near as cool as being able to point to a building and saying "I built that."

Of course, there are people who can say "I worked on Windows" or whatever, but I'm sure they don't actually tell anybody that for fear of the very next question being "I can't get my printer to work, can you fix that for me?"

* and 62% of all statistics are made up on the spot

Title: Graduate expectations versus reality


问:
Does the syntax of programming languages depend upon their implementation?
Although, my question may be entirely irrelevant, but I have sensed a pattern between most programming languages and their official implementations.

Interpreted (byte-interpreted?) languages like Python , Lua etc. usually have an extremely lenient and easy syntax and are generally type-less or do not require the developer to explicitly write variable types in source code;

Compiled languages like C , C++ , Pascal etc. usually have a strict syntax, generally have types and mostly require more code / development time

Languages whose official implementations are JIT-Compiled like Java / C# usually are a unique compromise between the above two with some of the best features of both.

Some of the more modern compiled programming languages like D and Vala (and the GNU GJC implementation of Java) are perhaps an exception to this rule and resemble the Syntax and features of JIT-Compiled languages like Java and C#.

My first question is, is this really relevant? Or is this just a coincidence that most interpreted languages have easy syntax , JIT-Compiled ones have a moderate syntax and features etc.

Secondly, if this is not a coincidence, then why is it so? Like, for example, can some features only be implemented in a programming language if you are, say, JIT-Compiling it?

答:
There is no connection whatsoever between semantics and syntax. Homoiconic compiled languages like Scheme comes with a pretty minimalistic syntax. Low level compiled meta-languages like Forth are even simpler than that. Some very strictly typed compiled languages are built upon a trivial syntax (think ML, Haskell). OTOH, Python syntax is very heavyweight, in terms of a number of syntax rules.

And yes, typing has nothing to do with syntax, it's on the semantics side of a language, unless it's something as perverted as C++, where you cannot even parse without having all the typing information available.

A general trend is that languages that evolved for too long and did not contain any design safeguards against syntax deviations would sooner or later evolve into syntactic abominations.

ContentLicense: CC BY-SA 3.0


答: I think it's the other way around: implementation depends on syntax. For example, if your syntax allows for reflection, then the implementation must provide a runtime that supports that.</p>

Title: Does the syntax of programming languages depend upon their implementation?

Body:
Although, my question may be entirely irrelevant, but I have sensed a pattern between most programming languages and their official implementations.

Interpreted (byte-interpreted?) languages like Python , Lua etc. usually have an extremely lenient and easy syntax and are generally type-less or do not require the developer to explicitly write variable types in source code;

Compiled languages like C , C++ , Pascal etc. usually have a strict syntax, generally have types and mostly require more code / development time

Languages whose official implementations are JIT-Compiled like Java / C# usually are a unique compromise between the above two with some of the best features of both.

Some of the more modern compiled programming languages like D and Vala (and the GNU GJC implementation of Java) are perhaps an exception to this rule and resemble the Syntax and features of JIT-Compiled languages like Java and C#.

My first question is, is this really relevant? Or is this just a coincidence that most interpreted languages have easy syntax , JIT-Compiled ones have a moderate syntax and features etc.

Secondly, if this is not a coincidence, then why is it so? Like, for example, can some features only be implemented in a programming language if you are, say, JIT-Compiling it?


答:
I generally agree with quickly_now in that your observation is mainly a result of history. That said, the underlying reasoning boils down to something like this:

```<code>The more modern a language is, the more comfortable it should be to use.
</code>```

(Not a quote really, just my own formulation.)
When I write comfortable here, I refer to what you called best features of both. More precisely, I do not want to speak for or against static/dynamic typing or strict/lenient syntax. Instead, it is important to see the focus being placed on developers and increasing their comfort-level when working with the language.

Here are some reasons, that have not been mentioned in previous answers, which may provide you with some ideas for why you observe these things (and are all sort of based on the history of programming lanugage development) :

We have hundreds of programming lanugages these days. When a new one comes up, how can it find a broad audience? This is the main reason, why new languages always try to increase the developers' comfort-level. If the language can do the same as an older one, but can do it much easier/simpler/more elegant/etc. you may want to consider actually switching.

Learning curve goes hand in hand with that. In the past, we had few languages and investing time to learn one was worth it. Even if that meant investing a lot of time. Comfort is again increased, if you come up with a language that developers can learn very quickly. Complexity of any kind (f.ex., complicated involved syntax) are detrimental to this, and hence, are reduced more and more in newer languages.

Technological advances (a direct historical reason here) are responsible that compiler builders can now place more focus on developer comfort. In the early days, we were happy to be able to build a compiler at all. However, that often implied heavy restrictions being made. As the technological know-how increased, we were able to lift these restrictions again.

So in general, programming languages and compilers have seen a development similar to that of typical end-user applications:

Initial stage: It's a cool thing to have, but the bleeding edge technology barely makes it work at the cost of comfort/useability/what-not.

Technological improvement: We can build these things more robustly, faster, and easier.

Focus turns to the user: Similarly to the Web2.0 movement focusing on user experience, new programming languages focus on the developer perspective.

Body:
I generally agree with quickly_now in that your observation is mainly a result of history. That said, the underlying reasoning boils down to something like this:

The more modern a language is, the more comfortable it should be to use.

(Not a quote really, just my own formulation.)
When I write comfortable here, I refer to what you called best features of both. More precisely, I do not want to speak for or against static/dynamic typing or strict/lenient syntax. Instead, it is important to see the focus being placed on developers and increasing their comfort-level when working with the language.

Here are some reasons, that have not been mentioned in previous answers, which may provide you with some ideas for why you observe these things (and are all sort of based on the history of programming lanugage development) :

We have hundreds of programming lanugages these days. When a new one comes up, how can it find a broad audience? This is the main reason, why new languages always try to increase the developers' comfort-level. If the language can do the same as an older one, but can do it much easier/simpler/more elegant/etc. you may want to consider actually switching.

Learning curve goes hand in hand with that. In the past, we had few languages and investing time to learn one was worth it. Even if that meant investing a lot of time. Comfort is again increased, if you come up with a language that developers can learn very quickly. Complexity of any kind (f.ex., complicated involved syntax) are detrimental to this, and hence, are reduced more and more in newer languages.

Technological advances (a direct historical reason here) are responsible that compiler builders can now place more focus on developer comfort. In the early days, we were happy to be able to build a compiler at all. However, that often implied heavy restrictions being made. As the technological know-how increased, we were able to lift these restrictions again.

So in general, programming languages and compilers have seen a development similar to that of typical end-user applications:

Initial stage: It's a cool thing to have, but the bleeding edge technology barely makes it work at the cost of comfort/useability/what-not.

Technological improvement: We can build these things more robustly, faster, and easier.

Focus turns to the user: Similarly to the Web2.0 movement focusing on user experience, new programming languages focus on the developer perspective.


问:
Comparison of IDEs for C++ and C development on Linux: KDevelop, Eclipse, NetBeans, CodeBlocks and Anjuta
I'd like to note your experience of full scale IDEs on Linux.

I personally work mostly with vim, however other programmers would like
to see a real IDE. So I'd like to hear your personal opinion about different
IDEs and comparison between them, in following context:

C++ and maybe some C development (not Java, Python and other stuff)

Server side programming (no need for GUI development)

Working on Linux not "cross-platform" development.

Opinion needed regard:

How stable is it? If IDE crashes I don't need it.

Comfortable to use.

Powerful for debugging.

Integration with various build systems

Scalability over huge projects (projects of hundreds thousands of lines of code)

I used to work with KDevelop and it was very nice IDE and seems that KDevelop 4 is a huge progress. It seems also that many rather use Netbeans and Eclipse.

答:
So... I just add another opinion but I don't think you can chose it as a vim user, so

emacs + gdb http://www.cs.bu.edu/teaching/tool/emacs/programming/

first of all that will be lightest IDE (I even can call it operating system) and most customizable so you can do everything with minimum resources usage except some lisp configuration brainwork resources.

Personally when I have a serious project I'm using Visual Studio. But when I need to work on linux I run emacs. (also I don't like qt at all)

Also (mostly because I like last.fm plugin and clojure support there) I found an nice IDE for linux (still tryeng to switch to emacs from it ==' for some reasons) IDEA, not I recommend to use it for C++ but maybe it's not bad too so you can add it to your list.


问:
Why do we need method level security?
In the real world , why do we need to implement method level security ?

We either have a web application or a desktop application , where the user accesses the user interface (and therefore directly cannot access the method) .

So where does accessing methods directly come into picture here ?

edit : I ask this question because I am experimenting with spring security , and I see authorizing users for accessing methods .

something like :

```<code> @ROLE_ADMIN
public void update() {
      //update
}
</code>```

答:
Mike Wiesner reminded in this SpringSource presentation, Introduction to Spring Security 3/3.1, brought the example that Tomcat, and many other Servlets containers had a bug that failed to properly recognize "../", when encoded in unicode, in a way that a simple equals test would fail in Java, but would translate to the upper directory in the filesystem.

Security is hard, multiple levels of security, will improve the chances to block circumvention attempts. Since method level security is directly coded inside the class, after the AOP augmentation, when you call the method, you'll always call the security check before.

ContentLicense: CC BY-SA 2.5

Title: Why do we need method level security?


问:
Will Java still be relevant in 5 years?
Will Java have the same importance it had in the past, or it will be less relevant than nowadays?</p>

答: Java the language may be in slow decline, but Java the platform (JVM + JDK) has definitely been booming during the last couple of years (Scala, Clojure and many other languages; Android framework). It's easily the best (only viable?) multi-architecture, multi-OS, multi-language platform out there, scaling from embedded mobile devices to mainframe enterprise, and there are no comparable rivals currently AFAIK. So I would expect Java the platform to be relevant in 5 years, and even in 15 years. That also makes Java the language relevant in the long term, even if its popularity may be past the peak.

Title: Will Java still be relevant in 5 years?


问:
What does a "bodyshop" (in context of a programming job /environment) mean
I've kept on coming across the term "bodyshop" in terms of a programming job/environment but despite googling I can't find out what exactly this is referring to? Can someone please enlighten me?</p>

答:
It means an employer that is not interested in improving the people they hire - a place that will not train people but expect them to train themselves on their own time.

These are places that are more interested in having the personnel so they can bill their clients per person (hence - body shop) than the actual quality and capabilities of the people.

In short, a body shop is a place that is more interested in billable hours than quality people.


答:
Basically it means a company that hires programmers only to lease them to clients on a per-hour basis. The programmer gets a steady salaray (lower, often much lower that what they'd get as a freelancer), possibly some benefits, and doesn't have to actively look for projects. The client has someone to go to if they have a position to fill but can't find anyone qualified and/or don't want to hire permanently.

Such companies usually call themselves consultancies, but the jobs usually are grunt work, often in legacy projects, with little chance for any actual consulting to happen.

The term also implies a company that has no interest in optimizing anything but the difference between the employee's salaries and the hourly rates paid by the clients.

Title: What does a "bodyshop" (in context of a programming job /environment) mean

Body: I've kept on coming across the term "bodyshop" in terms of a programming job/environment but despite googling I can't find out what exactly this is referring to? Can someone please enlighten me?</p>


问:
Entity Framework and layer separation
I'm trying to work a bit with Entity Framework and I got a question regarding the separation of layers.

I usually use the UI -> BLL -> DAL approach and I'm wondering how to use EF here.

My DAL would usually be something like

```<code>GetPerson(id)
{
    // some sql
    return new Person(...)
}
</code>```

BLL:

```<code>GetPerson(id)
{
    Return personDL.GetPerson(id)
}
</code>```

UI:

```<code>Person p = personBL.GetPerson(id)
</code>```

My question now is: since EF creates my model and DAL, is it a good idea to wrap EF inside my own DAL or is it just a waste of time?

If I don't need to wrap EF would I still place my Model.esmx inside its own class library or would it be fine to just place it inside my BLL and work some there?

I can't really see the reason to wrap EF inside my own DAL but I want to know what other people are doing.

So instead of having the above, I would leave out the DAL and just do:

BLL:

```<code>GetPerson(id)
{
    using (TestEntities context = new TestEntities())
    {
            var result = from p in context.Persons.Where(p => p.Id = id)
                    select p;
    }
}
</code>```

What to do?

答:
The example you provide is hardly layered architecture. I know it is intentionally simplified, but:

Your presentation layer is directly tied to the Person entity. This is OK only in simplest cases, and definitely not when you are trying to define your layers.

The GetPerson method is also using a rather bad practice of creating a new context for each call. You should get the context in the constructor, and it will be provided by your IOC container.

A simple, yet effective structure I have used is:

Project.Core - contains view models and interfaces.

Project.DAL - with my EDMX and generated code.

Project.BLL - business logic.

Project.Web - the web app itself.

It is important to note that:

Core is not dependent on any other solution.

DAL is not dependent on any other solution.

Project.Web depends on Core, but not on DAL nor BLL.

BLL depends on Core and DAL.

Title: Entity Framework and layer separation


问:
How to write a command interpreter/parser?
Problem: Run commands in the form of a string.

command example:

/user/files/ list all;
equivalent to:
/user/files/ ls -la;

another one:

post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;"

equivalent to:
    post -tf "HOW DO YOU STOP THE TICKLE MONSTER?;"

Current solution:

```<code>tokenize string(string, array);

switch(first item in array) {
    case "command":
        if ( argument1 > stuff) {
           // do the actual work;
        }
}
</code>```

The problems I see in this solution are:

No error checking other than nested ifs-else inside each case. The
script becomes very big and hard to mantain.

Commands and responses are hardcoded.

No way of knowing if flags are correct or missing parameters.

Lack of intelligence to suggest "you might wanted to run $command".

And the last thing I can't address is synonyms in different encodings, example:

```<code>case command:
case command_in_hebrew:
    do stuff;
break;
</code>```

The last one might be trivial, but well, what I want to see is the solid fundations of this kind of program.

I'm currently programming this in PHP but might do it in PERL.

答:
First, when it comes to grammar, or how to specify arguments, don't invent your own.  The GNU-style standard is already very popular and well known.

Second, since you're using an accepted standard, don't reinvent the wheel.  Use an existing library to do it for you.  If you use GNU style arguments, there is almost certainly a mature library in your language of choice already.  For example: c#, php, c.

A good option parsing library will even print formatted help on available options for you.

EDIT 12/27

It seems like you are making this out to be more complicated than it is.

When you look at a command line, it's really quite simple.  It's just options and arguments to those options.  There are very few complicating issues.  Option can have aliases. Arguments can be lists of arguments.

One problem with your question is that you haven't really specified any rules for what type of command line you'd like to deal with. I've suggested GNU standard, and your examples come close to that (though I don't really understand your first example with the path as the first item?).

If we're talking GNU, any single option can have only a long form and short form (single character) as aliases.  Any arguments containing a space have to be surrounded in quotes. Multiple short form options can be chained. Short form option(s) must be proceeded by a single dash, long form by two dashes.  Only the last of chained short form options can have an argument.

All very straightforward.  All very common.  Also been implemented in every language you can find, probably five times over.

Don't write it.  Use what's already written.

Unless you have something in mind other than standard command line arguments, just use one of the MANY already existing, tested libraries that do this.

What's the complication?


答: Not sure about JAVA. But surely the JVM will remain relevant supporting many other languages.</p>

Title: Will Java still be relevant in 5 years?

Body: Will Java have the same importance it had in the past, or it will be less relevant than nowadays?</p>


答:
You don't need to wrap your EDMX in anything.

If you can foresee a possibility of needing to change from EF to some other approach, you might want to extend your business objects (taking advantage of the partial classes) to implement interfaces defined in a separate Business Object layer.

Then from your code you will only deal with those interfaces and not with the concrete generated classes. A little glue code might be needed to hold this together; that with the EDMX can be your DAL.

Title: Entity Framework and layer separation

Body:
I'm trying to work a bit with Entity Framework and I got a question regarding the separation of layers.

I usually use the UI -> BLL -> DAL approach and I'm wondering how to use EF here.

My DAL would usually be something like

```<code>GetPerson(id)
{
    // some sql
    return new Person(...)
}
</code>```

BLL:

```<code>GetPerson(id)
{
    Return personDL.GetPerson(id)
}
</code>```

UI:

```<code>Person p = personBL.GetPerson(id)
</code>```

My question now is: since EF creates my model and DAL, is it a good idea to wrap EF inside my own DAL or is it just a waste of time?

If I don't need to wrap EF would I still place my Model.esmx inside its own class library or would it be fine to just place it inside my BLL and work some there?

I can't really see the reason to wrap EF inside my own DAL but I want to know what other people are doing.

So instead of having the above, I would leave out the DAL and just do:

BLL:

```<code>GetPerson(id)
{
    using (TestEntities context = new TestEntities())
    {
            var result = from p in context.Persons.Where(p => p.Id = id)
                    select p;
    }
}
</code>```

What to do?


答:
A given programming language may or may not expose or constrain enough semantic information for a compiler to deduce how to reduce it to executable code without added runtime decisions ("what type is this variable?", etc.)  Some languages are explicitly designed to make this constraint mandatory, or easy to determine.

As compilers get smarter, they might be able to guess or profile enough information to generate executable code for the most likely path(s) even for languages which were not explicitly designed to so expose or constrain those decisions.

However, languages where code (evalString()) can be created or entered at runtime (and other stuff that the compiler can't deduce or guess) may require an interpreter or JIT compiler to be available at runtime, even with attempts to pre-compile them.

In the past, a programming language and its implementation might have evolved so as to fit some hardware constraint, such as whether the interpreter might fit in 4k or 16k, or whether the compiler might finish in less than a minute of CPU time.  As machines get faster, it has become possible to (re)compile some formerly interpreted programs as fast as the programmer can hit the return key, or interpret formerly compiled program source code faster than slightly older hardware could run optimized compiled executables.


问:
Should I learn java for mobile application development or will C# just do?
I'm looking forward to delving into the .NET framework but most mobile applications seem to be developed in Java. I'll most probably be targeting the less pricier phones like Nokia and motorolla not android or iphone OS. Can I do these stuffs in C#?</p>

答:
Depends on the platform-

Android - JAVA, C#(via MonoDroid)

IPhone - Objective C, C#(via MonoTouch)

Windows Phone - C#(Silverlight)

Meego - C++(QT)

Symbian - C++, JAVA

I think Symbian is going to be dropped by most companies. Smart Phones are the future. And for every type of smart phone os, C#/mono will be available (you have to pay extra, but the usability worth it) along with the native platform language. So, you can go for C#.

The true platform independence may not be achieved, but if you use C# everywhere, you will be able to use same core libraries and tweak the UI for the platform.

But for low cost phones, C# will not do. You have to go for JAVA.

OwnerDisplayName: Alexander Suraphel


答:
Let me admit frankly, building parser is a tedious job and comes close to compiler technology but building one would turn out to be a good adventure. And a parser comes with interpreter. So you got to build both.

A quick introduction to parser and interpreters

This is not too technical. So experts don't fret at me.

When you feed some input into a terminal, the terminal splits the input into multiple units. The input is called expression and the multiple units are called tokens. These tokens can be operators or symbols. So if you enter 4+5 in a calculator, this expression gets split into three tokens 4,+,5. The plus is considered an operator while 4 and 5 symbols. This is passed to a program (consider this as an interpreter) which contains the definition for the operators. Based on the definition (in our case, add), it adds the two symbols and returns the result to the terminal. All compilers are based on this technology.
The program that splits an expression into multiple tokens is called a lexer and the program that converts these tokens into tags for further processing and execution is called parser.

Lex and Yacc are the canonical forms for building lexers and parsers based on BNF grammar under C and it is the recommended option. Most parsers are a clone of Lex and Yacc.

Steps in building a parser/intrepreter

Classify your tokens into symbols, operators and keywords (keywords are operators)

Build your grammar using the BNF form

Write parser functions for your operations

Compile it an run as a program

So in the above case your of addition tokens would be any digits and a plus sign with definition of what to do with the plus sign in the lexer

Notes and Tips

Choose a parser technique that evaluates from left to right LALR

Read this dragon book on Compilers to get a feel of it. I personally haven't finished the book

This link would give a super-fast insight into Lex and Yacc under Python

A simple approach

If you just need a simple parsing mechanism with limited functions, turn your requirement into a Regular Expression and just create a whole bunch of functions. To illustrate, assume a simple parser for the four arithmetic functions. So you would be the calling the operator first and then the list of functions (similar to lisp) in the style (+ 4 5) or (add [4,5]) then you could use a simple RegExp to get the list of operators and the symbols to be operated upon.

Most common cases could be easily solved by this approach. The downside is you can't have a lot of nested expressions with a clear syntax and you can't have easy higher order functions.

Title: How to write a command interpreter/parser?

Body:
Problem: Run commands in the form of a string.

command example:

/user/files/ list all;
equivalent to:
/user/files/ ls -la;

another one:

post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;"

equivalent to:
    post -tf "HOW DO YOU STOP THE TICKLE MONSTER?;"

Current solution:

```<code>tokenize string(string, array);

switch(first item in array) {
    case "command":
        if ( argument1 > stuff) {
           // do the actual work;
        }
}
</code>```

The problems I see in this solution are:

No error checking other than nested ifs-else inside each case. The
script becomes very big and hard to mantain.

Commands and responses are hardcoded.

No way of knowing if flags are correct or missing parameters.

Lack of intelligence to suggest "you might wanted to run $command".

And the last thing I can't address is synonyms in different encodings, example:

```<code>case command:
case command_in_hebrew:
    do stuff;
break;
</code>```

The last one might be trivial, but well, what I want to see is the solid fundations of this kind of program.

I'm currently programming this in PHP but might do it in PERL.


问:
How to get collaborators for an Android project?
How do I get people to want to collaborate on a project idea I have/actually contribute? I am a bit sensitive about my idea for a couple reasons:

I don't want people to take my idea.

I have gotten a couple people who wanted to help but then work/family/school stops them from having time and makes me less enthusiastic in the process.

For now it's actually ok because it has forced me to become familiar with PHP and servers and I have just been working on it on my own because I want to learn and its fun, but at some point I will need others to help in order to make it robust and ready to distribute.

How do I get collaborators when I will need them? I feel like I should start figuring that out now.

I have just been learning how to write software using mainly Stack Overflow, idiot guides and YouTube. Great to learn, but development is slow.

答:
The best way to get some help, even if it is part time to start a business venture with some people you know and trust and allow them to be vested in it.

Money is a motivator, however hiring programmers is not cheap.  I would advice against the many freelance programmer sites out on the web right now because the quality of work you receive is abysmal and many of those programmers are in other countries where even if they were to steal your idea, they are not in the same legal jurisdiction as you so suing them could be rather complicated.

If you feel the idea can make money then try to sell your peers on this and offer them a stake in a business venture.  In this way, you don't have to pay them to get started, and even if you don't particularly trust them, they generally wouldn't be inclined to steal your idea and go off on their own with it anyway.

The important thing is that just because it is your idea, and it is a good one doesn't entitle you to majority ownership.  Ideas are cheap, implementation is where the money is made.

Fully fund the venture, manage the business side of things, start an LLC and be involved with the development and you will earn at least 50% ownership stake even if the developer does almost all the implementation.

If you still have trouble finding interest then you need to start connecting with better people.  Consolidate your professional contacts on LinkedIn for a good way to keep in touch with old colleagues, and start going to developer conferences, most major cities have a technology council and most of those hold at least one developer conference every year.  Sit through a bunch of a boring vendor presentations and then meet and mingle afterwards.  That is the whole reason anybody goes to those things anyway... that and free t-shirts :)


问:
Do you find languages with indentation requirements cumbersome?
Thoughts on these?  Python is one example, and no this is not a stab against Python I like the language.

What languages have a indentation requirement?

答:
You ask for languages that enforce indentation. Python and make have been mentioned. Another one is the esoteric language whitespace.

FORTRAN has also been mentioned in other answers - early versions required that code start in specific columns (or beyond, so it's not precisely the same).

It is my understanding that Haskell also enforces indentation, according to this part of it's specification: "A nested context must be further indented than the enclosing context (n>m). If not, L fails, and the compiler should indicate a layout error."


答:
If you want to control your idea, then perhaps you need to think about the project from the architect's/project-manager's perspective.  Put together a draft design, then start writing story/feature descriptions.  Break the problem down into many simple manageable pieces, then ask for people to contribute to building a few elements without them needing to understand the overall design until you are in deep enough to maintain the creative control you desire. The pitfall of course is that people like to be involved in the projects they participate in, and you lose the opportunity to get valuable advice from your colleagues.

If your goal is to make money out of this idea, you need to think about whether the idea in and of itself will satisfy that requirement, or if there is an ancillary source of revenue related to the idea you wish to pursue. Each option allows you to provide a different incentive or motivation to anyone interested in joining your project.  And regardless, you'll still need to plan out how you want to do things when you bring others on board.

If money isn't the object, then it won't matter who you get to help, because trust would be the greater issue.  Of course if you know someone you absolutely trust who will be willing to join you in your venture, then perhaps a business partnership would be a better way to approach this.

At some point, if you wish to have others involved in your project, you are going to need to actually let them in on your idea.  As to when in the process that is, that really comes down to your own comfort level in that regard, and as such, the strategy you implement to allow you to develop your idea will be influenced by the level of trust you are willing to give to your colleagues.

If you decide that an open-source, or a similar closed-source/open-development model will work for you, then you'll want to build a community around your idea, and allow the community enthusiasm for the project to drive things forward. Defining a project on a website such as GitHub, or SourceForge would allow you to state clearly that you are the source of the idea and the project leader, while still allowing you to invite others to be contributors to your project.  In all cases however, unless you have a lot of money to burn, I'd avoid using contractors as they won't have any emotional investment in your project, and will likely provide you with a result that will leave you feeling as if you should have simply done it yourself.

Good luck with your venture! :-)

Title: How to get collaborators for an Android project?

Body:
How do I get people to want to collaborate on a project idea I have/actually contribute? I am a bit sensitive about my idea for a couple reasons:

I don't want people to take my idea.

I have gotten a couple people who wanted to help but then work/family/school stops them from having time and makes me less enthusiastic in the process.

For now it's actually ok because it has forced me to become familiar with PHP and servers and I have just been working on it on my own because I want to learn and its fun, but at some point I will need others to help in order to make it robust and ready to distribute.

How do I get collaborators when I will need them? I feel like I should start figuring that out now.

I have just been learning how to write software using mainly Stack Overflow, idiot guides and YouTube. Great to learn, but development is slow.


问:
are there any tools to convert general purpose XML to HTML?
I don't know how to say... The XIB is using xml to store the UIElement information, similar to .Net GUI. Is there any open source stuff also convert the xml file to a html layout?</p>

答:
Look at XSLT - its main use it to transform one XML dialect to another (in this case, you would output to HTML/XHTML).

Update:

Since the OP believes this is not a popular option, here is a link to the standard on the W3 consortium website.


答:
Since there is no way for a general purpose tool to know how to translate arbitrary XML into HTML, you will have to either do some coding or write some translation rules of some sort. </p>

<p>As mentioned in another answer, XSLT is more-or-less the standard tool for this job. Another option is to use a SAX parser to parse your XML using a familiar language, which you can use to translate each tag to the appropriate HTML tag. Many modern languages come with a SAX parser built in, so you may be able to do this with a language you are already familiar with. </p>

Title: are there any tools to convert general purpose XML to HTML?

Body: I don't know how to say... The XIB is using xml to store the UIElement information, similar to .Net GUI. Is there any open source stuff also convert the xml file to a html layout?</p>

Body:
Since there is no way for a general purpose tool to know how to translate arbitrary XML into HTML, you will have to either do some coding or write some translation rules of some sort.

As mentioned in another answer, XSLT is more-or-less the standard tool for this job. Another option is to use a SAX parser to parse your XML using a familiar language, which you can use to translate each tag to the appropriate HTML tag. Many modern languages come with a SAX parser built in, so you may be able to do this with a language you are already familiar with.


问:
Using SVN poorly - is Mercurial the answer?
At work we use SVN, but in name only.  We don't branch or merge.  We keep two copies of the repository, one serving as the "tag" branch that gets copied when we do a deployment and kept for bug fixes and immediate "this has to go live asap" type of features.  We have to remember to copy changes made in one copy to the other copy (the "trunk").  We have a dozen projects inside a single folder in the repository, instead of splitting them out.  In short about the only thing we use SVN for is being able to commit.  Everything else is done manually.

I've been evaluating Mercurial; I have used Git in the past (I'm the only one on the team who has used a DVCS), and I'm picking up Mercurial quickly.  I'm debating introducing Mercurial to the rest of the team as a "better way" of doing things because branching is a snap, merging is a lot easier, and we can commit things locally to our heart's content and only push them to the central branch when they're ready.  We would get all of the benefits of SVN (and we aren't getting many benefits right now anyway since nobody really understands SVN) plus for new features we don't have to have tons of unversioned files floating about so if we have to rollback we're screwed.  The workflow seems a bit simpler - we just have to remember that "Commit" is local and "Push" is like SVN's commit, and "Pull" is like SVN's Update (what the team refers to as "get latest").

Is this a good approach to take?  Keep in mind that the team is very flexible and will go along with anything that will improve our quality of work and make how we do things easier - the CIO even asked me when I mentioned how we weren't using SVN to it's potential "Is there something better we can use?" so he's on board with it too.

答:
No. Technology rarely solves this kind of problem.

Mercurial is more complex than Subversion (yes, branching and merging is better, and perhaps easier, but Subversion's model is much simpler than Mercurial's). If you are using Subversion in such a braindead way, you might end up using Mercurial:

a) Adequately or better

b) Inadequately, but better than your current usage of Subversion

c) As inadequately as now

d) Worse than now

c) and d) sound like the most likely outcomes. Write down why you think you'll end up in a) or b).


答: I can't speak to how large teams work, but for small teams a lot of those big SVN issues aren't really SVN issues...  They're development issues.  If you're not following modern development standards (most importantly, doing continuous integration), then versioning turns into the exact mess you're describing...  Before leaping to a new system be sure to perform a true root cause analysis on your issue...</p>

Title: Using SVN poorly - is Mercurial the answer?

Body:
At work we use SVN, but in name only.  We don't branch or merge.  We keep two copies of the repository, one serving as the "tag" branch that gets copied when we do a deployment and kept for bug fixes and immediate "this has to go live asap" type of features.  We have to remember to copy changes made in one copy to the other copy (the "trunk").  We have a dozen projects inside a single folder in the repository, instead of splitting them out.  In short about the only thing we use SVN for is being able to commit.  Everything else is done manually.

I've been evaluating Mercurial; I have used Git in the past (I'm the only one on the team who has used a DVCS), and I'm picking up Mercurial quickly.  I'm debating introducing Mercurial to the rest of the team as a "better way" of doing things because branching is a snap, merging is a lot easier, and we can commit things locally to our heart's content and only push them to the central branch when they're ready.  We would get all of the benefits of SVN (and we aren't getting many benefits right now anyway since nobody really understands SVN) plus for new features we don't have to have tons of unversioned files floating about so if we have to rollback we're screwed.  The workflow seems a bit simpler - we just have to remember that "Commit" is local and "Push" is like SVN's commit, and "Pull" is like SVN's Update (what the team refers to as "get latest").

Is this a good approach to take?  Keep in mind that the team is very flexible and will go along with anything that will improve our quality of work and make how we do things easier - the CIO even asked me when I mentioned how we weren't using SVN to it's potential "Is there something better we can use?" so he's on board with it too.


问:
Datetime vs Timestamp in MySQL and PHP in practice?
I am not sure how to specify my datatype as datetime or timestamp, I think I will need both of them but on the different events. My website sells products and services worldwide and also have an account system for user to login. Please clarify the following:

Current date and time customer buys products from my website: Datetime?

Delivery date and time based on their location and date/time purchased, calculated from our system: Datetime?

Last time they logged-in on their account: Timestamp?

What is the code in php to store purchasing date (current date) and then store in the database?

Please elaborate how to use each of them as after reading plenty of explanation on the internet, I still don't quite get it.

答:
Well I look at this in very simple way. In your case i would use both datetime and timestamp. With using both you will not have any additional problems with storing data or something like that. One additional field (column) in your table is also not a big problem.

So in my point of view and experiences so far I usually use both. When you want to show a date to your visitor or make it understandable to visitors then display a date in datetime format.

Datetime format could be a pain when you want to calculate something (difference between 2 dates, get yesterday's date from current date, get 1 week ago from current date, get tomorrow date or something like that.) It's not really hard but you will usually need to convert them in timestamp and then do the stuff. And yes current datetime for example you get with: $current = date("Y-m-d"); or $current = date("Y-m-d H:i:s"); if you also want hours, minutes and seconds.

Timestamp is just a number 11 digit long which doesn't really "mean" anything. When you look at it you will not know which date it represent. So it's not really user friendly and you can't use it to just echo it and show it to your visitors for example. You will need to "transform" it into something readable. But it's also offers you an ability to easily convert it, and to calculate different dates. For example if you want to get timestamp for tomorrow at the same time you just add number of seconds to current date and you have tomorrow time stamp. Example: $tomorrow = time()+24*3600; You can also easily get a difference between two dates in seconds or anything like that.

So i would suggest to use both datetime and timestamp. Even if you use for example PhpMyadmin and want to quickly look at some data it will be easier for you when you see a date in date time format (example: 2011-12-20 10:15:20) as it will be if you just look at the 11digit number. So use both and then call and use the one which suits you better.

If you must or want to choose just one I would suggest timestamp otherwise use both.


问:
Why disallow int-to-short assignment but allow multiplication and other math?
In Java, the following code does not compile:

```<code>int val = 1;
short shortVal = val;  // Incompatible types
</code>```

Anyone know why Java chooses to complain about this assignment, instead of simply truncating, when an integer × integer is also likely to overflow?

To illustrate:

```<code>int val = 46340;
int result = val * val;                    // 2147395600
System.out.println(result);
int overflowVal = 46341;
int result2 = overflowVal * overflowVal;   // -2147479015
System.out.println("Quietly overflowed: " + result2);
</code>```

答:
It'd be weird if int * int = long.  Internally, that's exactly what (x86) processors do anyways, but it would make for some rather interesting programming challenges.  Occasional overflow is easier to handle than auto-recasting everytime you do an operation!

So, in short, int to short is prevented because it's easy to prevent.  Int/int overflow is allowed rather than upcasting because upcasting would bring about even more ugliness.  Looks like a design decision based on the lesser of multiple evils.


问:
Best design for Windows forms that will share common functionality
In the past, I have used inheritance to allow the extension of Windows forms in my application. If all of my forms would have common controls, artwork, and functionality, I would create a base form implementing the common controls and functionality and then allow other controls to inherit from that base form. However, I have run into a few problems with that design.

Controls can only be in one container at a time, so any static controls you have will be tricky. For example: Suppose you had a base form called BaseForm which contained a TreeView which you make protected and static so that all of the other (derived) instances  of this class can modify and display the same TreeView. This would not work for multiple classes inheriting from BaseForm, because that TreeView can only be in one container at a time. It would likely be on the last form initialized. Though every instance could edit the control, it would only display in one at a given time. Of course, there are work-arounds, but they are all ugly. (This seems to be a really bad design to me. Why can't multiple containers store pointers to the same object? Anyhow, it is what it is.)

State between forms, that is, button states, label text, etc., I have to use global variables for and reset the states on Load.

This isn't really supported by Visual Studio's designer very well.

Is there a better, yet still easily maintainable design to use? Or is form inheritance still the best approach?

Update
I went from looking at MVC to MVP to the Observer Pattern to the Event Pattern. Here is what I am thinking for the moment, please critique:

My BaseForm class will only contain the controls, and events connected to those controls. All events that need any sort of logic to handle them will pass immediately to the BaseFormPresenter class. This class will handle the data from the UI, perform any logical operations, and then update the BaseFormModel. The Model will expose events, which will fire upon state changes, to the Presenter class, which it will subscribe (or observe) to. When the Presenter receives the event notification, it will perform any logic, and then the Presenter will modify the View accordingly.

There will only be one of each Model class in memory, but there could potentially be many instances of the BaseForm and therefore the BaseFormPresenter. This would solve my problem of synchronizing each instance of the BaseForm to the same data model.

Questions:

Which layer should store stuff like, the last pressed button, so that I can keep it highlighted for the user (like in a CSS menu) between forms?

Please criticize this design. Thanks for your help!

答:
I am going to answer this even though you have already accepted an answer.

As others have pointed out, I do not understand why you had to use anything static; this sounds like you have been doing something very wrongly.

Anyway, I have had the same problem as you: in my WinForms application I have several forms that share some functionality and some controls. Also, all of my forms already derive from a base form (let's call it "MyForm") which adds framework-level functionality (irrespective of application.) The Forms Designer of Visual Studio supposedly supports editing forms that inherit from other forms, but in practice it works only as long as your forms do nothing more than "Hello, world! -- OK -- Cancel".

What I ended up doing is this: I keep my common base class "MyForm", which is quite complex, and I continue to derive all of my application's forms from it. However, I do absolutely nothing in these forms, so the VS Forms Designer has no problems editing them. These forms consist solely of the code that the Forms Designer generates for them. Then, I have a separate parallel hierarchy of objects that I call "Surrogates" which contain all the application-specific functionality, like initializing the controls, handling events generated by the form and the controls, etc. There is a one-to-one correspondence between surrogate classes and dialogs in my application: there is a base surrogate class which corresponds to "MyForm", then another surrogate class is derived which corresponds to "MyApplicationForm", and then a whole bunch of other surrogate classes are derived, which correspond to each and every different form that my application displays.

Each surrogate accepts as a construction-time parameter a specific type of form, and it attaches itself to it by registering for its events. It also delegates to base, all the way to "MySurrogate" which accepts a "MyForm". That surrogate registers with the "Disposed" event of the form, so that when the form gets destroyed, the surrogate invokes an overridable on itself so that it, and all of its descendants, can perform cleanup. (Deregister from events, etc.)

It has been working fine so far.


答:
I suggest using a tool, instead of implementing a compiler or interpreter yourself. Irony uses C# to express the target language grammar (the grammar of your command line). The description on CodePlex says: "Irony is a development kit for implementing languages on .NET platform.“

See the official homepage of Irony on CodePlex: Irony - .NET Language Implementation Kit.


答:
There are two general approaches to layering: strict layering and relaxed layering.

A strictly layered approach constrains components in one layer to interacting only with peers and with the layer directly below.

A relaxed layered application loosens the constraints such that a component can interact with components from any lower layer.

Using relaxed layering can improve efficiency because the system does not have to forward simple calls from one layer to the next. On the other hand, using relaxed layering does not provide the same level of isolation between the layers and makes it more difficult to swap out a lower layer without affecting higher layers.

For large solutions involving many software components, it is common to have a large number of components at the same level of abstraction that are not cohesive. In this case, each layer may be further decomposed into one or more cohesive subsystems. Figure 2 illustrates a possible Unified Modeling Language (UML) notation for representing layers that are composed of multiple subsystems.

conclusion: if you don't need the middle layer lose it; not all applications require the same approach and somehow adding a layer just for layering purpose will have penalties on the complexity cost and maintenance.

Title: Entity Framework and layer separation


答:
No. Tools aren't replacement of methodology.

If you don't use Subversion as SCM, you can don't use Mercurial also (and it will happen most probably)


答:
Yes.

If you replace "SVN" with "Perforce" in your OP you've pretty much got the situation I found myself in when I started my current job, even down to the manual-change copying. Two years on we're on Mercurial and everyone agrees it's been a great change.

We have the ability to branch and merge per support case, which is unbelievably useful for QA, and the ability to create any number of throwaway branches and repositories whenever we see fit, which we can then build and verify in our CI server, then deploy to a cloud test environment and verify functionality. This has been of huge benefit in terms of peace of mind that when we do a live deploy, we're almost 100% sure that it will work (sans environment/DB issues, which are obviously out of the scope of the VCS).

Basically, what we gained from switching to mercurial is breathing space. We no longer have to worry about the cost of a branch, or the horrific merge sessions that inevitably used to follow, everything is much much easier. We also use FogBugz quite heavily so the tie-in to Kiln (their hosted mercurial) is really helpful.

The comment about the hginit site is spot on too, as an outline for a version control workflow that actually works (assuming you adjust it for your company's particular QA workflow).

The only possible flaw in moving version controls is that you will need someone who's really a driving force behind the change, who's happy to read up on the subject matter and really use the tooling to the best of its potential, which you seem to want to do.

I don't agree with the comments about team size and team distribution relating to whether to use DCVS either. Really, it's about CODE distribution. If you have multiple development cycles happening in parallel, either support cases on a legacy system, or a bunch of features or even new systems (which by the sound of it you do), you will benefit from using a DVCS.


答:
A different tool is probably not going to solve your problem, I'd say you should read this article, I found it most helpful:

http://thedailywtf.com/Articles/Source-Control-Done-Right.aspx

I think the main point of the article is summed up here, but please do read it:

In The End: Not Really About The Tools

In all of the time I’ve spent working with and integrating different
  source control systems, I’ve come to one conclusion: it’s not the
  tool, it’s how you use it. That’s a terribly hackneyed statement, but
  it seems especially true here. When used to properly manage source
  code changes – labeling for builds, branching by exception, etc. –
  even the lamest source control system (*cough*SourceSafe*cough*) will
  far outperform a Mercurial set-up with a bunch of haphazard commits
  and pushes.


问:
Contractor vs Consultant
For a programmer, two of the most common terms that seem to be overloaded are contractor and consultant?<br>
Is there a difference between the two? </p>

答:
My definition would be:

Contractor - someone hired to produce a specific output or deliver a project. This may be on either a fixed price or time & materials contract.

Consultant someone hired primarily in an advisory role. The advice could be quite technical (how to optimise assembly language) or more general / organisational (how to implement TDD).

The two are typically somewhat interchangable however (you can regard advice as an output, so a consultant can be regarded as a contractor, and likewise a contractor may reasonably be expected to provide advice as part of their work).

OwnerDisplayName: Kaushik

Title: Contractor vs Consultant


答:
SVN can do what you need it to do and there is no need to change horses mid-stream for a dubious pay-off.

Whatever you do you will have to overcome a trust issue. Someone has to be able to convince everyone to change their workflow. This is not easy even in the best circumstances, even if you have logic and facts on your side. It is one of the hardest things to do in an organization. If you botch it or it goes rough, you lose trust and it will be very hard to re-gain that trust.

There are a couple of things that I know people have tried successfully. Perhaps one of them will work for your team:

Bring in a "coach" to provide a series of workshops for the team. This will likely have to be an external person (ironically, it is often easier for many teams to trust an outsider than it is to trust someone on the team). It has to be someone that knows her stuff inside-out and that can effectively teach these skills to people at all levels of understanding and devise a pragmatic plan for rolling the new VCS (*) out to the team's workflow.

Start a "skunk-works" project to test-drive and validate the new VCS on a small side-project. Choose a couple of "alpha" developers that are willing to try new stuff and don't mind racking up a bunch of unsuccessful experiments. When the skunk-works is able to demonstrate CONCRETE irrefutable improvements in workflow, then you can then attempt to roll it out to the rest of the team and you have a couple of evangelists to help you do it.

(*) by "new VCS" I don't necessarily mean mercurial or git, it can also be SVN (done right).


答:
I think academic still need the value of open source in JAVA. There are so many many powerful library (focused on academic purposes) developed on JAVA.

I agree that JAVA will remain relevant, but for smaller segment.

Title: Will Java still be relevant in 5 years?


问:
Alternate string formatting options in C++?
I'm looking at optimizing some string formatting code that's hit a lot in our code. We had been using ostringstream, and I converted the code to use sprintf (actually Microsoft's more secure sprintf_s). I've traded type safety for run-time performance. But I've debugged enough sprintf related weird crashes to know that sprintf has its own serious flaws that the compile time checking of ostringstream catch. But ostringstream is more than an order-of-magnitude slower then sprintf by my measure, and that's not tolerable in this code. I'm also not thrilled with the readability of C++ stream string formatting, but this may be entirely subjective.

So unfortunately when formatting strings in C++ I've got several "standard" options that are suboptimal:

sprintf -- fast, but not type safe. Can have insidious bugs when the wrong format string is not used.

ostringstream -- slow, but type safe. IMO Ugly, too verbose, and difficult to read.

boost::format -- a little more readable then ostringstream IMO, but in my performance benchmarks appears to be even slower then ostringstream, so this is out.

To summarize, I'm not really satisfied with the "standard" options. I'd like something that takes both performance and type safety seriously. What other string formatting options are out there for C++?

答:
This is not a complete answer however, i guess, given that performance matters - scaling up sprintf might be a better starting point.

One area where you need to look at is how GCC works. Basically, even though C (and C++) doesn't bother as a language to do typecheck of %d vs. having really integer on the respective arguments, typically GCC always catches that and gives Warnings. You can actually treat Warning as Error with -Werror options. The point is that essentially GCC already does 'type safety' verification at compile time. That is exactly what you need.


问:
Large Ecommerce Site Topology and Deployment Guidelines

Problem

I am a lead engineer for a highly trafficked eCommerce website (upwards of 1m page views an hour).  For various reasons we have the opportunity to rebuild large portions of our infrastructure.  This brings up a number of interesting problems in balancing flexibility, stability, speed to market, etc... At a high level I am interested in how others have handled similar situations. In particular I am want to know how others have architected their site to provide stable deploys in fast moving environment.

One of the main trade offs I am looking at is breaking our site by
functional area and providing them each their own sub domain. The
primary driver for this is that we are hosting on Azure and
deployments are all or nothing.

I am also interested in how others have maintained architectural
integrity in a fast moving environment and team composed of varying
levels of experience.

Tech

We are primarily a Microsoft shop: SQL Server, Windows Server 2008, .Net 4.0, Visual Studio 10, etc...

We have also made the decision to host our main site on the Azure platform and are making heavy use of table and blob storage as well as app fabric cache. We are considering using multiple Azure data centers but have not made that final decision as of yet.

All static content including JavaScript and CSS will be minified and hosted on our CDN .

Our site is built using .Net MVC 3 and is supported by a DDD style architecure.  Our data access libraries and business rules are fairly well encapsulated and separate from actual display logic.

Process

While not a true agile shop we iterate very quickly with frequent deployments, multivariate testing, just in time requirements, etc...  We are generally very entrepreneurial and have the need to respond quickly to new opportunities as they arise.  (code for "it can get chaotic")

Team

Our development team is made up of a couple dozen developers with varying levels of skill and experience.  While some of the developers can operate independently others need to have very careful code reviews done.

The QA team has a very thorough manual review process.  They are also beginning to build a suite of QTP tests to automate regression testing.  The dev team in turn makes use of Unit Testing and BDD testing when appropriate.

Not Considerations

I know there are a lot of strong opinions out there so to preempt religious wars here are a couple of responses that will not be helpful to me.

Just use Java, Oracle, PHP, Ruby, etc...

Just use EC2

Just ask your developers to be more careful

Just tell your developers to code faster

Just tell "the business" to slow down

Just use Google Checkout

Who I'm looking for feedback from

I know there are many engineers who, while very skilled, have never worked on systems that supports more than a few hundred concurrent users.  The lessons learned from a site supporting 30,000 concurrent users are very different from those of an internal support app (I've worked on both, btw, and am not disparaging internal apps.  They just require a different approach).

If you have experience in similar situation I would love to hear how you approached the problem and what the draw backs of your solution where.

答:
I am want to know how others have architected their site to provide
  stable deploys in fast moving environment.

We have:
1)  A standard 3 tier architecture, DB (My SQL), Business layer (Java, Struts like), presentation layer (Java, Html, Javascript, Css)

2)  1 Primary DB server + failover DB server

3)  3 webservers with load balancing (The site is lightning fast, though we only get about 250k hits per hour. We could get by on 2 But figured why not have the failover server doing some work as opposed to just sitting idle)

4)  The Ecommerce site handles all interactions with the client and only holds data that is necessary for that. All administrative, order processing, payment processing happens locally within the ERP system. With order data regularly downloaded from the site.

5)  All Item level data is maintained within the ERP system and published regularly to the Ecommerce DB. (There is a bit of back and forth with regard to quantity available among other things)

6)  When deploying we publish the entire code base.. It’s tiny, I think under 10mb. And we run DB mod scripts. It takes less the 5 min of downtime, we do this when usage is low (2am or something)

One of the main tradeoffs I am looking at is breaking our site by
  functional area and providing them each their own sub domain. The
  primary driver for this is that we are hosting on Azure and
  deployments are all or nothing.

I think this is a mistake; it effects the user experience, therefor should be made based on business reasons not technical ones.

I am also interested in how others have maintained architectural
  integrity in a fast moving environment and team composed of varying
  levels of experience.

We have a key architected position who along with myself know the enter system architecture from a high level. We make all major architecture decisions and well as approve any Db structure modification. We act as a central control.


答:
My advice would be google for a library that solves your problem.

I've been using NodeJS a lot lately, and Optimist is what I use for command-line processing. I encourage you to search for one you can use for you own language of choice. If not..write one and open source it :D You may even read through Optimist's source code and port it to your language of choice.


问:
Long Filename Extensions: Why Not
I'm finishing up my app for iPad, and the filename extension (used mostly so that Mail and Dropbox know what program to open the files in) is 12 characters long. The only filename extension that is anywhere near as long is tax2010. Why is there so little variation on this topic, and what kind of problems can I expect by using a long filename extension for my app? These files will be mailed, copied, and shared*.

In all tests, it works perfectly.

* I hope.

答:
As @Anthony said in the comments, a three letter (on DOS->Windows line) file extension is a historical remnant. Nowadays, it is no longer a restriction with modern operating systems, although it remains curiously common.

Since it is expected that, as time goes by, that practice will slowly be abandoned, I hazard that you could go with a longer file extension, especially if your tests confirmed that in your environment it "works okay".

The only problem that I can guess is that in some cases it will be shortened to "tax".

Title: Long Filename Extensions: Why Not


答:
A lot of developers were at least using computers back when long extensions where a technical restriction. Even today, there are still programs in active use that choke on things such as  spaces in file paths and long extensions.

As long as you don't suspect that your files will need to be used by these programs, there isn't a technical reason to stop you.

Do please remember though, that the short extensions that can be comprehended in a single glance will be much better for your users. So while .resources is a great example, .customhatbymycompany is definitely not.

Title: Long Filename Extensions: Why Not

Body:
I'm finishing up my app for iPad, and the filename extension (used mostly so that Mail and Dropbox know what program to open the files in) is 12 characters long. The only filename extension that is anywhere near as long is tax2010. Why is there so little variation on this topic, and what kind of problems can I expect by using a long filename extension for my app? These files will be mailed, copied, and shared*.

In all tests, it works perfectly.

* I hope.


答:
Streams are very slow because they have a relatively inefficient implementation, and also because they have a whole bunch of overhead bells and whistles that you really don't need. Fundamentally, they serve the exact purpose you need.

The question, ultimately, is about exactly how much effort you're willing to go to and how many types you're outputting. sprintf isn't just unsafe, it's also completely unextendable, something that isn't true of ostringstream. You can also use expression templates to improve it's performance. The performance problem of ostringstream is not endemic to it's design at all.

Title: Alternate string formatting options in C++?

Body:
I'm looking at optimizing some string formatting code that's hit a lot in our code. We had been using ostringstream, and I converted the code to use sprintf (actually Microsoft's more secure sprintf_s). I've traded type safety for run-time performance. But I've debugged enough sprintf related weird crashes to know that sprintf has its own serious flaws that the compile time checking of ostringstream catch. But ostringstream is more than an order-of-magnitude slower then sprintf by my measure, and that's not tolerable in this code. I'm also not thrilled with the readability of C++ stream string formatting, but this may be entirely subjective.

So unfortunately when formatting strings in C++ I've got several "standard" options that are suboptimal:

sprintf -- fast, but not type safe. Can have insidious bugs when the wrong format string is not used.

ostringstream -- slow, but type safe. IMO Ugly, too verbose, and difficult to read.

boost::format -- a little more readable then ostringstream IMO, but in my performance benchmarks appears to be even slower then ostringstream, so this is out.

To summarize, I'm not really satisfied with the "standard" options. I'd like something that takes both performance and type safety seriously. What other string formatting options are out there for C++?


答:
File extensions are used to distinguish between different types of files, not to tell a story. That's why they are short: even with three letters length, the chances to have a collision on the same machine are pretty small.

Long extensions mean less space for the remaining path and file name. Maybe in modern operating systems and software it doesn't matter since they accept very long file paths. Sadly, this is not the case with Microsoft, where .NET Framework still cannot manage paths longer than 259 characters. 12 characters taken for extension means 246 characters left for the path without extension. In some cases, it may be a problem.

Since this issue does not apply in your particular case, the only reason to avoid long extensions is if file names, including extensions, are typed by the user, especially on mobile devices where typing can be hard.

Title: Long Filename Extensions: Why Not


问:
How important are design patterns in programming?
I'm a university student and I've just started learning about design patterns and im struggling to understand the purpose of them. I have tried researching them but all the resources I have found seem to talk about them in an academic, not professional, way.

What is their purpose and are they important to learn?

答:
A usefulness of a design pattern depends of which language you choose. The more powerful language you choose the less you will need to understand and implement design patters. A design pattern may be a signal that your language sucks is missing a built-in feature.

Joe Gregorio made a great talk about the lack of design patterns in Python


答:
Longer filenames:

Take more typing, resulting in more effort / misskeys

Take up more screen space

Are a break with tradition

Are not important because file extensions are for machines not people

Take up valuable characters in systems with a restriction on path length

Whether or not these considerations are a problem for your application is a matter for you and your users.

Title: Long Filename Extensions: Why Not


问:
What is the right way to develop ASP.NET applications in order to separate data access from data visualization?
I'm currently involved in a migration to TFS from SVN of a large project that is going to be divided into five different sites. This project allows some providers to insert five different product data into the enterprise DB. Like a lot of companies out there, we have a technological debt that should be solved (or at least, reduced) with this new project organization. However, I'm quite new to ASP.NET and also our software is still running 2.0 .NET, so maybe I'm missing something or things should be done in a different way nowadays with 3.5+.

One of those five different parts is going to be a new one. This is the one I'm going to develop. In order to achieve high degree of modularity, the code of the current project is divided into several DAO (Data Access Object) under App_Code, *.ascx modules living in different parts of the project structure, VB classes that inherit from System.Web.UI.* (for each control that is displayed on the web) under App_Code, and lots of stored procedures for providing data to the controls. Also, we have several *.aspx that use <asp:PlaceHolder /> for displaying each of the controls that inherit from System.Web.UI.

The question comes when, for creating a simple <select> dropdown list to display a list of providers, I see that I have to do the following steps:

Create a class cProvider inside the App_Code, that ultimately inherits from System.Web.UI, with a method that calls to the following DAOProvider object.

Crate an specific DAO object to connect to the DB I need to.

Create another DAO object, called DAOProvider, that inherits from the previous one, with the call to an stored procedure that retrieves the list of the providers.

Create that stored procedure in the database.

Create an .ascx control to display the <select> with the options obtained from cProvider.

If you're still there, here goes my question: Is this the right way to do things? Is this high level of modularity the correct way to develop mantainable .NET applications? Do I have to follow this style and organization or should I take another one (please give me your recommendations)?

From my point of view, having to do all those steps to paint a simple dropdown list doesn't follow KISS principles at all, and becomes unmantainable if somebody else has to take this project, knowing that the code is the only documentation we have.

EDIT: links to documentation regarding this topic would be highly appreciated.

答:
I really don't want to just repeat David, but MVC is the way to go when clear separation of responsibility is important.  It divides your architecture into three areas: The models (your classes), the views (think of these as your webpages), and the controller (the logic).

I realize switching may not be possible.  In webforms, which is where your question comes from, it is possible to be modular without going overboard.  I can't point to any specific examples, but yes, it sounds like your current project is way over-architected.  Even before ASP.NET MVC, there were "MVC-ish" ways of doing ASP.NET webforms with good separation of responsibility.

My best recommendation is don't repeat yourself.  If you're going through five steps to instantiate a dropdown, take a good hard look at ways you can wrap some (if not all) of those steps into a simpler process.  Generics are a godsend for this.

Lastly, going back to the MVC recommendation, remember that you can and should mix ASP.NET webforms and MVC when appropriate.


答:
Design patterns are just known bricks any software solution is built upon. They are important due to the following reasons:

They are language agnostic. Once you know what design pattern is appropriate for given problem/architecture/task you can implement it in any multi-paradigm language -- let is be C#, Java or Python -- the solution will be in most cases the same, you just have to adapt the syntax. This means that you can transfer your experience from programming in one language to other languages as long as you stay within the same problem domain (and maybe even across domains).

Despite the fact that design patterns do have binding to programming paradigm, meaning that design patterns for object-oriented programming (the most famous ones, also known as "Gang of Four" patterns). Patterns allow you to understand what the paradigm is best for and help you to go beyond just syntax. For example I have seen a lot of implementations in C# and Java where people just programmed the way they did it in Basic or Fortran -- they have a perfect imperative mind for solving problems and they use OOP just to render this solution -- no inheritance, no polymorphism, all methods are public etc. Design patterns help you to look behind these concepts and see how they work in real life. Same applies to design pattern in other paradigms, like functional programming.

Patterns are generally a handy way to represent ideas and came to Computer Science from architecture. Once you understand the idea behind a certain "pattern" you can easily recognize this pattern in some other problem and solve it using this pattern (probably slightly modified to better address your problem). There are tons of different patterns: in Enterprise Software Integration, in Source Code Testing etc. Just look for patterns in books for Computer Science.

Aside from acquiring good practices by learning patterns you can easily learn how to avoid silly mistakes in your code by studying anti-patterns. There are plenty of books featuring common mistakes in different domains in form of anti-patterns that are very entertaining and same time educative. I love the names of these anti-patterns, by the way!

Title: How important are design patterns in programming?

Body:
I'm a university student and I've just started learning about design patterns and im struggling to understand the purpose of them. I have tried researching them but all the resources I have found seem to talk about them in an academic, not professional, way.

What is their purpose and are they important to learn?


问:
How to retain student/intern programmers?
We have a small team in our department and typically employ 1-3 students/interns.  The problem we have is retention.  We like to hire a student that will stick around as part of the team for more than just a summer quarter.  The problem is though the last 4 students we hired, up front we discussed this with them and they all ended up leaving earlier than we would have liked.

The relationships all ended in a good fashion, the students either obtained teaching assistant or research positions within the university, or went on to bigger and better things.  This is all understandable and we do not hold it against them for doing what is best for them.

But my perspective is different as I worked within our department for 2 years during undergraduate at which point I was brought on full time upon graduation.

How can we retain students?  We give them hardware they need/want, we provide them with problems to solve in anyway they see fit (within reason).  All in all to me this type of job for a student programmer is so flexible and awesome I cannot see how anyone would want to leave.

Thoughts ?

答: What kind of tools are you using?  IMO I wouldn't care if I was writing code on the bleeding edge, if I had to write it using notepad I wouldn't hang around long.  I wouldn't give up my IDE for a 10k salary increase, all the cake you could throw at me, or working on coding for the LHC.</p>


答:
Modular starts well below the waterline. If you are debating MVC vs. WebForms you have already lost the war.

What you want to do is separate the core, non-UI parts of the project into a separate assembly with no reference to System.Web.UI or anything of that sort. The UI layers reference this assembly and call it's methods which should generally be returning POCOs and collections of POCOs. The UI that sits on top of this layer can then be a relatively simple throwaway. Remember, UI changes every 3-5 years whereas core data storage and logic can last decades.

To get at your drop down list you would:

a) Define a class for your drop down list data -- we actually have a pretty generic construct that has the right things one needs, YMMV.

b) Define a data service class responsible for accessing the specific data with appropriate methods.

c) In your page / MVC controller, access the service and the service method and put the data in an appropriately accessible object.

d) In the template, access the object and render the <select>

If it is a list you use often, you might want to consider making a user control / partial view / child action as required. My experience is modularity really starts falling down in the UI layer where one oftentimes ends up making horribly complex things to handle customization that would have just been best left hand-wired over some good core logic.

Title: What is the right way to develop ASP.NET applications in order to separate data access from data visualization?

Body:
I'm currently involved in a migration to TFS from SVN of a large project that is going to be divided into five different sites. This project allows some providers to insert five different product data into the enterprise DB. Like a lot of companies out there, we have a technological debt that should be solved (or at least, reduced) with this new project organization. However, I'm quite new to ASP.NET and also our software is still running 2.0 .NET, so maybe I'm missing something or things should be done in a different way nowadays with 3.5+.

One of those five different parts is going to be a new one. This is the one I'm going to develop. In order to achieve high degree of modularity, the code of the current project is divided into several DAO (Data Access Object) under App_Code, *.ascx modules living in different parts of the project structure, VB classes that inherit from System.Web.UI.* (for each control that is displayed on the web) under App_Code, and lots of stored procedures for providing data to the controls. Also, we have several *.aspx that use <asp:PlaceHolder /> for displaying each of the controls that inherit from System.Web.UI.

The question comes when, for creating a simple <select> dropdown list to display a list of providers, I see that I have to do the following steps:

Create a class cProvider inside the App_Code, that ultimately inherits from System.Web.UI, with a method that calls to the following DAOProvider object.

Crate an specific DAO object to connect to the DB I need to.

Create another DAO object, called DAOProvider, that inherits from the previous one, with the call to an stored procedure that retrieves the list of the providers.

Create that stored procedure in the database.

Create an .ascx control to display the <select> with the options obtained from cProvider.

If you're still there, here goes my question: Is this the right way to do things? Is this high level of modularity the correct way to develop mantainable .NET applications? Do I have to follow this style and organization or should I take another one (please give me your recommendations)?

From my point of view, having to do all those steps to paint a simple dropdown list doesn't follow KISS principles at all, and becomes unmantainable if somebody else has to take this project, knowing that the code is the only documentation we have.

EDIT: links to documentation regarding this topic would be highly appreciated.


答:
some things you can do to get students to stay.

Make it known that interns get dibs on a full time position.

Make full time employment seem significantly better than internship.

Don't make an internship feel like an internship, treat them like they are a real employee

offer competitive pay, at least high enough that its not a significant cut in potential earnings compared to other jobs even one not related to degrees your interns are pursuing.

if you can't offer pay (or even if you can) offer minor benefits/perks, looks like you can't do this but maybe you can get creative and make it not be considered a benefit. A company that I applied for an internship offered interns one paid vacation day and access to company gym.

if you have multiple intern roles help them find a good fit if what they were hired for isn't a good fit.

Title: How to retain student/intern programmers?

Body:
We have a small team in our department and typically employ 1-3 students/interns.  The problem we have is retention.  We like to hire a student that will stick around as part of the team for more than just a summer quarter.  The problem is though the last 4 students we hired, up front we discussed this with them and they all ended up leaving earlier than we would have liked.

The relationships all ended in a good fashion, the students either obtained teaching assistant or research positions within the university, or went on to bigger and better things.  This is all understandable and we do not hold it against them for doing what is best for them.

But my perspective is different as I worked within our department for 2 years during undergraduate at which point I was brought on full time upon graduation.

How can we retain students?  We give them hardware they need/want, we provide them with problems to solve in anyway they see fit (within reason).  All in all to me this type of job for a student programmer is so flexible and awesome I cannot see how anyone would want to leave.

Thoughts ?


答: I can’t speak for iPad apps, but I’ve been using 5- and 6-character extensions for file types for my Windows apps for quite a while now with no problems.  And I don’t think Linux ever had an issue with it, so it’s no problem there either.  Just don’t use spaces or special characters, as some programs may not properly deal with them if they try to use the file name as part of a command line parameter.</p>

Title: Long Filename Extensions: Why Not


问:
How to license programming code as open-source to say I am the author?
I am just wondering. I've never licensed any code before and there is so many separate information about that I am a little bit confused;
I watched the codes which are published in the Internet and some of them contain their author name and license info so that makes the code some kind of personalized; So my question is... what author should do to be able to :

A) License his code

B) Say he is the code author

C) Place the code in Internet (apache web site or something in this direction)

D) Say it is under apache/GNU license or something?

I am talking about open-source and non-commercial licenses; And the most important thing is... should I patent the code before to prove I am the code owner to license it?

And what organization(s) I should join? In music it is something like ASCAP ( but in my case I don't mean commercial purposes);
but what about programming? Are there some societies which I can join to be sure I can prove the code I published (on their official site etc) is really mine?

Thanks

答:
You can't patent code, you can only copyright it. You can patent algorithms and processes though, so perhaps that applies. In any case you'd need to talk to a patent attorney to figure out what you could do and how to proceed. It ain't a DIY process.

I'm having trouble figuring out what you are asking, but the easiest way to publish open source libraries would be to use one of the major public code hosting sites such as google code, github, bitbucket or codeplex. They make it pretty easy to setup the licenses and handle the mechanics of open source. The Apache Foundation probably won't be much help to most projects.


答:
Look at existing free software. They generally have a comment with a license and a copyright owner. Often, there is a list of contributors.

For example, for GCC, the file gcc/gengtype-state.c starts with

```<code> /* Gengtype persistent state serialization & de-serialization.
    Useful for gengtype in plugin mode.

    Copyright (C) 2010  Free Software Foundation, Inc.

    This file is part of GCC.

    GCC is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free
    Software Foundation; either version 3, or (at your option) any later
    version.

    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.

    Contributed by Jeremie Salvucci <jeremie.salvucci@free.fr>
    and Basile Starynkevitch <basile@starynkevitch.net>
 */
</code>```

See also this answer (to a question related to yours). The GPLv3 seems to require such comments. An example of GPLv3 code with the copyright owner same as the author is onion/onion.c from the onion HTTP server library.

Caveat: I am not a lawyer

Regarding organizations to join, you might be interested by the FSF or some free software "user" organization (like April or Aful in France; perhaps you could find the equivalent in your country).

My preference is for GPLv3 or LGPLv3 licenses.

Title: How to license programming code as open-source to say I am the author?

Body:
I am just wondering. I've never licensed any code before and there is so many separate information about that I am a little bit confused;
I watched the codes which are published in the Internet and some of them contain their author name and license info so that makes the code some kind of personalized; So my question is... what author should do to be able to :

A) License his code

B) Say he is the code author

C) Place the code in Internet (apache web site or something in this direction)

D) Say it is under apache/GNU license or something?

I am talking about open-source and non-commercial licenses; And the most important thing is... should I patent the code before to prove I am the code owner to license it?

And what organization(s) I should join? In music it is something like ASCAP ( but in my case I don't mean commercial purposes);
but what about programming? Are there some societies which I can join to be sure I can prove the code I published (on their official site etc) is really mine?

Thanks

Body:
Look at existing free software. They generally have a comment with a license and a copyright owner. Often, there is a list of contributors.

For example, for GCC, the file gcc/gengtype-state.c starts with

 /* Gengtype persistent state serialization & de-serialization.
    Useful for gengtype in plugin mode.

    Copyright (C) 2010  Free Software Foundation, Inc.

    This file is part of GCC.

    GCC is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free
    Software Foundation; either version 3, or (at your option) any later
    version.

    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.

    Contributed by Jeremie Salvucci <jeremie.salvucci@free.fr>
    and Basile Starynkevitch <basile@starynkevitch.net>
 */

See also this answer (to a question related to yours). The GPLv3 seems to require such comments. An example of GPLv3 code with the copyright owner same as the author is onion/onion.c from the onion HTTP server library.

Caveat: I am not a lawyer

Regarding organizations to join, you might be interested by the FSF or some free software "user" organization (like April or Aful in France; perhaps you could find the equivalent in your country).

My preference is for GPLv3 or LGPLv3 licenses.


问:
Hiring programmers for small companies?
I've been running a company for nearly 10 years, and all this time it's been just myself, another programmer (who's a great friend and cofounder), and a salesman (who's also a friend). Together, we've managed to do decent business and we've all managed to make a living, but we've been trying to expand for a long time now.

Unfortunately, there are a few problems:

The technology we use is not obsolete, but it's also not as popular
compared to other web development options like PHP

We work in a competitive market, competing against multi-million
dollar companies

We can't afford to pay new programmers or salesmen very well. We make
enough money for ourselves, but unless we got a significant number of
new customers we wouldn't be able to pay much.

Because of the fact we can't pay much, we use a slightly more rare
technology, and we compete against large companies, we find it
difficult to find new programmers or salesman.

We desperately need to expand, but when we try to get more customers, we can't support them with so few people (or their demands grow outside of our range of expertise) and when we try to hire new programmers and salesman, we usually don't get a high quality and they usually don't provide a major benefit for our company.

Does anyone have some suggestions or tips on how we could expand?

答:
Consider hiring a mommy-track (or daddy-track) programmer who is experienced in your skill set, would like a half time job, has flexible hours and will be dedicated to remaining with a company that can accommodate the flexibility needed by a primary caregiver.  Money beyond daycare costs often isn't an object as they are eager to maintain and enhance skill sets but not interested in going back to work full time.

Look for people who were real go-getters before the kids.  They'll probably bring that to a part-time job and will be part-time for you for years with high skills and low costs -- often healthcare is paid by the full-time parent's job so there can be a savings there.

Title: Hiring programmers for small companies?


答:
Think about retention before the person even walks in the door for the first day of their internship.  I've seen people try this in the last 2 weeks of an internship, when those overtures should have been made at the beginning.

Also, keep in touch with the former interns you liked.  Coming out of college it is natural to try and get varied experiences, it is even arguable that one should work someplace else.  However, when the second job comes around and they've scratched their itch, you'll be in a good position to hire them for their second job.  Don't do anything crazy, just maybe a call once or twice a year, or maybe do lunch if you're both in the same area.


答: Haskell do notation is kind of a nice balance here.  If you want to do indentation based you may do so.  If you want to do semicolons you may do so.  Not quite the block structure since that's a different language, but the idea of "use whatever pleases you because this isn't really an important detail" is one I like.

Title: Do you find languages with indentation requirements cumbersome?

Body:
Thoughts on these?  Python is one example, and no this is not a stab against Python I like the language.

What languages have a indentation requirement?