答:
The FSF free software conditions refer to the software. The OSI open software conditions refer to the license of such software. This is an important legal distinction.

For instance, under US law, there is no free software. Export laws restrict your freedom to export software to North Korea and Iran. However, as these are not restrictions in the license (but rather in law), these restrictions do not affect the Open status.

Of course, these subtle distinctions are often overlooked by the proponents of Open Source. The FSF subtly acknowledges them. When they talk about export controls, they do restrict themselves to "Free Software Licenses", not "Free Software".

The other way around is also possible. E.g. if you're living in a country that does allow Free Software, a Free Software license may violate the "Integrity of The Author's Source Code" and not be Open. That's just not one of the enumerated freedoms.

Title: Open Source but not Free Software (or vice versa)

Body:
The definition of "Free Software" from the Free Software Foundation:

“Free software” is a matter of
  liberty, not price. To understand the
  concept, you should think of “free” as
  in “free speech,” not as in “free
  beer.”

Free software is a matter of the
  users' freedom to run, copy,
  distribute, study, change and improve
  the software. More precisely, it means
  that the program's users have the four
  essential freedoms:

The freedom to run the program, for
  any purpose (freedom 0).

The freedom
  to study how the program works, and
  change it to make it do what you wish
  (freedom 1). Access to the source
  code is a precondition for this.

The
  freedom to redistribute copies so you
  can help your neighbor (freedom 2).

The freedom to distribute copies of
  your modified versions to others
  (freedom 3). By doing this you can
  give the whole community a chance to
  benefit from your changes. Access to
  the source code is a precondition for
  this.

A program is free software if users
  have all of these freedoms. Thus, you
  should be free to redistribute copies,
  either with or without modifications,
  either gratis or charging a fee for
  distribution, to anyone anywhere.
  Being free to do these things means
  (among other things) that you do not
  have to ask or pay for permission to
  do so.

The definition of "Open Source Software" from the Open Source Initiative:

Open source doesn't just mean access
  to the source code. The distribution
  terms of open-source software must
  comply with the following criteria:

Free Redistribution The license shall not restrict any party from
  selling or giving away the software as
  a component of an aggregate software
  distribution containing programs from
  several different sources. The license
  shall not require a royalty or other
  fee for such sale.

Source Code The program must include source code, and must allow
  distribution in source code as well as
  compiled form. Where some form of a
  product is not distributed with source
  code, there must be a well-publicized
  means of obtaining the source code for
  no more than a reasonable reproduction
  cost preferably, downloading via the
  Internet without charge. The source
  code must be the preferred form in
  which a programmer would modify the
  program. Deliberately obfuscated
  source code is not allowed.
  Intermediate forms such as the output
  of a preprocessor or translator are
  not allowed.

Derived Works The license must allow modifications and derived works,
  and must allow them to be distributed
  under the same terms as the license of
  the original software.

Integrity of The Author's Source Code The license may restrict
  source-code from being distributed in
  modified form only if the license
  allows the distribution of "patch
  files" with the source code for the
  purpose of modifying the program at
  build time. The license must
  explicitly permit distribution of
  software built from modified source
  code. The license may require derived
  works to carry a different name or
  version number from the original
  software.

No Discrimination Against Persons or Groups The license must not
  discriminate against any person or
  group of persons.

No Discrimination Against Fields of Endeavor The license must not restrict
  anyone from making use of the program
  in a specific field of endeavor. For
  example, it may not restrict the
  program from being used in a business,
  or from being used for genetic
  research.

Distribution of License The rights attached to the program must apply to
  all to whom the program is
  redistributed without the need for
  execution of an additional license by
  those parties.

License Must Not Be Specific to a Product The rights attached to the
  program must not depend on the
  program's being part of a particular
  software distribution. If the program
  is extracted from that distribution
  and used or distributed within the
  terms of the program's license, all
  parties to whom the program is
  redistributed should have the same
  rights as those that are granted in
  conjunction with the original software
  distribution.

License Must Not Restrict Other Software The license must not place
  restrictions on other software that is
  distributed along with the licensed
  software. For example, the license
  must not insist that all other
  programs distributed on the same
  medium must be open-source software.

License Must Be Technology-Neutral No provision of the license may be
  predicated on any individual
  technology or style of interface.

These definitions, although they derive from very different ideologies, are broadly compatible, and most Free Software is also Open Source Software and vice versa. I believe, however, that it is possible for this not to be the case: It is possible for software to be Open Source without being Free, or to be Free without being Open Source.

Questions

Is my belief correct? Is it possible for software to fall into one camp and not the other?

Does any such software actually exist? Please give examples.

Clarification

I've already accepted an answer now, but I seem to have confused a lot of people, so perhaps a clarification is in order. I was not asking about the difference between copyleft (or "viral", though I don't like that term) and non-copyleft ("permissive") licenses. Nor was I asking about your personal idiosyncratic definitions of "Free" and "Open". I was asking about "Free Software as defined by the FSF" and "Open Source Software as defined by the OSI". Are the two always the same? Is it possible to be one without being the other?

And the answer, it seems, is that it's impossible to be Free without being Open, but possible to be Open without being Free. Thank you everyone who actually answered the question.


问:
Can someone find a job as a programmer without an education?
Interested in knowing from the more experienced ones if someone can find a job as a programmer without even a highschool degree. Consider the said person to be an average programmer. Would someone even consider giving him/her a chance on an interview ? The languages of interest would be python/php/java/c#

Please answer for your region/city/country only. No "go back to school" answers please.

答:
I think, the point is 'without degree' and 'without education' is not equivalent. I know

many people with both

even more CS graduates with degree and without educaction - very annoying people

a lot of people with education and without degree

and - last but not least - quite a lot of people without any of those two, but those guys usually go into marketing.

There are places, where you have no chance of being hired. These are not the places where you want to work anyway.

In Germany 2-3 years of experience generally outweigh a degree. I don't have a degree but that never posed a problem for me. Also, if you freelance, your reference is much more important than any number of certificates could be. I suppose this is valid anywhere around the world.

So, to put it into few words: Yes you can!

ContentLicense: CC BY-SA 3.0

ContentLicense: CC BY-SA 2.5


问:
Why should I use JAX-RS REST instead of normal servlets?
I'm teaching myself J2EE technologies using Glassfish as my webserver and EJB container. I'm very interested in learning REST as well, and developing an application that is adherent to the rules of REST.

My first project is to write a chat client. The user will go to a webpage, download a webpage with the javascript to run the chat client (which posts the data to the server and fetches it as well). The calls to post data, and to fetch data, from the webserver will be through a RESTful interface. Right now I've done this through servlets that listen on the  /chatroom/getMessages and /chatroom/postMessage URI's.

The wrinkle that I run into when I try to convert this to a RESTful service using JAX-RS that doesn't use servlets is that I feel like I'm reinventing the wheel. With the servlet specification I had this HTTPSession object that made it very easy to keep track of where someone is in the chat buffer (and therefore which messages should be sent to them when they visit /chatroom/getMessages). But now when I make it completely RESTful, and just use POJOs with JAX-RS (which I actually like better from a style standpoint) I now have to reinvent session state if I want it by handing the person a token, and having them hand it back to me every time we talk just like the automagically generated session cookie would have done for me if I was using servlets.

WHY should I implement this with JAX-RS and abandon the servlets? I haven't seen any JAX-RS tutorials that mix servlets and JAX-RS (probably for good reason), so this doesn't seem to be an option. What I really want to know is what compelling reasons there are for going with REST. What does it buy me to not just use the servlets in a RESTful way?

答:
Having implicit session state in the server runs against the basic concept of REST:

The client–server communication is further constrained by no client
  context being stored on the server between requests. Each request from
  any client contains all of the information necessary to service the
  request, and any session state is held in the client. The server can
  be stateful; this constraint merely requires that server-side state be
  addressable by URL as a resource.

I don't think a chat client fits the REST architecture well. If you want to do it anyway, you should try to make the "position in the chat buffer" a part of the REST URL (e.g. by giving messages an incrementing id, and the client calls /chatroom/5/getMessages/37 to get all messages in chatroom #5 after message #37


问:
In an MVC system, where should the database persistence code sit?
I've seen multiple configurations for persisting information to the database. Generally, three types of designs seem common in my corner of the world:

Controller manages the persistence

Model manages the persistence

Third party library manages the persistence, usually requiring some sort of annotations on the model.

I'm wondering which configuration (if any) is, conceptually, the easiest to use/most compatible with an MVC architecture?

(If it's not one I listed, please give a quick outline/overview as part of the answer)

答:
Realistically, MVC is mostly a UI implementation pattern, so the question is somewhat moot. However, there are really only two big-picture options. Your controller typically dispatches requests to load or save entities in your model using either 1) a service layer of some kind or 2) the Active Record pattern.

The service layer can take any of a number of forms, though my personal preference is to work with a repository abstraction for the aggregate root entities, the concrete implementations of which will either work with some sort of ORM, or a lightweight DAO, or an API for some non-relational store if that makes sense for the application.

The Active Record pattern means that your model has responsibility for persistence, although it usually means a base class of some sort manages the mappings to your store, so your model is not really that directly involved.

Basically, the controller dispatches requests to persist objects, whether that's a call to your repository, your UnitOfWork implementation, or the Save method on your entities. If you're using repositories, your model objects are persistence-ignorant.


问:
Good open source projects to master Python concurrency
Concurrent programming in Python is very colorful (and confusing too). There's just too many options with each having it's pros and cons...

Thread based (threading module)

Process based ( multiprocessing module)

Co-routines (greenlet, gevent, eventlet)

Async (Twisted, Tornado)

Inter-process communication (subprocess module)

Message queue based (ØMQ, PyCom, mpi4py)

Others (Pyro, execnet, Parallel Python)

I know some of these and can write programs using them. But, I just don't feel I know them pretty well -- I can't decide what to use when. I don't know how to put these into perspective.

So, my simple question is -- what are some open source projects that employ these techniques so that I can see them in action in real program.

答:
There is no real way to say which one is good which one is bad and which one to start with.  This depends greatly on what you intend to do with this knowledge later and your current level of expertise.

Having said that I would probably start with Twisted, and Zope.


问:
Right design pattern to use StopWatch class
I have to measure execution time for a blocks of code. I had implemented simple StopWatch class like http://www.goldb.org/stopwatchjava.html. If I will invoke methods of StopWatch class directly between business logic then my source code became unreadable and unclean.

What design pattern can be useful in my situation to keep code readable and clean?

答:
Measuring of execution time is something that isn't a permanent addition to your code, its a temporary thing for the purpose of testing. Its no big deal if your code looks bad while you are testing this, its like adding code for debugging. It should be tossed in where its needed, the results should be recorded and the code removed. Making it look pretty is a waste of time.

If you need to display execution time to your users, then its part of your programs logic and should be directly implemented as part of whatever logic its tracking. It should have minimal effect on the readability of your code as long as you properly designed the stopwatch class itself. There should be any more than about 4 lines added to any area you are measuring, (declare/initialize, start, stop, get time) and it should be of minimal impact unless your existing code is already poorly structured, which is a separate issue.


问:
How to estimate a timeboxed spike using story points?
So my team and I are quite new to Scrum and today moved from estimating in Ideal Hours to Story Points. All seems sound rationale, BUT with timeboxed activities. Here is the case, we have an extremelly complex User Story that needs a spike so to explore underlying technical unknowns. With Ideal Hours it would be easy: timebox it to one ideal day (8 ideal hours). Now we want to account the exploratory work towards our velocity. So, the pressing question is how do we give Story Points to a timeboxed activity? Constraint: we do not know how to translate this 1 ideal day into Story Points because our historical data is badly collected and does not reflect reality.</p>

答:
we want to account the exploratory work towards our velocity.

Why? Velocity is not for exploratory work but for gauging how much more iterations are needed before you can ship the release or if you fixed number of iteration, it is for gauging how much work you can do in the given time

So, the pressing question is how do we give Story Points to a timeboxed activity?

you don't. You do time boxed activity i.e. spike, (1) to give story points to the actual user story, that you will do later in a sprint, and (2) to break it if it seems complex/big.

we do not know how to translate this 1 ideal day into Story Points because our historical data is badly collected and does not reflect reality.

no one that I know who understands scrums does this.. In real project you may spend, let say, 15 hours on a 3 point story and 9 hours on a 5 point story i.e. more time on less complex story. So what does this mean? it means that although most 5 point stories will have more hours put to them as compared to 3 hours but there can be cases, lets say 25% chance, when a 3 point story can take more time than the mean-time spent on a typical 5 hour story.

Once you have historical data collected it can be like on 3 point stories you have spent between 3 to 18 hours with mean around 4.5 hours. and on 5 point stories you have spent between 3 to 14 hours with mean around 10 hours..


问:
When to stop writing user stories, and start coding?
When discovering stories for the first sprint, how do you know when to stop writing and move forward?

I've asked a few people I know, and basically the response I've gotten is, it depends on the context the project exists in and how timeboxed the overall project is as well.

Is there any standard way for knowing when to stop writing user stories, and if so, what is the basis for this, and how does it apply to future sprints?

答:
you never stop writing stories.. It is just that when you have enough stories for sprint 1, you will do sprint planning and your team will start working as per the sprint backlog.. </p>

<p>Product owner will continue grooming the product backlog i.e. writing more user stories, breaking large stories i.e. epics, into smaller one, elaborating more on stories acceptance criteria, prioritzing... </p>

Body:
you never stop writing stories.. It is just that when you have enough stories for sprint 1, you will do sprint planning and your team will start working as per the sprint backlog..

Product owner will continue grooming the product backlog i.e. writing more user stories, breaking large stories i.e. epics, into smaller one, elaborating more on stories acceptance criteria, prioritzing...


问:
Collaboratively working with a WebDesigner - Best practices
I'm a programmer. I have always worked by myself.
I usually do only back-end, but now I have a webproject that I want to hand the "View" part to a designer to make
it beautiful.

What I'm looking for are suggestions, best practices, recommended literature to make it easy and separate (easy to merge) for both parts.

I googled a lot, so what I want is your personal opinion, experience on this subject.

1 - The back-end will be Java.
2 - Besides the back-end I haven't chosen (opinions ???) on what is best (JSF, only HTML (REST)) for the frontend

Any help and insight is greatly appreciated

Thanks in advance

答:
The choice of framework is less important than actually following MVC good design principles and keeping controller logic out of the view, but even this will be difficult to do with many frameworks becoming more and more tied to componentized Javascript libraries.

For example, in a typical JSF page, you might see the following markup:

```<code><ui:repeat value="#{controller.beanList}" var="bean">
  <h:outputText value="#{bean.description}" rendered="#{(bean.id % 2) eq 0}" />
</ui:repeat>
</code>```

Clearly the repeat element is not a style element, but a component that creates a form elements of its children repeated for each element in the value list.  You also see how only output text will be rendered on the page for beans with an even id.  This can be significant business logic within the EL expression that is not properly unit tested within your view, and thus something to look out for.  A web designer will not know what to do with this rendered attribute nor would you want the designer to specify such logic without it being covered by a unit test which you control.

Some web designers play a smaller role, and focus more on site templates, style sheets and images, while it is the responsibility of the front end developer to utilize these resources.  Sometimes they have to work closely with a developer when perhaps styling the page requires reorganization of form elements in such a way that it might affect controller logic or other presentation logic.

TL;DR It depends.

Body:
The choice of framework is less important than actually following MVC good design principles and keeping controller logic out of the view, but even this will be difficult to do with many frameworks becoming more and more tied to componentized Javascript libraries.

For example, in a typical JSF page, you might see the following markup:

<ui:repeat value="#{controller.beanList}" var="bean">
  <h:outputText value="#{bean.description}" rendered="#{(bean.id % 2) eq 0}" />
</ui:repeat>

Clearly the repeat element is not a style element, but a component that creates a form elements of its children repeated for each element in the value list.  You also see how only output text will be rendered on the page for beans with an even id.  This can be significant business logic within the EL expression that is not properly unit tested within your view, and thus something to look out for.  A web designer will not know what to do with this rendered attribute nor would you want the designer to specify such logic without it being covered by a unit test which you control.

Some web designers play a smaller role, and focus more on site templates, style sheets and images, while it is the responsibility of the front end developer to utilize these resources.  Sometimes they have to work closely with a developer when perhaps styling the page requires reorganization of form elements in such a way that it might affect controller logic or other presentation logic.

TL;DR It depends.


问:
How do I create a potential shippable product (PSP) at the end of a sprint?
I'm running a team of 4 developers and 2 testers and trying to abide by the Scrum principle of creating a PSP with every sprint. That means I need to create a potential release with all the user stories that got to Done and store it on some publish server for the PO to do with as they please.

My problem is how to technically create the build when some stories are not at Done at the end of the sprint? The code is checked in, but didn't completely pass testing.

If I only check-in code that is Done, i.e. code complete-reviewed-tested, I run in to the possibility of diverging code bases and merges that may be disastrous. For instance Developers A and B work on different features that modify assembly X. Dev A finishes coding, pushes assembly X to test. The next day Dev B finishes coding and pushes assembly X to test. Feature A comes back with bugs, feature B is perfect. Oops, sprint is over. Now, how do I create a PSP with feature B but not A?

答:
Dev A finishes coding, pushes assembly X to test. The next day Dev B finishes coding and pushes assembly X to test. Feature A comes back with bugs,

Assuming Feature A stories have unit/acceptance/integration tests.

Developer B check in his code in a staging area.. if all tests pass, including the one for Feature A, Feature B code gets automatically merged to production..

you can do above with Distributed Version Control


答:
If you're measuring methods then this is a classic example of cross-cutting concerns that AOP is designed to solve.

My Java is weak, but something like this in C# using PostSharp would work...

Create a ProfileAttribute class that does the profiling and logs it to some log file/database/whatever

```<code>public sealed class ProfileAttribute : Attribute
{
    private StopWatch stopWatch;

    public override OnEntry(MethodExecutionArgs args)
    {
        this.stopWatch = new StopWatch();
        this.stopWatch.Start();
    }

    public override OnExit(MethodExecutionArgs args)
    {
        this.stopWatch.Stop();
        /*
        log(string.Format("[{0}]{1}.{2} took {3}ms",
            DateTime.Now,
            args.ClassName, // may not be actual member name, I forget
            args.MethodName, // may not be actual member name, I forget
            stopWatch.Elapsed.TotalMilliseconds));
        */
    }
}
</code>```

Then, you can attribute any method that you want to profile (without having to clutter up the code too much) just by applying the attribute like so:

```<code>[Profile]
public void WatchedMethod()
{
    /* Code */
}
</code>```

Afterwards, you can check your log(s) and should see something like:

[Jan 1, 2012 00:00:01]MyClass.WatchedMethod took 1.001ms

[Jan 1, 2012 00:00:02]MyClass.WatchedMethod took 1.000ms

[Jan 1, 2012 00:00:03]MyClass.WatchedMethod took 1.002ms

edits

At which point... it makes sense to write a small utility that can pull the data from logs, filter it, and present it in such a way that is usable to you (average the running times, show outlier times, etc.)

Also note that using certain AOP frameworks (maybe AspectJ... not sure) you can also decide what build(s) certain aspects can be built into... ie. you can weave this profile attribute into the debug build, but not weave it into the release build.

Note about runtime performance:

If your weaver is a compile-time weaver, it will inject the aspect's code into your code during the build. Using PostSharp with the example given, the resulting code will be:

```<code>private StopWatch stopWatch;

public void WatchedMethod()
{
    this.stopWatch = new StopWatch();
    this.stopWatch.Start();

    /* Code */

    this.stopWatch.Stop();
    /*
    log(string.Format("[{0}]{1}.{2} took {3}ms",
        DateTime.Now,
        args.ClassName, // may not be actual member name, I forget
        args.MethodName, // may not be actual member name, I forget
        stopWatch.Elapsed.TotalMilliseconds));
    */
}
</code>```

Title: Right design pattern to use StopWatch class

Body:
I have to measure execution time for a blocks of code. I had implemented simple StopWatch class like http://www.goldb.org/stopwatchjava.html. If I will invoke methods of StopWatch class directly between business logic then my source code became unreadable and unclean.

What design pattern can be useful in my situation to keep code readable and clean?

Body:
If you're measuring methods then this is a classic example of cross-cutting concerns that AOP is designed to solve.

My Java is weak, but something like this in C# using PostSharp would work...

Create a ProfileAttribute class that does the profiling and logs it to some log file/database/whatever

public sealed class ProfileAttribute : Attribute
{
    private StopWatch stopWatch;

    public override OnEntry(MethodExecutionArgs args)
    {
        this.stopWatch = new StopWatch();
        this.stopWatch.Start();
    }

    public override OnExit(MethodExecutionArgs args)
    {
        this.stopWatch.Stop();
        /*
        log(string.Format("[{0}]{1}.{2} took {3}ms",
            DateTime.Now,
            args.ClassName, // may not be actual member name, I forget
            args.MethodName, // may not be actual member name, I forget
            stopWatch.Elapsed.TotalMilliseconds));
        */
    }
}

Then, you can attribute any method that you want to profile (without having to clutter up the code too much) just by applying the attribute like so:

[Profile]
public void WatchedMethod()
{
    /* Code */
}

Afterwards, you can check your log(s) and should see something like:

[Jan 1, 2012 00:00:01]MyClass.WatchedMethod took 1.001ms

[Jan 1, 2012 00:00:02]MyClass.WatchedMethod took 1.000ms

[Jan 1, 2012 00:00:03]MyClass.WatchedMethod took 1.002ms

edits

At which point... it makes sense to write a small utility that can pull the data from logs, filter it, and present it in such a way that is usable to you (average the running times, show outlier times, etc.)

Also note that using certain AOP frameworks (maybe AspectJ... not sure) you can also decide what build(s) certain aspects can be built into... ie. you can weave this profile attribute into the debug build, but not weave it into the release build.

Note about runtime performance:

If your weaver is a compile-time weaver, it will inject the aspect's code into your code during the build. Using PostSharp with the example given, the resulting code will be:

private StopWatch stopWatch;

public void WatchedMethod()
{
    this.stopWatch = new StopWatch();
    this.stopWatch.Start();

    /* Code */

    this.stopWatch.Stop();
    /*
    log(string.Format("[{0}]{1}.{2} took {3}ms",
        DateTime.Now,
        args.ClassName, // may not be actual member name, I forget
        args.MethodName, // may not be actual member name, I forget
        stopWatch.Elapsed.TotalMilliseconds));
    */
}


答: Most high-level MVC samples I've seen have a separate infrastructure layer which has the actual database implementation code (i.e. the specific calls to NHibernate, or EF or Linq or whatever your data layer is), while the "model" layer (often also the "Domain" layer) has the interfaces that define the data services.

Title: In an MVC system, where should the database persistence code sit?

Body:
I've seen multiple configurations for persisting information to the database. Generally, three types of designs seem common in my corner of the world:

Controller manages the persistence

Model manages the persistence

Third party library manages the persistence, usually requiring some sort of annotations on the model.

I'm wondering which configuration (if any) is, conceptually, the easiest to use/most compatible with an MVC architecture?

(If it's not one I listed, please give a quick outline/overview as part of the answer)


问:
Assembly in a research paper
I am doing a research paper on programming, and I need to somehow explain assembly... I've never learned the language, but I understand what it is used for and kinda what it looks like...

```<code>MOV A,47
ADD A,B
HALT
</code>```

And from what I understand, it is used for writing some compilers, small bits of code that need to be really fast, and other tasks... But this is kind of a question for people who have used/studied assembly and understand it fairly well. And no, I'm not asking for you to type up this segment of the research paper for me. That would be selfish. I just need a brief explanation, clarification on the subject (I'm just unsure if what I know is true or not) and a pointer in the right direction.

For a research paper (I need to explain this VERY simply...) what is purpose of using Assembly in today's society? Of course it was important back in the day but now with all the high level languages, when is this low level language used?

答:
The most wide use is as an intermediate step during the compile process, often hidden by the outer compiler command line or gui code.  The compiler produces assembly code then an assembler is called to turn that into some flavor of binary (object or an executable form).  Not uncommon for the compiler command line or gui shell to call the linker so that the user only sees source code go in and an executable come out.

Not all compilers do this, tcc for example has the "machine code" hard coded in the compiler.

Having an intermediate ascii assembly language step separates the compiler development from the assembler development.  Compiler writers can directly see the output of their work, they dont have to disassemble (which on some platforms is problematic) to figure out what their compiler produced.  the assembler program/tool has to be there anyway, so might as well leverage it instead of re-invent it in the compiler.

bootloaders and startup and shutdown code that leads and follows compiled code often needs to be written in assembly language because hand written assembly doesnt have to conform to calling standards, where compiler generated assembly does often conform to a calling standard.  Someone has to setup the stack and zero .bss memory and those sorts of tasks before the compiled code can operate using its calling convention.

Sometimes assembly is used for hand optimizing something the compiler and or language was not able to not produce fast enough code for the problem being solved.

Microcontrollers, both because some use cpus that do not have enough of a market to produce a great compiler, and because they are very resource limited to the point that having to double or triple the clock speed or amount of ram/rom to use compiled code is not worth it.  You will find a larger percentage of this market uses asm compared to normal applications and operating systems.

Hopefully learning for educational purposes is a reason to use asm.  Once you learn even one, esp if you learn a few different instruction sets, you both gain an appreciation for what the compiler and language is doing, and often as a result of this education you write better (performance and reliability) high level language code.

Title: Assembly in a research paper


问:
How do people doing TDD handle loss of work when doing major refactoring
For a while I have been trying to learn to write unit tests for my code.

Initially I started out doing true TDD, where I wouldn't write any code until I'd written a failing test first.

However, I recently had a thorny problem to solve which involved a lot of code. After spending a good couple of weeks writing tests and then code, I came to the unfortunate conclusion that my entire approach was not going to work, and I would have to throw out two weeks work and start again.

This is a bad enough decision to come to when you've just written the code, but when you've also written several hundred unit tests it becomes even more emotionally difficult to just throw it all away.

I can't help thinking that I've wasted 3 or 4 days of effort writing those tests when I could have just put the code together for proof of concept and then written the tests afterwards once I was happy with my approach.

How do people who practice TDD properly handle such situations? Is there a case for bending the rules in some cases or do you always slavishly write the tests first, even when that code may turn out to be useless?

答:
For me unit tests are also as an occasion to put the interface under "real" use (well, as real as unit tests go!).

If I am forced to set up a test I have to exercise my design. This helps to keep things sane (if something is so complex that writing a test for it is a burden, what will it be like to use it?).

This doesn't avoid changes in the design, rather it exposes the need for them. Yes, a complete rewrite is a pain. To (try to) avoid it I usually set up (one or more)  prototype, possibly in Python (with the final development in c++).

Granted, you don't always have the time for all these goodies. Those are precisely the cases when you will need a LARGER amount of time to achieve your goals...and/or to keep everything under control.


答:
Since you said "the" language and "this" language I wanted to make sure you understood that Assembly is not a single language.  It has similar structure, but is different for every different kind of processor.  That's why it's most often used to access features specific to a processor.

Assembly is pretty much directly translated into machine code, which is the ones and zeroes that the processor directly operates on.  MOV A, 47 on a hypothetical processor might translate into 010110 01 00101111 in machine code, where 010110 means MOV, 01 means the A register, and 00101111 is the value to move.  This one-to-one correspondence makes it very easy to "disassemble," or translate machine code back into assembly code.

It's the only code you can't hide from its users, which makes knowing it a necessity for nefarious purposes like cracking software or exploiting vulnerabilities, or defending against such attacks.  Because one high-level statement might result in dozens of assembly instructions, it's also handy to be able to read assembly during debugging, as it can help narrow down the problem.

However, its most common modern usage is as a smug ego boost when you want to look down upon ignorant colleagues :-)

Title: Assembly in a research paper

Body:
I am doing a research paper on programming, and I need to somehow explain assembly... I've never learned the language, but I understand what it is used for and kinda what it looks like...

```<code>MOV A,47
ADD A,B
HALT
</code>```

And from what I understand, it is used for writing some compilers, small bits of code that need to be really fast, and other tasks... But this is kind of a question for people who have used/studied assembly and understand it fairly well. And no, I'm not asking for you to type up this segment of the research paper for me. That would be selfish. I just need a brief explanation, clarification on the subject (I'm just unsure if what I know is true or not) and a pointer in the right direction.

For a research paper (I need to explain this VERY simply...) what is purpose of using Assembly in today's society? Of course it was important back in the day but now with all the high level languages, when is this low level language used?


问:
What characteristics or features make code maintainable?
I used to think I knew what this was, until I really started thinking about it... "maintainable"... what exactly makes code maintainable?

To me, if code must be maintainable that means we can expect to revisit the code to make some sort of change to it in the future. Code is always "changeable" no matter what state it is in. So does this mean code needs to be easy to change? However, if our code was scalable/extensible, there would be no need to directly change it, because it will "change" (adapt) for free and automatically.

I've also seen code maintainability used interchangeably with coding standards. Using a consistent coding pattern or style, does this really make code more maintainable? More readable and more consistent? Sure, but how does this improve the maintainability?

The more I try to think into this, the more confused I get. Anyone have a proper explanation?

答:
Coding standards help in that your code base should be consistent, therefore easier to grok than a code base that contains multiple coding styles. Something that's easier to understand is easier to maintain.

To me, maintainable code really means code that reads like a book and is well documented.

Maintainable code is unit (and functional/integration if needed) tested so that if a change is made that introduces a knock-on effect, it's caught quickly and early, before the code's even checked in.

To me, maintainable code doesn't take advantage of quirky language features that 0.1% of the programming population is aware of (i.e. simple example: using an XOR swap instead of a temporary variable just because the author thinks "it's cool".

Maintainable code also implements sound architectural principles: DRY, SOLID, etc. It uses known design patterns and algorithms to solve appropriate problems.


问:
How can I design an application so that it works well with a database selected by the customer?
I want to write an ASP.NET 4.0 application with IBM DB2 Express-C as its back-end. One thing that worries me, is hosting this application on a remote server. I don't know any hosting provider who provides ASP.NET DB2 hosting in the same price range as of SQL Server.

I also want to allow the customer to select the database of their choice from this list:

SQL Sever

Oracle

DB2

PostgreSQL

Firebird

There are the same hosting worries with Oracle and Firebird.

Hosting issues aside, I want to know how to design an application so it is agnostic to the kind of RDBMS used and will work with any of the above mentioned ones.

Are there any such applications around?

答:
The answer to use an ORM that allows you to abstract that away from the databases themselves.
NHibernate is the first that comes to mind, though EF is an acceptable choice is there's an adaptor for the DBs you need. I'm not sure how good the support is for DB2, but SQL Server and Oracle work fine. </p>

<p>As to stored procedures and trigger: don't use them. As soon as you need to move any logic into the database, you're stuck managing them in all the databases you support. If you can let any logic living in the application layer behind an abstraction (NHibernate) then you can get away with the framework doing the translation for you. HQL will allow you write SQL like queries for NHibernate that are an abstraction as well if needed. </p>

Body:
The answer to use an ORM that allows you to abstract that away from the databases themselves.
NHibernate is the first that comes to mind, though EF is an acceptable choice is there's an adaptor for the DBs you need. I'm not sure how good the support is for DB2, but SQL Server and Oracle work fine.

As to stored procedures and trigger: don't use them. As soon as you need to move any logic into the database, you're stuck managing them in all the databases you support. If you can let any logic living in the application layer behind an abstraction (NHibernate) then you can get away with the framework doing the translation for you. HQL will allow you write SQL like queries for NHibernate that are an abstraction as well if needed.


问:
PHP Aspect Oriented Design
This is a continuation of this Code Review question.

What was taken away from that post, and other aspect oriented design is it is hard to debug. To counter that, I implemented the ability to turn tracing of the design patterns on. Turning trace on works like:

```<code>//This can be added anywhere in the code
Run::setAdapterTrace(true);
Run::setFilterTrace(true);
Run::setObserverTrace(true);

//Execute the functon
echo Run::goForARun(8);
</code>```

In the actual log with the trace turned on, it outputs like so:

```<code>    adapter 2012-02-12 21:46:19 {"type":"closure","object":"static","call_class":"\/public_html\/examples\/design\/ClosureDesigns.php","class":"Run","method":"goForARun","call_method":"goForARun","trace":"Run::goForARun","start_line":68,"end_line":70}

filter 2012-02-12 22:05:15 {"type":"closure","event":"return","object":"static","class":"run_filter","method":"\/home\/prodigyview\/public_html\/examples\/design\/ClosureDesigns.php","trace":"Run::goForARun","start_line":51,"end_line":58}

observer 2012-02-12 22:05:15 {"type":"closure","object":"static","class":"run_observer","method":"\/home\/prodigyview\/public_html\/public\/examples\/design\/ClosureDesigns.php","trace":"Run::goForARun","start_line":61,"end_line":63}
</code>```

When the information is broken down, the data translates to:

Called by an adapter or filter or observer

The function called was a closure

The location of the closure

Class:method the adapter was implemented on

The Trace of where the method was called from

Start Line and End Line

The code has been proven to work in production environments and features various examples of to implement, so the proof of concept is there. It is not DI and accomplishes things that DI cannot. I wouldn't call the code boilerplate but I would call it bloated. In summary, the weaknesses are bloated code and a learning curve in exchange for aspect oriented functionality.

Beyond the normal fear of something new and different, what are other weakness in this implementation of aspect oriented design, if any?

PS: More examples of AOP here: https://github.com/ProdigyView/ProdigyView/tree/master/examples/design

答:
It doesn't really seem like AOP, because you still have to copy that snippet of code everywhere.  It's more encapsulated, sure, but it's still "infecting" your normal business logic.  So if setAdapterTrace needs another parameter, or something else like that changes, you now have to change all the other classes using it.  This is less of an issue with PHP than with, say, .NET or Java, because of its dynamic nature, but it still seems like something that clashes with the single responsibility principle (which I assume is your reason for going through all of this). At best, it's like a "poor man's AOP".

If you are intent on using AOP with PHP, have you looked at existing tools like php-aop?  I haven't, so I'm interested in what you might find lacking in them that you would want to write your own AOP tool.

I should also note that web frameworks like CakePHP may possess some AOP-like functionality that you could use (e.g. beforeFilter in CakePHP). So if you're using a framework, you may already have the capabilities you need.

Title: PHP Aspect Oriented Design


答: Maintainability isn't a binary property, either being maintainable or not.  It's a continuum.  Roughly speaking, maintainability is inversely proportional to the amount of time it takes a developer to make a change and the risk that change will break something.  Improving readability, coupling, or consistency all contribute to maintainability because it won't take as long to make any given change.  Maintainability is easier to recognize by its absence, like when something you thought should take an hour ends up taking a week.</p>

Title: What characteristics or features make code maintainable?

Body:
I used to think I knew what this was, until I really started thinking about it... "maintainable"... what exactly makes code maintainable?

To me, if code must be maintainable that means we can expect to revisit the code to make some sort of change to it in the future. Code is always "changeable" no matter what state it is in. So does this mean code needs to be easy to change? However, if our code was scalable/extensible, there would be no need to directly change it, because it will "change" (adapt) for free and automatically.

I've also seen code maintainability used interchangeably with coding standards. Using a consistent coding pattern or style, does this really make code more maintainable? More readable and more consistent? Sure, but how does this improve the maintainability?

The more I try to think into this, the more confused I get. Anyone have a proper explanation?


问:
How can I explain the difference between NULL and zero?
Working on a problem that uses the percent change formula:

```<code>percent change =  100 * [(new value - old value) / old value]
</code>```

How would I explain the difference if new value or old value = NULL, rather than 0 to someone who might not be a programmer?

My boss is wondering why there is an empty string in the TextBox rather than a value, because we have the old value, but not the new value.

答:
OldValue=Null you don't know the Old value so the Difference is Unknown (Null)

OldValue=0 You know the Old value, it is 0, so the Difference is Infinity (Null)

If its important to distinguish between these two, simply store the Old value as PreviousValue and display its somewhere.

Edit based on the comment below:

I would just ask him what he wants do in the following situations and show him examples of each of these. Then and ask him "What value do you want to display for these?"

Do not in any way make this a computer issue.. It's a business question.


答:
Maintainable code is code that exhibits high cohesion and low coupling. Cohesion is a measure of how related, readable and understandable code is. Coupling is a measure of how related code is, low coupling means that changing how A does something shouldn't affect B that uses A. Generally lower coupling means lower cohesion, and vice versa, so a developer need to find an appropriate balance between the two.

Maintainability is itself a measure of the ease to modify code, higher maintainability means less time to make a change. Coding standards are a way to achieve high maintainability and are developed as a result of previous experiences, they aren't universal and are dependent on developer preferences.


答:
The standard practice in MVC is to include data structure and persistence in the M(odel) layer.

The model layer does not only include the classes (POCOs etc) you are going to use in your application. They include the repositories for those classes.

An example would be a repository where you have bunches of data classes instances, ie:

```<code>Clients repository

AllClients()
RecentClients()
ClientByID(int id)
</code>```

You will be able to organize your model domain way better, and also have access to your data through many ways, but still the data/model layer will be compact and robust

Body:
The standard practice in MVC is to include data structure and persistence in the M(odel) layer.

The model layer does not only include the classes (POCOs etc) you are going to use in your application. They include the repositories for those classes.

An example would be a repository where you have bunches of data classes instances, ie:

Clients repository

AllClients()
RecentClients()
ClientByID(int id)

You will be able to organize your model domain way better, and also have access to your data through many ways, but still the data/model layer will be compact and robust


问:
What tools do you use to manage requests from users?
I'm drowning in user emails and I'd like to implement a better way to manage all these requests I get and put them in a queue where those people on a team, as well as users, have access to them and can make common notes. I'm thinking about some sort of task management tool that would allow multiple tasks to be created under a project where emails, comments, ideas, etc. could be dropped/entered and easily accessible.

I need something that all parties can be involved in - users, managers, team leaders, developers. I'm looking for a tool that can allow:

Users to just drag/drop an email to submit a request for maintenance or enhancement.

Developers to just see their queue and the weighted priority of each task/project.

A team of developers to see what everyone is working on in real-time.

Management to keep a a log of time spent on each task.

I I am starting to look in more of a Agile/Scrum direction for solving this problem. I found list of scrum agile sofware project management open source tools. Since I am limited on time, has anyone used these? Which one should I test to see if it will meet my needs? TeamPulse is a good direction, but think it is a little too bloated. I need something simple for all parties.

答:
No where near as "formal" as Bugzilla or Fogbugz or any of those, but as a way to keep your clients more engaged, I've used Google Docs with great results. Certainly, it would be a good first step from the total chaos that is everybody just emailing you all the time.

It works really well when there's more than one person sending you requests as well. Because everybody can see what everybody else has written, you're less likely to get different people all sending in the same thing. And you can update the points one-at-a-time when done.

If someone sends me an "out-of-band" email, I'll just ask them to add it to the doc.


答:
If the old value is null the result of the equations should rightly be null. This is because null is not a number, it means unknown value.  Therefore the calculation cannot proceed.

Of course your equation also fails if old value = 0 as you cannot divide by zero.

Typically you handle these things with a case statement that will take you the path of what you want to show. So if you want the result to show as null when you can't calculate (as with a null or a zero, then you would do a case statement something like

```<code>case when [old value] = 0 then null
else 100 * (([old value] - [new value]) /[old value])
end
</code>```

Title: How can I explain the difference between NULL and zero?

Body:
Working on a problem that uses the percent change formula:

```<code>percent change =  100 * [(new value - old value) / old value]
</code>```

How would I explain the difference if new value or old value = NULL, rather than 0 to someone who might not be a programmer?

My boss is wondering why there is an empty string in the TextBox rather than a value, because we have the old value, but not the new value.

Body:
If the old value is null the result of the equations should rightly be null. This is because null is not a number, it means unknown value.  Therefore the calculation cannot proceed.

Of course your equation also fails if old value = 0 as you cannot divide by zero.

Typically you handle these things with a case statement that will take you the path of what you want to show. So if you want the result to show as null when you can't calculate (as with a null or a zero, then you would do a case statement something like

case when [old value] = 0 then null
else 100 * (([old value] - [new value]) /[old value])
end


答:
To explain to a boss the difference between "zero" and "null":

"Zero" is a value. It is the unique, known quantity of zero, which is meaningful in arithmetic and other math.

"Null" is a non-value. It is a "placeholder" for a data value that is not known or not specified. It is only meaningful in this context; mathematical operations cannot be performed on null (the result of any such operation is undefined, and therefore also generally represented as null).

For example, as in the comments: "What is your yearly income?" is a question requiring a numeric answer. "0" is a perfectly valid answer for someone who does not work and has no investment income. If the user does not enter a value at all, they don't necessarily make no money; they just didn't want to tell your software how much (or little) they make. It's an unknown, not specified; therefore, to allow the software to continue, you specify the "null" placeholder for that data field within the software. That's technically valid from a data perspective; whether it's valid at the business level depends on whether an actual numeric value (even zero) is required in order to perform a mathematical operation (such as calculation of taxes, or comparison with thresholds determining benefits).

In computers, virtually any operation on a variable containing null will result either in null or in an error condition, because since one of the variable's values is not known, the result of the expression cannot be known. The equivalent of performing math on null would be if I asked you "What's five plus the number I'm thinking of right now?". It's impossible for you to give a definite answer because you don't know the number I'm thinking of. An operation on zero, except for dividing by it, is usually valid and will return another known, unique value.


问:
What is the difference between distributed and non-distributed version control?
What are the internal structural differences between distributed (e.g Git & Mercurial) and non distributed (Subversion) version control?

The question came from a discussion group where a tool was interacting with CVS and it was argued whether it would be easily ported to other systems or not.

答:
Main internal structural differences I can think of:

On distributed you get all the previous versions with each pull/get

On distributed you don't have to phone home when you are about to start editing a file.

On distributed you will have to have all the functionalities of merging, checking in, etc, because each instance is a full-featured repository

As far as a client goes, a non distributed source control client would be ok if it could do the basic tasks of: getting a specific version, phoning in to tell that you are working on a file, and sending back the changes after looking/resolving any conflicts


答:
I've had a lot of success with 'blank.'

With people that understand basic algebra (or the simple idea that you can assign a value to a symbol), the idea of a 'blank' value seems to be pretty straightforward and distinct from a zero-value.


答:
Boss-speak is always tough...

Zero is a number so you can do things with it.

Null is a unicorn.  It doesn't exist so you can't do anything at all with it.


答:
Just rephrase the equations into sentences:

"What is the percentage change if you start with an unknown value and
  you end up with 150?"

and

"What is the percentage change if you start with 85 and you end up
  with some unknown value?"

Of course, the answer to both is "It can't be calculated, because one of the critical pieces of the calculation is missing." That's the essence of 'null'.

It should be easy then to figure out the equivalent sentences with zero, and see how they are fundamentally different:

"What is the percentage change if you start with an 0 and you end up
  with 150?"

and

"What is the percentage change if you start with 85 and you end up
  with 0?"

Although the answers might not make a lot of sense (with zeroes), at least it can be calculated. With null, the calculation is not even possible.


答:
NULL is not a value, its a lack of one. Zero is still a value. (even if it can be used in cases where it cant be fully evaluated.

By analogy (a good way of explaining to non teckies;

```<code>if I have three apples then I subtract three apples how many apples do I have? is 0

If I have a bag of apples and I never look in the bag, how many apples do I have? is null
</code>```

Although in this case the two may have the same value (depending on your langage) they are conceptually very different

Body:
NULL is not a value, its a lack of one. Zero is still a value. (even if it can be used in cases where it cant be fully evaluated.

By analogy (a good way of explaining to non teckies;

if I have three apples then I subtract three apples how many apples do I have? is 0

If I have a bag of apples and I never look in the bag, how many apples do I have? is null

Although in this case the two may have the same value (depending on your langage) they are conceptually very different


问:
Ignoring unit tests - good and bad reasons when and why?
Recently I began a new project to re-implement a core part of automation. Since it is very important, I'm TDDing it so that I can tests various basic scenarios as well as things we know the old system doesn't do.

In doing this, I find myself creating a few "sandbox" tests, which exercise "candidate" algorithms in complete isolation so I can choose the one that best meets requirements. I've also created some tests to figure out why other tests are failing, which again are coded in a "sandbox" manner and don't test actual production code (they instead have a simplification of the production environment that I can alter until I find the problem/cause/solution). Neither of these has continuing value for regression; once I pick an algorithm I may never use the others, and once a test shows why another test is failing, I can correct the initial test (or its exercised production code) and verify correctness, and I no longer care that the other test's hard-coded exercise environment still fails.

When learning TDD I was taught that you NEVER delete a unit test; even if the test's original purpose has become irrelevant, the code within the test can be of use to other developers as a model, or the test can be refactored for some other purpose later. Instead, if a test has become redundant or irrelevant and should no longer be run, pass or fail, it should be ignored.

Is this the "generally-accepted" stance on ignoring tests? Does this have the potential for abuse (e.g. "I don't think it matters anymore, and it fails, so I'll just ignore it")?

答:
I would rather have all of my tests pass at any given point when they are executed. If a test fails and there is no documentation explaining why it is expected to fail, then it shouldn't simply be ignored. Any other developer working with these tests will be confused since they will not immediately know whether a recent change they made affected the outcome of any failed tests.

Imagine having to explain to a co-worker or manager why certain failed tests are to be "ignored". I don't think you will have an easy time explaining to them why these failures are a positive thing and do not need to be addressed.

Remember that you are testing your code to ensure correctness. Failures should only ever indicate that the code being tested is incorrect, and incorrectness should never be ignored.


答:
once I pick an algorithm I may never use the others,

False for well-written tests which exercise the interface of the algorithm.

If your tests exercise implementation details, and the implementation no longer applies, then the tests no longer apply.  Delete them.

and once a test shows why another test is failing, I can correct the initial test (or its exercised production code) and verify correctness, and I no longer care that the other test's hard-coded exercise environment still fails.

Um.  You should fix the "other test's hard-coded exercise environment" so that it's meaningful and useful and correct.

If a test is wrong (even if redundant) it should be corrected so that it's right.

TDD means tests are right, first and foremost.  Code will get right eventually.

"and it fails, so I'll just ignore it"

This is not a potential for abuse.  This is abuse.

You cannot ignore a failing test.  If the test is wrong it must be fixed.

Removing tests that seem redundant is a waste of time.  Extra testing never hurt anybody.  Indeed, it may uncover super-subtle errors that pass one version of  a test by fail another version of a superficially similar test.  This may indicate design errors in an interface more than an implementation bug.

Title: Ignoring unit tests - good and bad reasons when and why?

Body:
Recently I began a new project to re-implement a core part of automation. Since it is very important, I'm TDDing it so that I can tests various basic scenarios as well as things we know the old system doesn't do.

In doing this, I find myself creating a few "sandbox" tests, which exercise "candidate" algorithms in complete isolation so I can choose the one that best meets requirements. I've also created some tests to figure out why other tests are failing, which again are coded in a "sandbox" manner and don't test actual production code (they instead have a simplification of the production environment that I can alter until I find the problem/cause/solution). Neither of these has continuing value for regression; once I pick an algorithm I may never use the others, and once a test shows why another test is failing, I can correct the initial test (or its exercised production code) and verify correctness, and I no longer care that the other test's hard-coded exercise environment still fails.

When learning TDD I was taught that you NEVER delete a unit test; even if the test's original purpose has become irrelevant, the code within the test can be of use to other developers as a model, or the test can be refactored for some other purpose later. Instead, if a test has become redundant or irrelevant and should no longer be run, pass or fail, it should be ignored.

Is this the "generally-accepted" stance on ignoring tests? Does this have the potential for abuse (e.g. "I don't think it matters anymore, and it fails, so I'll just ignore it")?


问:
How do programmers quit a job?
I'm thinking about leaving my current employer and wondering how one goes about that process in the programming world. We have a lot of projects on the go at the moment and I'm the only developer. We have 4-5 projects that are fairly big and need to be done in the next few months and even a few longer than that.

I'm leaving because I'm the only employee and that's doing me no good. I'm young and want to learn, so a team would be nice. It's also too much work and the company is managed horribly.

I have no contract to worry about so I could theoretically quit and just not come back without notice. Just wondering how this is normally handled.

Should I write a resignation letter

How much notice should I give

Should I give a reason for leaving

Should I go to my boss who is the main reason I'm leaving or go to his boss?

Overview of replies

From the feedback here, it looks as though it's best to give 2-4 weeks of notice, and present a written resignation. Don't go into detail explaining why you're leaving in most cases. Don't burn bridges. Be professional.

答:
Usual procedure is to write a resignation letter.  It can be as brief as "$MANAGER: Effective $DATE, please accept my resignation from $COMPANY."  Give at least two weeks notice, if possible.  Normally in your situation (sole developer), you would offer to document everything and offer to answer e-mail questions from your replacement for a couple of weeks after they hire one.  Definitely don't delete anything or do anything else spiteful.  For all you know, the person they hire to replace you will wind up becoming influential and will make your professional life miserable.  Leave everything the way you wish you'd found it your first day on the job.

I'd also recommend not leaving before you have a new gig lined up, but that's just me.

Title: How do programmers quit a job?


答:
That's how I always successfully explain it:

0 is the number 0.

NULL is nirvana, nothing, nada, niente, non-existence, absence.

Arithemetical operations defined on NULL always yield NULL as a result.

... worked for me so far.


答:
How about this:

0 is the answer to "how much liquid is there in an empty bottle?".

NULL is the answer to "what is the content of an empty bottle?".

Or if you imagine a childless man:

the number of his children is 0

his oldest child is NULL

The basic difference is that 0 is about measurable quantity, while NULL is about existence. Being a quantity, 0 represents something, i.e. a quantity, that is 0, much like 0.000000001 represents a quantity (one that in problems of every day life is in fact indistinguishably close to 0). In contrast to that NULL represents nothing. In fact there's nothing close to NULL. Any variable's (and expressions) value is either NULL or something.


答:
If you stick with the capabilities provided by Entity Framework, you should be OK for SQL Server and Oracle support, and probably DB2 as well.

I would caution, however, that you not look at this as simply a matter of different SQL dialects.  Have you considered the different security models these databases have?  Have you thought about how you're going to maintain your database scripts?  Are you going to have test environments for all these databases?  How are you going to generate sizing metrics, so customers know how much disk usage to expect?  I work for a pretty large software shop, and we don't support any databases we don't have to, just because of all the overhead it involves.

Title: How can I design an application so that it works well with a database selected by the customer?

Body:
I want to write an ASP.NET 4.0 application with IBM DB2 Express-C as its back-end. One thing that worries me, is hosting this application on a remote server. I don't know any hosting provider who provides ASP.NET DB2 hosting in the same price range as of SQL Server.

I also want to allow the customer to select the database of their choice from this list:

SQL Sever

Oracle

DB2

PostgreSQL

Firebird

There are the same hosting worries with Oracle and Firebird.

Hosting issues aside, I want to know how to design an application so it is agnostic to the kind of RDBMS used and will work with any of the above mentioned ones.

Are there any such applications around?


问:
Available options for classifying words in text?
I am researching ways to classify words in text and I'm wondering what options there are and which are best suited to this job. I'm mostly interested in keywords which are most often nouns.

So far I know I could use a Bayes classifier, blacklist, or whitelist. However, I haven't had the best of luck with each of these so far.

I started with a whitelist using the words provided by wordnet and moby to attempt to spot each noun. However, many words were missed as not existing in the database, or not being nouns.

Next I tried building a blacklist to match everything except known stop-words, verbs, and such. However, It would take a long investment of time to build a list large enough to handle the 200,000 known English (let alone other languages) words. In addition, keeping that many words in memory for comparison is not practical for performance on commodity hardware.

Using I have had luck with a bayes classifier matching spam and sentiment, but I'm not sure how to use it to tell nouns (or keywords) from other words since there are so many similarities between all the groups of words.

Last, I tried using regex to spot keywords based on proper nouns and names since they are always capitalized in English. The problem is that many keywords are not capitalized resulting in lacking results.

What other options exist for classifying keywords? What other design patterns could I use with the options above for better results?

答:
Possibly you are looking for Natural Language Processing?

To classify keywords, I would build up a corpus of sample text (or use an existing corpus).  Then I would 'train' a natural language algorithm on your corpus.  Then I would use that trained algorithm on whatever text you want to classify.

To get you started, here's a link to Apache's NLP project.  And here is a book I've on Natural Language Processing with Python I've been eying.


问:
Java IDE written in pure Java?
Is there a Java IDE written in Java?

I just got my year 9 DET laptop today at school, and there are all sorts of restrictions set in place. Somewhat annoyingly, you cannot run any executable other than the ones already installed on the system (for some reason they haven't disabled the use of Command Prompt, PowerShell, or strangely enough, regedit). They allow you to run Java executables, so I thought that would be the only way to be able to program on my crappy laptop at school (when I have finished all my work, naturally) :D

Edit:

By written in Java, I also mean that the executable, that is used to run the program, has the file extension ".jar", thus running on the JVM.

Edit 2:

I tried the DrJava IDE, and it worked great, thanks (I can compile and execute programs)! Regarding running Eclipse as through the command line using the command "java -jar "C:/Users.../org.eclipse..."". This results in an error producing a log saying file, the main error is:

MESSAGE An error occurred while automatically activating bundle org.eclipse.ui.workbench (182).

How do I fix this error (I much perfer working with Eclipse than any other IDE)?

Edit 3:

Regarding my last edit, just disregard it :D. I fixed the problem by downloading the latest version of Eclipse.

答:
Can you boot from your thumb drive?  If so, then that's the way to go.  I'm sure you can find a version of Ubuntu or Mint that you can set up, and then you can do whatever you need.

If you can't even do that, you might want to try writing a launcher of some sort.  Just a simple Java program that takes your command arguments and executes them from the Java runtime (basically Runtime.exec("your commands here");).  I have no idea how they've locked down your laptop, so I can't say whether it'll work or not, but it should be quick enough to try.

Title: Java IDE written in pure Java?


答:
Code maintainability is the synergy realized when we apply all those coding axioms, rules of thumb, principles, etc. It is more art than science. To the extent that we have cooked in an appropriate amount of all these things, the code base is maintainable. Code is not maintainable (yes/no, on/off, either/or) just because you are able to change it (or not).

However, the acid test of maintainability is attempting to change the code. To the extent that the code resists, or doesn't resist, your interaction with it defines it's maintainability.

Maintainability has "abilities". Including, but not limited to

readability

understandability

changeability

testability

reliability

others?

How do we attain these abilities?

Through application of all those software principles and guidelines you've ever or maybe never heard of. For example:

Good comments

descriptive variable, method, class names

Limit methods to no more that a page in length

Maximize cohesion and minimize coupling

encapsulate that which stays the same

encapsulate that which changes

code layout/formatting guidelines applied consistently

One entry point only, and one exit point only.

... and many, many, more ...

For good maintainability one must consider all of them, all the time, at every level of the code, and apply them in an (not "the") appropriate mix. Further, and I cannot emphasize this enough, no principle works best (or very well at all, perhaps) alone.

Seek Your Roads To Damascus

Several years ago two things came together. A set of programs that were literally unmaintainable and my discovery of Code Complete by Steve McConnell. This book was my bible in rewriting all that worse-than-failure code and the "before and after" comparison of the code was nothing short of revelation.

Find your roads to Damascus. It's a target rich environment.

Read Code Complete

I cannot overstate just how good this book is for learning fundamental software development principles.


答:
Though, I am not sure if I would label it an "IDE", it is a text editor centred around programmers and does come in executable JAR format. Take a look at jEdit, I have provided a link below to the download page.

In your case, you would download the Java-based installer.

http://www.jedit.org/index.php?page=download

There are many plugin(s) available, so, you could essentially build it into an IDE. It got a favourable reception as well, you can see this on the Wikipedia page below.

https://en.wikipedia.org/wiki/JEdit

Title: Java IDE written in pure Java?

Body:
Is there a Java IDE written in Java?

I just got my year 9 DET laptop today at school, and there are all sorts of restrictions set in place. Somewhat annoyingly, you cannot run any executable other than the ones already installed on the system (for some reason they haven't disabled the use of Command Prompt, PowerShell, or strangely enough, regedit). They allow you to run Java executables, so I thought that would be the only way to be able to program on my crappy laptop at school (when I have finished all my work, naturally) :D

Edit:

By written in Java, I also mean that the executable, that is used to run the program, has the file extension ".jar", thus running on the JVM.

Edit 2:

I tried the DrJava IDE, and it worked great, thanks (I can compile and execute programs)! Regarding running Eclipse as through the command line using the command "java -jar "C:/Users.../org.eclipse..."". This results in an error producing a log saying file, the main error is:

MESSAGE An error occurred while automatically activating bundle org.eclipse.ui.workbench (182).

How do I fix this error (I much perfer working with Eclipse than any other IDE)?

Edit 3:

Regarding my last edit, just disregard it :D. I fixed the problem by downloading the latest version of Eclipse.


问:
Is it a good habit to use C expressions in C++ code?
At school we started learning C this year, despite the fact I'm way ahead of class, and I learned Java, C++ and C while the class is at the base of C. Anyhow, I've been documenting myself, reading books, articles, and I've asked my teacher why I should learn C, and she said it was the foundation of C++. When I first started programming I found C++ alot easier, I later on learned C. But In books you can see that C code works in C++ yet it doesn't go vice-versa.

My question is pretty straightforward ~ Is it a good habit to use C expressions in C++? Let me give you an example:

Should this code

```<code>#include <stdio.h>
#include <iostream>

int main() {
int x;
scanf("%d", &x);
cout << "The number you entered is " << x << "And it's double is " << x*x;
return 0;
}
</code>```

Be more efficient or better in any way than this:

```<code>#include <iostream>

int main() {
int x;
cin >> x;
cout << "The number you entered is " << x << "And it's double is " << x*x;
return 0;
}
</code>```

I have already done some easy documentation on this in some dusty old books, and from what I could find, using scanf instead of cout also flushes the stream or something like that, so I'm basically asking if it's better to use scanf and in what contexts.

This also applies to file IO as I've always found FIle IO to be easier in C than in C++. This question goes for pretty much every general expression in C applied to C++. It's also notable that I'm using a modern compiler and nevertheless this should not matter as I'm asking if it's a good programming habit to use C expressions in C++ code.

There are probably cons and pros of doing this, but I'm only looking for a yes/why, no/why type of answer.

Also if there are any details I've left out post a comment.

答:
In general, C and C++ are looked at as if they are two completely separate languages.  Therefore, it may be considered bad form to use C syntax in a C++ program.

You are correct; however, that C code will compile just fine.  It really depends on how flexible your company is in terms of following standards.  If I were ever asked the question in an interview, I would be sure to let the interviewer know that C works in C++, but also that C and C++ are two separate languages and probably shouldn't be mixed unless there was a very, very good reason for doing so.

Another thing to consider is that standards help create a platform where more people can easily work with code. While you were lucky to have a teacher who encouraged you to learn C, not everyone may be as fortunate.  Therefore, mixing C in a C++ program could be confusing to someone who had never learned C.

In summary, just because you can do something doesn't mean you should, and just because you shouldn't do something doesn't mean you can't :)


答:
C++ is backward compatible with C by design, so usually C code will be compiled by C++ compiler just fine (usually because there are additional reserved words in C++ that are not in C, and could be used in C code breaking the compilation).

However, I see it as bad practice mixing code. If you use scanf - use printf, if you're using operator >> - use operator <<. Reason being that the overloaded C++ operators might encapsulate functionality that you're not aware of, and mismatching them will cause your program doing stuff you didn't want it to do.

There's no particular reason to prefer C syntax in C++ code, these are different languages, and when using C syntax in C++ code - you're still writing C++ code, just not using many of its powerful tools.

Title: Is it a good habit to use C expressions in C++ code?

Body:
At school we started learning C this year, despite the fact I'm way ahead of class, and I learned Java, C++ and C while the class is at the base of C. Anyhow, I've been documenting myself, reading books, articles, and I've asked my teacher why I should learn C, and she said it was the foundation of C++. When I first started programming I found C++ alot easier, I later on learned C. But In books you can see that C code works in C++ yet it doesn't go vice-versa.

My question is pretty straightforward ~ Is it a good habit to use C expressions in C++? Let me give you an example:

Should this code

```<code>#include <stdio.h>
#include <iostream>

int main() {
int x;
scanf("%d", &x);
cout << "The number you entered is " << x << "And it's double is " << x*x;
return 0;
}
</code>```

Be more efficient or better in any way than this:

```<code>#include <iostream>

int main() {
int x;
cin >> x;
cout << "The number you entered is " << x << "And it's double is " << x*x;
return 0;
}
</code>```

I have already done some easy documentation on this in some dusty old books, and from what I could find, using scanf instead of cout also flushes the stream or something like that, so I'm basically asking if it's better to use scanf and in what contexts.

This also applies to file IO as I've always found FIle IO to be easier in C than in C++. This question goes for pretty much every general expression in C applied to C++. It's also notable that I'm using a modern compiler and nevertheless this should not matter as I'm asking if it's a good programming habit to use C expressions in C++ code.

There are probably cons and pros of doing this, but I'm only looking for a yes/why, no/why type of answer.

Also if there are any details I've left out post a comment.


答:
No, it's a bad habit.  When you do this for a living, you'll likely end up violating style guides that your team adheres to (or at least get whacked during code reviews).

Yes it works, but if there's a c++ equivalent, use it.  (e.g. try not to mix printfs with couts)


问:
Data Mining Books
I'm passionate about data mining, I have read some books like Programming Collective Intelligence, and I would like to know more good books, specially practical ones, about data mining in conjunction with AI. Any tips will be appreciated as well. Thanks.

答:
A brilliant introduction to the concepts of data mining and statistical analysis can be found in Gordon Linoff's Data Analysis Using SQL and Excel book.

This is a great book if your background is in data warehousing, data analysis or business intelligence

Title: Data Mining Books


答:
The reason why C++ can compile C is only for "backward compatibility" (avoid to rewrite existing working code).

But C++ has a different philosophy respect to c. Mixing them up doesn't do a good service to both of them.

The way C and C++ manage i/o can rely on a different way to manage the i/o internal state. So -at least- use input and output consistently.

And in C++ programs respect C++ style (unless specifically required to do elsewhere)


答: I use the coin flip.  True is heads, false is tails, and one hand cupped over the other hiding the coin is NULL.  If you know the coin is heads, it's very easy to answer the question "whats the opposite of this value?".  One hand hiding the coin shows very easily that the person could answer if you'd let them see the current value, but since you won't, they can't give you an answer.  For all they know, you don't even have a coin under your hand!


答: When talking to you boss, just use 0 for zero, and ? for null. It correctly captures that it's a placeholder for something but that you don't know what it is.


答:
In a field, NULL says I have no idea; there's no data here -- its equivalent of blank.  Zero (0) says I know the value of this field to be precisely 0, e.g., the integer that's one lower than the number one.

E.g., I could have a sheet of paper that I'm typing into the computer system that says how much each customer owes.  Customer A owes $50, customer B owes $0, and customer C owes NULL (????), because the amount customer C owes number was redacted (someone drew a black line over it and its unreadable; or their was a note saying that their bill for isn't ready yet).  I can comfortably say customer B owes $0, and can comfortably say I don't know what customer C owes.  I don't want to charge customer C $0 (because they may owe money).


答:
Why wouldn't you start by asking the question "why is the value equal to NULL?" That might help you explain why a calculation might be invalid.

If you were doing periodic updates, and the new value didn't present itself (network error for example), then NULL might mean the calculation can't be performed and the old percent value is stale. You might want to show a symbol indicating you have stale data, the update didn't occur as expected.

The same thing might be true for a missing old value, but I have a hard time understanding how an old value could be lost (unless this is the first calculation, or the battery died and the data was lost.) But you might want to show a symbol that indicates this condition as well.

In any case you don't want this to happen:

Image Source


答:
Really it isn't relevant whether your boss is a programmer. The issue is a conceptual one not a technical one.

Ask him to assume you got a raise. Your old salary was 175k, but your new salary is unknown. Then ask him - what percentage raise did you receive?

If he is arithmetically disabled, walk him through the process until he can see where the missing link is.


问:
How to structure an application which reads UPC barcodes
I have no previous experience on creating a project for a seller which will use barcode reader. I am trying to put together a small project but I cannot figure out how the pieces should glue together.

I will create a sample with Motorola Scanner SDK to read barcodes and from that point, I have couple of questions:

How UPC barcodes work in general? AFAIK, a barcode stores the manufacturer and product info but no price data.

Should I store price information inside a database which corresponds to barcode data?

I would really appreciate if you can guide me here.

答:
Basically you're correct, UPC stores mf and item identifiers and allows you to identify given product (different packages will have distinct codes). You'd normally store all other information about a product in a database (name, price etc.) There is an exception which allows price storage in code when it's 'by weight' packed directly in store/by customer, but you probably do not deal with that case. </p>

<p>This link shows basic structure of UPC  </p>

Body:
Basically you're correct, UPC stores mf and item identifiers and allows you to identify given product (different packages will have distinct codes). You'd normally store all other information about a product in a database (name, price etc.) There is an exception which allows price storage in code when it's 'by weight' packed directly in store/by customer, but you probably do not deal with that case.

This link shows basic structure of UPC


答:
This is best explained with pointers.

```<code>var a -> [0] // variable a is initialized and set to hold 0
var b -> [123asgeb0] // variable b is initialized but not set, memory is pointed to, but holds whatever was there last
</code>```

Because of this, if your language does not keep track of NULL variables for you, then you will use whatever was already there. This can lead to overflows, stack corruptions, or other nasty side effects.

If the language does keep track of NULL variables, then it will have a stated case for handling this. I.E. treat NULL as zero, throw exception, treat as nop, etc.

To demonstrate for your boss, get a few pieces of used paper.

Take 2 glasses, and a white out stick.

White out a section of the page, and write down a zero

Put a glass over that (this is var a)

Put a glass over another section of the page (this is var b)

Body:
This is best explained with pointers.

var a -> [0] // variable a is initialized and set to hold 0
var b -> [123asgeb0] // variable b is initialized but not set, memory is pointed to, but holds whatever was there last

Because of this, if your language does not keep track of NULL variables for you, then you will use whatever was already there. This can lead to overflows, stack corruptions, or other nasty side effects.

If the language does keep track of NULL variables, then it will have a stated case for handling this. I.E. treat NULL as zero, throw exception, treat as nop, etc.

To demonstrate for your boss, get a few pieces of used paper.

Take 2 glasses, and a white out stick.

White out a section of the page, and write down a zero

Put a glass over that (this is var a)

Put a glass over another section of the page (this is var b)


答:
Assuming we're not getting into language-specific stuff like:

```<code>#define NULL 0
</code>```

The difference is that 0 is a numeric value where NULL is not. It is like an empty cell on a sheet of graph paper. A cell can have a "0" in it, but it can also be empty. Null is still a value, but you have deemed it special. For example if your cells were now characters, you may use the empty cell as a space and a null cell is no longer possible unless you designate or create a character to be the special case.

What null means depends on how the the data is interpreted:

Null data may mean "not yet provided", and a program will wait a while before checking the value again.

Data may not be able to have a null value. It may be interpreted strictly as an integer, and a non-integer value would be impossible.

Commonly in memory, the address 0 is interpreted as null, which means it cannot be used.

Body:
Assuming we're not getting into language-specific stuff like:

#define NULL 0

The difference is that 0 is a numeric value where NULL is not. It is like an empty cell on a sheet of graph paper. A cell can have a "0" in it, but it can also be empty. Null is still a value, but you have deemed it special. For example if your cells were now characters, you may use the empty cell as a space and a null cell is no longer possible unless you designate or create a character to be the special case.

What null means depends on how the the data is interpreted:

Null data may mean "not yet provided", and a program will wait a while before checking the value again.

Data may not be able to have a null value. It may be interpreted strictly as an integer, and a non-integer value would be impossible.

Commonly in memory, the address 0 is interpreted as null, which means it cannot be used.


答:
I would run NVL check and if one of the parameters is NULL I would display the String "N/A" (don't return "0" since it's just not true!).

This is something that, from a manager point of view, would look more professional then displaying NULL value which kind of looks like you have a bug (which of course you don't - but that's the way it look to a non-engineer).


答:
I would say that learning C first is, IMHO, a good idea. This way people start understanding the hardware they write the software for.

Mixing these two languages is not necessary good idea though. Because you get the insane complexity of C++ coupled with raw bit twiddling common to C.

As you can see, in even such simple example as yours, there is a synchronization issues with different types of streams, and internal buffering. But also, the C&C++ approach is not any more flexible by any means. Switch to class x, and there are no operators to use streaming and stuff.

It's complicated...

I really think that good C++ programmer should know how bit's are flipped behind every construct, and what are the hidden behaviors.

But learning C++, at least more than 50% of it, takes 5+ years of professional coding, and you just can't manage that in the curriculum which is 6 months long with 20 or so hours of hands on experience.

If I would be using C++ constructs in C, I would not use streams, they are way to simple from birds eye view, and make people believe that software development is easy, but hide extra complexities without a lot of benefit in many situations.

RAII wrapper classes, templates, overloads, const correctness and pure abstract classes for common interfaces (don't use the f-ng Java way here PLEASE!) are good candidates though. Because they add safety, generality and ease of use which are very important for real life projects. Be sure to remember about things like virtual destruction, the explosive nature of default copy construction, runtime overhead, const correctness etc. here as well, though.


答:
While it may feel good to take the "take this job and shove it" approach, that rarely works in the real world.

You say that you are young - I am assuming that this is your first real job.  Do yourself a favor - do nothing that you regret later.  It's a small world, and the coding world is getting smaller.  Reputation spreads quickly.  This is especially true if you are planning to start your own company.

Sidebar:  You say that you are planning to start your own company.  A word of advice there - research, research, research.  There is a whole lot more involved than coming up with a product.  There are legal issues (your new product better not look anything like the product you just left).  It is going to take time to make a product, and only then can you start to try to get customers.  Be prepared to live lean for a fairly long while.

Back to the task at hand.  Two weeks notice is customary, although being the "nice guy" and working with them to find (and train) a replacement will be looked on as very professional.  Plus, there is no real down side - you will continue to be employed (i.e. paid) while you either look for your next position, or work evenings to start your own code base.

Write a polite, but minimal, resignation letter.  Say you plan to leave, effective an actual date, sign, date, and hand it in.  At that point, be prepared to discuss what your plans are, and/or why you are leaving.  Be honest, but again, be minimal.  Most importantly, leave all emotion out of it - business only.  Try to make the negatives sound like a positive.

DO NOT BURN BRIDGES.  Remember, you may have to work for or with some of these people again some day, and your reputation will follow you.  Also remember that these people, no matter how it turned out, were willing to hire you in the first place (and you were willing to work for them).

Title: How do programmers quit a job?

Body:
I'm thinking about leaving my current employer and wondering how one goes about that process in the programming world. We have a lot of projects on the go at the moment and I'm the only developer. We have 4-5 projects that are fairly big and need to be done in the next few months and even a few longer than that.

I'm leaving because I'm the only employee and that's doing me no good. I'm young and want to learn, so a team would be nice. It's also too much work and the company is managed horribly.

I have no contract to worry about so I could theoretically quit and just not come back without notice. Just wondering how this is normally handled.

Should I write a resignation letter

How much notice should I give

Should I give a reason for leaving

Should I go to my boss who is the main reason I'm leaving or go to his boss?

Overview of replies

From the feedback here, it looks as though it's best to give 2-4 weeks of notice, and present a written resignation. Don't go into detail explaining why you're leaving in most cases. Don't burn bridges. Be professional.


答:
we have the old value, but not the new value.

Seems like in his mind, not having a new value doesn't mean it is unknown; it is the same as the old value. You can code that accordingly without explaining null because in his mind, it's never null.

Instead of arguing the point about NULLs, just make sure this doesn't create other problems. What are the ramifications of having data that are too old? When someone sees a 0% change, do they hit the panic button? Will this skew any analysis or aggregates over time?

I just don't think he needs a computer programming tutorial, but it would be nice if he knew what a null was and asked the right question instead.


问:
Patterns for Maintaining Model State in Real Time
While some platform in some languages already address this issue, I would like to keep this semi-language agnostic and to focus on patterns associated with this issue.

I have a data model that contains FirstName, MiddleName, and LastName (to keep things simple).  First and Last names are required and may have other rules to ensure their validity.  Middle name is optional.

By default, the model is empty and thus, invalid.

When a value changes, an event can be triggered to validate the field that changed.

My question is what patterns can be used to best manage the state of the object since, based on the scenario, I'm doing field level validation.  Should I move to model level validation on field change which would address the state issue or is there an alternate way?

答:
I would suggest you move away from field level validation, and in fact, move away from exposing the structure of the fields as much as possible.

Instead, focus on the OO design model of "the instance owns data, and models all behaviour" - have a "change name" method that takes the appropriate inputs, and performs the internal mutation, hiding the details of implementation from the consumer.

Generally, I suggest, favour methods that are atomic, and that capture intent: SetName, rather than SetFirstName.  That way processing the action is complete, and your object is valid before, and after, the method call.

Those model object methods also map fairly naturally to the API you will end up exposing to the user - they want to change the name, so model it as a single call from the UI through to the model and back.

This helps insulate the parts of your system from each other, and avoids accidentally coupling parts of the software together through exposing internal data like "how I store the name" to the consumers of the object.


答:
I would do both field and model level validation.
On the UI side, check that the required fields are populated and display an error if not.  Simplistic -- and intentionally so.

Then inside the model, create a #validate function.  This checks the state of the object and returns true if the model is valid, false if not.  Your basic pattern is to validate first, and if successful, apply the changes.  If validation fails, throw out the changes.  It can also be helpful if the validation returns an error message saying why validation failed.

If your model is composed of many different objects.  each one gets its own validate call, and the top of the tree just gathers the results from each of the sub-parts.

Title: Patterns for Maintaining Model State in Real Time

Body:
While some platform in some languages already address this issue, I would like to keep this semi-language agnostic and to focus on patterns associated with this issue.

I have a data model that contains FirstName, MiddleName, and LastName (to keep things simple).  First and Last names are required and may have other rules to ensure their validity.  Middle name is optional.

By default, the model is empty and thus, invalid.

When a value changes, an event can be triggered to validate the field that changed.

My question is what patterns can be used to best manage the state of the object since, based on the scenario, I'm doing field level validation.  Should I move to model level validation on field change which would address the state issue or is there an alternate way?


答: I am surprised that no one mentioned McCabe complexity metrics. A high complexity metric is a real code smell when it comes to maintainability.  It's sometimes necessary for a routine to be "complex" but usually indicates code which will be really hard to maintain.  </p>


答: Be a professional, keep your head high no matter what the company does. Write a letter, give 2 weeks notice. It's a small world, ya never know what the future will bring. You could be back working for the same company or working for/with these same people at a later date.

Title: How do programmers quit a job?