问:
Worth it to Learn an Archaic Language?

Possible Duplicate:

  Is COBOL still worth learning?

One of my better college professors often talked about the advantages of learning an archaic language (COBOL or SAP ABAP for example) in one's free time because of the advantages it provides when looking for high-paying jobs, or if you find yourself out of the job and in need of temp work(consulting, etc.). I was curious what your thoughts are on this, especially if you work with these languages, and whether the time investment could really pay off for future job hunts.

For a little background, I am a junior software developer relatively fresh out of college, with knowledge of mostly just Java, SQL, and web programming (JS, HTML, CSS, etc.) which have provided me with no lack of job opportunities thus far.

UPDATE: I thought this was interesting. I am currently looking for jobs (always a good thing to do in my opinion, and DICE makes it simple), and was just approached by a company for an SAP ABAP position where training in the language would be part of the job. Thank you everyone who responded, I will certainly take your advice into consideration!

答:
Ask the job boards

If you're asking "is this archaic skill marketable?", I'd say to check the job boards. Let's take COBOL, for instance.

If you see lots of COBOL jobs, and if they pay much better than jobs requiring skills you already have, there's your answer.

(This quick search on Indeed doesn't suggest that COBOL jobs pay particularly well, and searching for Ruby vs COBOL on Dice finds, as of this moment, 1657 for Ruby and 589 for COBOL.)

Other considerations

On the other hand, you need to ask:

What would the work environment be like? Archaic code working with archaic databases may be maddening. Will the money (if it's good) be worth it?

Will you get stuck maintaining old systems forever? Will you learn conventions that make it hard to transition to other languages, or have skills on your resume that other employers will actually count against you?

Are there other lucrative skills you could learn that would be more fun? For example, identify an up-and-coming technology instead of an old one, and be among the first to master it.

Given the possible negative factors above, how much more would COBOL jobs have to pay to make it worthwhile to you? 50% more? 200% more? Whatever that number is, does it seem like the market is offering it?

Compare search results

If all you're going for is lots of opportunities, I'd suggest you do this:

Make a list of all the computer languages and skills you can think of

Search for them all on a big job site

Rank them by results and/or average pay

Pick the top few and learn those, or pick the top one and learn that really well.

An alternative approach would be like this:

Do the comparative search above

Divide the skills into groups and pick the highest ranked item from each group: a dynamic language, a functional one, etc, and learn those. That would give you a broad base of skills, and you could reasonably say things like "I don't know Ruby but I know Python, and they're pretty similar."

This also has the advantage of seeming less mercenary and more likely to make you a great programmer. :)

Title: Worth it to Learn an Archaic Language?

Body:
Ask the job boards

If you're asking "is this archaic skill marketable?", I'd say to check the job boards. Let's take COBOL, for instance.

If you see lots of COBOL jobs, and if they pay much better than jobs requiring skills you already have, there's your answer.

(This quick search on Indeed doesn't suggest that COBOL jobs pay particularly well, and searching for <a href="http://seeker.dice.com/jobsearch/servlet/JobSearch?registerRemSw=0&op=300&caller=2&LOCATION_OPTION=2&AREA_CODES=&ZIPCODE=&RADIUS=64.37376&COUNTRY=&METRO_AREA=33.78715899%2C-84.39164034&TRAVEL=0&SORTSPEC=0&FRMT=0&DAYSBACK=30&NUM_PER_PAGE=30&N=0&EXCLUDE_KEY1=&EXCLUDE_KEY2=&EXCLUDE_KEY3=&EXCLUDE_KEY4=&EXCLUDE_KEY5=&EXCLUDE_KEY6=&EXCLUDE_KEY7=&EXCLUDE_TEXT1=&EXCLUDE_TEXT2=&EXCLUDE_TEXT3=&EXCLUDE_TEXT4=&EXCLUDE_TEXT5=&EXCLUDE_TEXT6=&EXCLUDE_TEXT7=&NUM_PER_PAGE=30&EXPANDED_NE=&FREE_TEXT=ruby&Ntx=mode+matchall&SAVESEARCH=" rel="nofollow">Ruby vs <a href="http://seeker.dice.com/jobsearch/servlet/JobSearch?registerRemSw=0&op=300&caller=2&LOCATION_OPTION=2&AREA_CODES=&ZIPCODE=&RADIUS=64.37376&COUNTRY=&METRO_AREA=33.78715899,-84.39164034&TRAVEL=0&SORTSPEC=0&FRMT=0&DAYSBACK=30&NUM_PER_PAGE=30&N=0&EXCLUDE_KEY1=&EXCLUDE_KEY2=&EXCLUDE_KEY3=&EXCLUDE_KEY4=&EXCLUDE_KEY5=&EXCLUDE_KEY6=&EXCLUDE_KEY7=&EXCLUDE_TEXT1=&EXCLUDE_TEXT2=&EXCLUDE_TEXT3=&EXCLUDE_TEXT4=&EXCLUDE_TEXT5=&EXCLUDE_TEXT6=&EXCLUDE_TEXT7=&NUM_PER_PAGE=30&EXPANDED_NE=&FREE_TEXT=cobol&Ntx=mode%20matchall&SAVESEARCH=" rel="nofollow">COBOL on Dice finds, as of this moment, 1657 for Ruby and 589 for COBOL.)

Other considerations

On the other hand, you need to ask:

What would the work environment be like? Archaic code working with archaic databases may be maddening. Will the money (if it's good) be worth it?

Will you get stuck maintaining old systems forever? Will you learn conventions that make it hard to transition to other languages, or have skills on your resume that other employers will actually count against you?

Are there other lucrative skills you could learn that would be more fun? For example, identify an up-and-coming technology instead of an old one, and be among the first to master it.

Given the possible negative factors above, how much more would COBOL jobs have to pay to make it worthwhile to you? 50% more? 200% more? Whatever that number is, does it seem like the market is offering it?

Compare search results

If all you're going for is lots of opportunities, I'd suggest you do this:

Make a list of all the computer languages and skills you can think of

Search for them all on a big job site

Rank them by results and/or average pay

Pick the top few and learn those, or pick the top one and learn that really well.

An alternative approach would be like this:

Do the comparative search above

Divide the skills into groups and pick the highest ranked item from each group: a dynamic language, a functional one, etc, and learn those. That would give you a broad base of skills, and you could reasonably say things like "I don't know Ruby but I know Python, and they're pretty similar."

This also has the advantage of seeming less mercenary and more likely to make you a great programmer. :)


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

答: Cant specifically tell about Motorolla or Nokia but you need to keep in mind what is the platform these phone's support. You would be better of developing in Java as it is a more popular platform and need not depend only on Windows mobiles. One more thing C# is so shamelessly close to Java that a cross compiler does the trick for Desktop apps may be this applies to mobile apps too.</p>

OwnerDisplayName: Alexander Suraphel

ContentLicense: CC BY-SA 2.5


问:
Handling REST Response Formats
It seems that newer websites (and API's especially) make use of request formats by adding the expected format to the end of the URL path.

```<code>/path/to/resource.html
/path/to/resource.json
/path/to/resource.xml
</code>```

Are their any problems with this approach? Are there any studies or outlines of the pros and cons of doing this instead of just listing the resource without a file type extension?

答:
Aside of SEO or aesthetics implications there are no pros or cons I know of.

Perhaps it could affect some caching setups that could avoid caching URLs with query strings (in the case you would use a query string argument to specify the format), but this is not really an issue of your API.

Perhaps it could be said that using extensions is more "REST" as it represents the resource in a better way. Perhaps some libraries/frameworks have a preference for some or other scheme in order to expose or access resources.

I wrote an article about the aspect of a few public REST APIs... perhaps it can help you: a look into varios REST APIs.

ContentLicense: CC BY-SA 3.0

Title: Handling REST Response Formats


问:
Getting my feet wet with open source - creating a small project on my own VS contributing to a big one?
I want to contribute to the open source community, but I've never done it before, and I have some concerns regarding the collaboration process - I am afraid that I will just "get in the way" of other developers, and since (I assume) that they are pretty polite guys, they will feel bad about telling me to bug off. I imagine things like adding the feature X in 1.3.0, just to realize that there was actually such thing in 1.1.5, but it was intentionally removed in 1.1.8 because of Y.

Being an independent contractor (a freelancer) I work very rarely with other developers, as a team, and I do understand that the software collaboration is a complex area (I've read a couple of books on management of big teams, seems to be a delicate area, at least to me).

To my actual question - should I start with something small (that I will create), and wait for other contributors to join it (ones that will know how "the stuff works", so I can slowly get my head straight on the collaboration part), or I should try to join a big project, which has a lot of activity in it, so I can see the big picture (but risking to be a pain for them) ?

答: You have a fear of working on a large team, therefore you should work on a large team. Reading books about what it is like to work with programmers could be a waste of time and money. Just get in there, get your ass whooped, get up and keep going. Many a successful actor, athleet, etc. has gone through this. The sooner you get over this, the better of you will be. It might be tough, but man up. Other people aren't there to kill you. They need all the free help they can get. If you could not win, at least leave some blood on the ice instead of yellow liquid.</p>


问:
How is type checked in a dynamic language interpreter/compiler, such as JavaScript?
In dynamic languages, such as JavaScript or Python, the type of a variable is determined at runtime. This is one reason why they are slower than typed languages such as Java.

How is type checking performed? What is the essential reason this process is slow?

答:
Very basically, in untyped languages, every reference point to an object that contains both the type and the value. For example var a = 3 points to an instance that contains the value 3 and the type int, if you make a = "bla", the reference is updated to an instance that contains the string "bla" and the type string, the old object is discarded, etc...

This is slow because every time an operation (eg a + b) must be made on these basic type, the runtime must first dereference the objects, check that their type are compatible, perform the operation, create a new object.

In contrast, a + b in C++ or Java checks at compile time that the types are valid and compatible, then a and b are stored as immediate values (not references), and the addition is a simple processor operation on these values.

Of course, this is all very theoretical. In practice, a lot of optimization can be done on this process to avoid most of the overhead, and dynamically typed languages can get quite fast.

OwnerDisplayName: dalibocai

OwnerDisplayName: solendil


答: Every value is stored together with its type, which one needs to inspect first. Also conversions say from string to number go via inspection, on the fly.</p>

Title: How is type checked in a dynamic language interpreter/compiler, such as JavaScript?

Body:
In dynamic languages, such as JavaScript or Python, the type of a variable is determined at runtime. This is one reason why they are slower than typed languages such as Java.

How is type checking performed? What is the essential reason this process is slow?

OwnerDisplayName: Joop Eggen


答:
There's confusion in the question.

There's an assumption that type checking is slow, which isn't necessarily the case.

The question also seems to confuse the process of type dispatch with type checking, and they are two different things.  One is a process that's done at run time, the other a process at compilation time.  I suspect the question is really asking about type dispatch.

It is type dispatch that can introduce overhead at runtime, because the computation spends time with instructions that decide, dynamically, what action to take, based on the types of values it sees at run time.  e.g.  in a dynamic language, if I apply "+" on two things, I might mean numeric addition, or string concatenation, so I need to spend time looking at what's at hand to decide what to do.  There are evaluation strategies that can reduce the cost of dynamic dispatch.  (e.g. tracing JITs)

With regards to doing type-checking in JavaScript, see: http://www.cs.brown.edu/~sk/Publications/Papers/Published/gsk-flow-typing-theory/.  For a more general overview of how type checkers work, a standard programming language textbook will cover the algorithms. For example, http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/

OwnerDisplayName: dyoo


答:
Go find a project that interests you. Then go to their bugs list. Find one you think you can fix. Fix it well and cleanly. Find another bug you think you can fix...keep doing that for a while, then move on to trying to help with features and other such things. Don't worry about doing your own project at first, I've run projects for school and it's much easier if you are used to dealing with a multi-user codebase before trying to manage one. I'd recommend picking a project that has a reputation for good documentation and a strong, friendly, inclusive community. Don't worry about being perfect, after all if you make a mistake, someone else can fix it. Just do your best on the thing in front of you and you'll be fine.

The point really is to make sure you understand how large codebases work and in turn when you start your own project, not only will you understand how to set up, structure and manage it; you will also be a known quantity and have allies to help you work on it.

Title: Getting my feet wet with open source - creating a small project on my own VS contributing to a big one?

Body:
I want to contribute to the open source community, but I've never done it before, and I have some concerns regarding the collaboration process - I am afraid that I will just "get in the way" of other developers, and since (I assume) that they are pretty polite guys, they will feel bad about telling me to bug off. I imagine things like adding the feature X in 1.3.0, just to realize that there was actually such thing in 1.1.5, but it was intentionally removed in 1.1.8 because of Y.

Being an independent contractor (a freelancer) I work very rarely with other developers, as a team, and I do understand that the software collaboration is a complex area (I've read a couple of books on management of big teams, seems to be a delicate area, at least to me).

To my actual question - should I start with something small (that I will create), and wait for other contributors to join it (ones that will know how "the stuff works", so I can slowly get my head straight on the collaboration part), or I should try to join a big project, which has a lot of activity in it, so I can see the big picture (but risking to be a pain for them) ?


答:
From xml.com:

A resource may have more than one representation. There are four frequently used ways of delivering the correct resource representation
  to consumers:

Server-driven negotiation. The service provider determines the right representation from prior knowledge of its clients or uses the
  information provided in HTTP headers like Accept, Accept-Charset,
  Accept-Encoding, Accept-Language, and User-Agent. The drawback of this
  approach is that the server may not have the best knowledge about what
  a client really wants.

Client-driven negotiation. A client initiates a request to a server. The server returns a list of available of representations. The
  client then selects the representation it wants and sends a second
  request to the server. The drawback is that a client needs to send two
  requests.

Proxy-driven negotiation. A client initiates a request to a server through a proxy. The proxy passes the request to the server and
  obtains a list of representations. The proxy selects one
  representation according to preferences set by the client and returns
  the representation back to the client.

URI-specified representation. A client specifies the representation it wants in the URI query string.

I would consider a URI based differentiation to be the least preferable method.

Title: Handling REST Response Formats

Body:
It seems that newer websites (and API's especially) make use of request formats by adding the expected format to the end of the URL path.

```<code>/path/to/resource.html
/path/to/resource.json
/path/to/resource.xml
</code>```

Are their any problems with this approach? Are there any studies or outlines of the pros and cons of doing this instead of just listing the resource without a file type extension?


问:
How can I create Assert.AreEqual(myobject,somevariable) a test in TDD before writing production code?
Im researching TDD, I'm not really sure how to write a test before I have written production code. The problem is that TDD states that you make assertions and then write your code so that these assertions pass. But You have not created any classes yet (as part of the production code) so how are you meant to write the tests if you dont have any classes with which to assert.

Hope someone can explain....

答:
Depending on what language and IDE you are using, you may have some support for "consume-first development".

e.g. in Visual Studio, you could write this line of code:

```<code>NewObjectThing foo = new NewObjectThing();
</code>```

Now, you'll get the red squigglies to indicate that the type or namespace NewObjectThing cannot be found, and of course the code will not compile.

But if you right-click on it and select Generate -> Class, it will create a new file NewObjectThing.cs in the same folder & namespace as your current code, with an empty class declaration for NewObjectThing.

Similarly, if you then wrote:

```<code>foo.Name = "Fred";
</code>```

..you could then right-click on Name and select Generate -> Property to add a property to the NewObjectThing class (and it would infer the type as string based on what you were assigning to it).

There are add-on tools like Resharper and CodeRush that add considerable flexibility and power to this process.

Anyway, have a look to see if your IDE supports something similar.

Body:
Depending on what language and IDE you are using, you may have some support for "consume-first development".

e.g. in Visual Studio, you could write this line of code:

NewObjectThing foo = new NewObjectThing();

Now, you'll get the red squigglies to indicate that the type or namespace NewObjectThing cannot be found, and of course the code will not compile.

But if you right-click on it and select Generate -> Class, it will create a new file NewObjectThing.cs in the same folder & namespace as your current code, with an empty class declaration for NewObjectThing.

Similarly, if you then wrote:

foo.Name = "Fred";

..you could then right-click on Name and select Generate -> Property to add a property to the NewObjectThing class (and it would infer the type as string based on what you were assigning to it).

There are add-on tools like Resharper and CodeRush that add considerable flexibility and power to this process.

Anyway, have a look to see if your IDE supports something similar.


问:
How to create donation software?
I have a requirement to create a donation software for a project.

Does anyone know how KickStarter designed theirs? What are the security elements involved? How do I create the credit card transactions-processing part? Is there some common library/service used for that?

I am still in research phases for this, so any ideas appreciated!

答:
There are a lot of issues for handling credit cards.  The easiest solution is using a service like Paypal's service to process the credit cards.  That way, all you have to do is store the amount and a PayPal Transaction ID.

You can then start moving up to more complicated solutions, directly using gateways such as Verisign (yes, that's part of PayPal) or Authorize.net or any of a lot more.

Things that you will need to think about, especially if you start to go towards using merchant account APIs

PCI Compliance

Fraud protection

Dispute handling

Auditing

Getting an Internet Merchant Account

Storing/ Not storing/ encrypting personal identifiable information

It's a really broad topic, and there are a lot of answers out there.  This is a bit of a start of things you'll have to think about.

Title: How to create donation software?


答:
As someone who has come into contact with archaic languages (such as FORTRAN and a couple other domain-specific languages), I'd say that you shouldn't set out to learn these languages until you need them in your job.  When you need to work on that old module, learn enough to do the fix and move on.  Spending a lot of time becoming an expert on f77 isn't useful these days.

On the upside, many of the older languages are much simpler in that there are very few constructs, keywords, and a very small standard library- so learning these languages is easy in comparison.

EDIT to add that you should learn C inside and out if you have not already done so.  The older languages seem to live closer to the hardware (notwithstanding Lisp and other functionals or limited use ones- the ones you'll see are close enough to C to make it worth it).

Title: Worth it to Learn an Archaic Language?

Body:
Possible Duplicate:

  Is COBOL still worth learning?

One of my better college professors often talked about the advantages of learning an archaic language (COBOL or SAP ABAP for example) in one's free time because of the advantages it provides when looking for high-paying jobs, or if you find yourself out of the job and in need of temp work(consulting, etc.). I was curious what your thoughts are on this, especially if you work with these languages, and whether the time investment could really pay off for future job hunts.

For a little background, I am a junior software developer relatively fresh out of college, with knowledge of mostly just Java, SQL, and web programming (JS, HTML, CSS, etc.) which have provided me with no lack of job opportunities thus far.

UPDATE: I thought this was interesting. I am currently looking for jobs (always a good thing to do in my opinion, and DICE makes it simple), and was just approached by a company for an SAP ABAP position where training in the language would be part of the job. Thank you everyone who responded, I will certainly take your advice into consideration!


问:
Is there an expiration date for well regarded, but old books on programming?
After reading a question about books every programmer should read, I wonder if the following should be considered obsolete:

Code complete: 1st edition in 1993; 2nd edition in May, 2004

Introduction to algorithms (Cormen, Leiserson, Rivest, Stein): 1st edition in 1990; 2nd edition in September, 2001; 3rd edition in 2009

The Pragmatic Programmer: October, 1999

Structure and Interpretation of Computer Programs: 1st edition in 1984; 2nd edition in September, 1996

The C Programming Language: 1st edition in 1978; 2nd edition in April, 1988

All these books seem very old. Isn't there a difference between modern computing and what was current when those book were written?

For example, my 61-year-old teacher explains things very nicely but forgets to take into account all that has been done between when he began to teach 25 years ago and now.

Isn't the same true for those books? Aren't there any more modern books that teach principles and technologies that are closer to current practice? Or do you consider them to be useful and relevant even today?

答:
I heard a saying from a mentor:

"Good advice comes with a reason why so that you know when it's no longer good advice."  So in the book terms, a book that explains why to do X over Y will let you know when that advice is no longer valid.  A "always do this, just do it" book like some of the crash-course in language X is not so good.

I saw one called "learn unix in 24 hours", well the book was about 8cm thick, I doubt many people could even read every page in 24 hours :)

Remember that what is en vogue today might be scoffed at tomorrow.  All of the following were once deemed mainstream (en vogue yesterday) but now aren't:

Goto

Single entry single exit

Hungarian notation

Waterfall approach

And there are a few things which were once completely anathema but are now accepted:

Recursion as a tool to solve problems (radical in the early BASIC
days)

Allocating memory at runtime with malloc/new

Use of the C++ STL

Garbage collected languages for real-time systems

Know why, and you'll know when old assumptions have been replaced with a new reality, and so should the advice.


答:
I am not sure if ABAP qualifies as an archaic language as half the fortune 500 are running at least one up to date SAP package. The design is definitely archaic.

Anyway to answer the question. Yes its definitely worth learning, not as a primary career option, but there are several projects that are either replacing a COBOL system or more commonly interfacing with an existing COBOL system. An understanding of COBOL and its environments is a definite plus even if the project itself is Java, C# or whatever.

Also a knowledge of COBOL, Basic or ABAP will let you appreciate how lucky you are to programming in Java :-).

Title: Worth it to Learn an Archaic Language?


问:
Is there a name for a testing method where you compare a set of very different designs?
"A/B testing" is defined as "a method of marketing testing by which a baseline control sample is compared to a variety of single-variable test samples in order to improve response rates".

The point here, of course, is to know which small single-variable changes are more optimal, with the goal of finding the local optimum.

However, one can also envision a somewhat related but different scenario for testing the response rate of major re-designs: take a baseline control design, take one or more completely different designs, and run test samples on those redesigns to compare response rates.

As a practical but contrived example, imagine testing a set of designs for the same website, one being minimalist "googly" design, one being cluttered "Amazony" design, and one being an artsy "designy" design (e.g. maximum use of design elements unlike Google but minimal simultaneously presented information, like Google but unlike Amazon)

Is there an official name for such testing?

It's definitely not A/B testing, since the main component of it (finding local optimum by testing single-variable small changes that can be attributed to response shift) is not present. This is more about trying to compare a set of local optimums, and compare to see which one works better as a global optimum. It's not a multivriable, A/B/N or any other such testing since you don't really have specific variables that can be attributed, just different designs.

答:
The official term is multivariate testing.

Even though you state that they are just different designs, each of those designs is effectively a new variable.

For websites, there are a number of commercially available tools that can aid in the assembly of such tests and the subsequent number-crunching that is required to determine the outcomes.


问:
Do I need an IDE to develop Android apps?
After reading some articles on Google, I decided to start working on Android apps since it's an open source platform from Google.

So I wanted to create some apps.I have Android 2.2 Os So I just googled it to find the things and I finally found this link to create Android apps.

Is this the link that enables me to create apps or does we need any other IDE? Like we have gcc for c and VC++ for C++. What other things to do I need to set up to get going on this?

答: Need, no, but you are setting yourself up for a lot of menial tasks that Google has elided for you with their Eclipse plugin.  If you want to get in and start writing code, the Eclipse + ADT is about as seamless as you can find.  Plus a LOT of people use it, so if you have problems there are plenty of message boards to consult for help.


问:
What is the starting point for Ubuntu app development?
I'm thinking of developing software for Ubuntu and other related Linux-based distros (like Linux Mint). But currently am at a loss for where to start.

Would learning Python be enough/good?
And what are the other things I should know about before starting this kind of developing?

And will I be able to publish my apps to a software store like Ubuntu store even if I am from outside USA/UK? If not, what are the options I have to make my apps reach the audience?

As a lot of users had asked, I intend to build applications only for Linux (I'm thinking of Gnome) that will be a bit business and enterprise oriented.

Currently I am an Oracle certified Java developer in J2SE and J2ME. And I know Python a bit.

答:
You can start with Python and Quickly which is quite easy.

Description from the Launchpad

Quickly helps you create software programs (and other things) quickly. You can select from a set of application templates and use some simple commands to create, edit code and GUI, and publish your software for others to use.

Getting started video tutorial can be found here.


问:
Does it matter to you that a software is "available source" but not "open source"
You probably know the list of open source licenses officially approved by the OSI. Most notably I guess would be the GPL, MIT, [insert your favorite license here].

I recently ran into a project which although was open source (the creator made all source code available), was not officially open source under one of those official licenses.

It released the source, but made no promise to release the source in the future.

It allowed modification suggestions, but made no promises to accept patches and disallowed external distribution of externally-patched versions.

It allowed the use of the software in commercial or paid projects, but disallowed the sale of the software itself.

I suppose it could be called "available source" not open source as we like to think of it.

I can see why the management team of a company wouldn't want to do business with this software. They can't fork it, they can't sell it, they can't create their own version of the software and distribute it or sell it.

But would it matter to you as part of a software engineering team who's just using this software? I can still get my work done with it, I can use it in a project for which I'm paid (but I can't sell the software itself, which I'm not in the business of doing anyway), and I can make changes to the code to make it behave differently for my needs (but I can't make those modifications public), and if I do want those modifications officially made available to others, the approval is up to the project itself and they choose whether to incorporate them in an official release or not.

So we know that a company that wants to base its business on this "available source" software can't do that, but as someone from the software engineering team, would those differences matter to you or do they seem less relevant?

Curious what others think of this.

答:
The question for this and any other external library is maintenance.

What is the lifespan of your application and what is the apparent lifespan of this library?  Yours should hopefully be the shortest.

Who will do bug fixes for this library?  As it looks from here, your company should explicitly allocate resources in the future for maintaining this software, as you cannot rely on any other fixing bugs for you.  You cannot share the maintenance burden with anybody else since you cannot share the source.  Want to hunt down an elusive race condition bug in code you don't know?

This thought alone might make the library too expensive to use.

This might be irrelevant if the library is very solid and robust and easy to work with on the source level, but my experience is that the peer pressure of true open source projects simply make the code better because you tend to do your best then.

Personally I would think very careful about if I would adopt this or any other external code, since the whole reason for using other peoples code is that you don't have to deal with it yourself.    Also think of future maintainers - you should do fire drills changing code in the library to see if it can be done at all.  There might be some VERY nasty surprises here.

Are you at liberty to discuss the library in question?


答: Another reason for writing a test before the code it's testing is written is to make sure the test fails.  This ensures that you are actually calling the test and that it does fail.  Sure, it's unlikely we would ever get that wrong, but .....

Title: How can I create Assert.AreEqual(myobject,somevariable) a test in TDD before writing production code?

Body:
Im researching TDD, I'm not really sure how to write a test before I have written production code. The problem is that TDD states that you make assertions and then write your code so that these assertions pass. But You have not created any classes yet (as part of the production code) so how are you meant to write the tests if you dont have any classes with which to assert.

Hope someone can explain....


问:
How to organize code review process
I'm looking for a light-weight code review process. A couple of requirements, the reviewer must be able to do the review alone at the time of his/her choosing (not tied to check-ins), the reviewer must be able to easily find the target code, the review has to leave some document showing what was reviewed. I know there are tools available for code review but I work in a very ridig environment and introducing new tools is not an option.

One idea I've been thinking about is to create a new Visual Studio Task List token called REVIEW, and use it to mark the code that needs reviewing.

Something like,

```<code>// REVIEW doe_john: New method, not sure about the exception.
</code>```

Then we would add a Review workitem in TFS (we're using the CMM template).

Another possibility, which I would actually prefer, would be to have developers create a TFS Review workitem and add links to code to it, but I don't know if this is possible. Obviously you can add a link to a file, but I'd like to have a link to a particular method.

PS. Posted originally to StackOverflow.

答:
We used to do manual code reviews (i.e. no special tools) and this was the best method we found. Our development department doesn't have team foundation server, so I can't comment on that.

All work is tied to a bug or an agile story that has a unique ID.  When the work is checked in (or shelved, which is submission without actual check in), the description will always have this identifier.

In a stand-up or over e-mail the reviewer would be notified that bug ### or story ### is ready for review.

They do source control diff between new versions of the files and previous versions and copy/paste the output of diff into a word document.  We have a code review word document template which is preset to use have 2 levels of headings: level 1-module, level 2-file name.  It also defines formatting style for actual code (8pt Consolas). This step obviously was the biggest pain, but with Word template and Ctrl-A, Ctrl-C, Ctrl-V sequence, it's not that many clicks.

Now that the document is in word, the reviewer can highlight the code in question and add comments using Word's review system.

All documents are stored in a document repository and labeled with corresponding bug or story number.

Once the document is done, the link to the repository is shared with original developer.  Then we'd either have a code review meeting if changes were significant enough and need discussion, or just leave it up to original developer to go through comments on his own time.

After trying numerous manual methods, this was the one we found to have the least amount of overhead while allowing us to actually review every change.

However, our engineering team just rolled out Review Board and although I haven't used it that much yet, so far I'm loving what I have seen.  It has all the flexibility of our word docs, but no more copy/pasting and manually fixing formatting.  As an added bonus it keeps a permanent archive of all comments so you can go back years in time if you ever need to.  Also it allows you do diffs of diffs, which is great when you want to do a review of a code review. This part we found to be very difficult with manual procedures because you can't see what was changed in response to first code review, instead you end up redoing the entire thing.

Although you did say you don't want to use tools, I'd strongly urge you to consider Review Board.  It is open source and completely free.  So you can roll it out for yourself and the 5 people you maybe working with.  The rest of your company doesn't have to use this tool if they don't want to. And you don't need to worry about getting any purchase approvals.

== Update to comments from question: ==

On my team, we have people in NY, CT, TX, Poland and India. What makes things even more interesting is that extremely high percentage of the team doesn't know the product or technology all that well, so very few of us do most of the review.  So yeah, senior devs are definitely busy.  In the process I outlined, primary reviewer would do initial walk through the code independently on his own schedule. But afterwards we schedule a meeting and primary reviewer walks the coder through his comments. The meeting can have other reviewers, but they are considered secondary and are not obligated (but not discouraged from) to review every file or make comments.

I agree with others comments that having the final meeting in real-time, even if you have to use web conferencing is much better for knowledge transfer and for helping your new guys understand the code so that they'll start producing things that make your senior devs even busier. But again, that depends on the volume and type of comments, sometimes (very infrequently) comments are so minor that the meeting is skipped.

I can also relate to you when you say it's hard to roll out new tools. I work for a very large corporation and typically there's so many people involved that even outside of the fact that no purchases are ever approved, there are so many interests/agendas that nothing is ever agreed on.  What's nice about Review Board is that you can skip all that and just start using with your small team and if you have to (if it really comes to that), you can host the web services on your own dev machine.

Title: How to organize code review process


问:
How to choose the most suitable technologies for your project?
While architecting the system, often you have to choose the appropriate technologies to be used for every module. What are the different parameters to be considered while choosing the technologies/frameworks? How those parameters can affect the project quality, schedule, expense? Can anybody please explain in detail.</p>

答:
It's a broad question, but one thing you should keep in mind is the balance between new technology and routine. It's a trade-off in my eyes and you have to choose a value between close to outdated but well known, tested and understood by experienced programmers and bleeding edge, interesting to learn, doing more things for you than the previous version.

My experience is focused on a team size of 5-7 programmers and I tend to say that you shouldn't introduce more than one entirely new technology per project if noone in the team has worked with it before.

As for choosing the appropriate technology, vertical prototyping can help a lot so you understand how the new framework affects the rest of the technology stack you're using.


答:
Some broad criteria may include:

1-Type of application (Web, ETL, etc.)

2-Expertise of development team and whether the gap is could be crossed

3-Budget fit

5-User Requirements and usability needs - Compare each competitive technology for that. This
is very broad point. You need to examine every known requirement against the selected stack/platform.

6-Ease of finding knowledgeably support people (if you plan to live with the product)

7-Software licensing style (per user, server, etc.)

8-Interface compatibility between the platform/tools and the existing systems

9-Localization support (in some countries where English is not the first language)

Title: How to choose the most suitable technologies for your project?

Body: While architecting the system, often you have to choose the appropriate technologies to be used for every module. What are the different parameters to be considered while choosing the technologies/frameworks? How those parameters can affect the project quality, schedule, expense? Can anybody please explain in detail.</p>


问:
In C++, were SFINAE and metaprogramming intentional or just a byproduct of templates?
SFINAE and template metaprogramming can do wonderful things and many libraries also use them considerably.

Historically both of these "magic concepts" were intentionally introduced/supported in C++ ? Or they were just later discovered as useful byproducts (side products) of original template programming ?

答:
In 1994 during a meeting of the c++ standardization committee, E. Unruh
  discovered that templates can be used to compute something at compile
  time. He wrote a program that prints prime numbers. The intriguing
  part of this exercise was that the production of the prime numbers was
  performed  by the compiler during the compilation process and not at
  the run time. Although this program wasn't fully portable, the program
  did show that the template instantiation mechanism is a primitive
  recursive language that can perform non-trivial computations at
  compile time.

This excerpt is taken from "c++ templates" by Vandevoorde and Josuttis (chapter 17).

As you can see, it was discovered early and its power was recognized immediately.


答:
Use a tool - there are plenty good code review tools. With it, the process is fairly simple :

create the item with source files you want to review

add people you want to review the code

assign the time for the review

check the result of the review when the time elapse

I personally used codestriker, but there are many other code review tools.

Title: How to organize code review process

Body:
I'm looking for a light-weight code review process. A couple of requirements, the reviewer must be able to do the review alone at the time of his/her choosing (not tied to check-ins), the reviewer must be able to easily find the target code, the review has to leave some document showing what was reviewed. I know there are tools available for code review but I work in a very ridig environment and introducing new tools is not an option.

One idea I've been thinking about is to create a new Visual Studio Task List token called REVIEW, and use it to mark the code that needs reviewing.

Something like,

```<code>// REVIEW doe_john: New method, not sure about the exception.
</code>```

Then we would add a Review workitem in TFS (we're using the CMM template).

Another possibility, which I would actually prefer, would be to have developers create a TFS Review workitem and add links to code to it, but I don't know if this is possible. Obviously you can add a link to a file, but I'd like to have a link to a particular method.

PS. Posted originally to StackOverflow.


问:
Do TODO comments make sense?
I am working on a fairly big project and got the task to do some translations for it. There were tons of labels that haven't been translated and while I was digging through the code I found this little piece of code

```<code>//TODO translations
</code>```

This made me think about the sense of these comments to yourself (and others?) because I got the feeling that most developers after they get a certain piece of code done and it does what it's supposed to do they never look at this until they have to maintain it or add new functionality. So that this TODO will be lost for a long time.

Does it make sense to write this comments or should they be written on a whiteboard/paper/something else where they remain in the focus of developers?

答:
I tend to use // todo comments for things that have to happen, but I can't do immediately.

I also make sure that I chase up on them - I search for them (Visual Studio has a nice feature where it will list such comments for you) and ensure that things are done.

But, as you say, not everyone is diligent about them and like many comments, they tend to rot over time.

I would say this is more of a personal preference - so long as you document what needs to be done and chase up on it, it doesn't matter if it is in // todo, postit notes or a whiteboard (where they can also end up not being actioned).

Title: Do TODO comments make sense?


答:
In my experience it depends. The main factor is whether or not the team is disciplined enough to follow up on these "little" comments. If they do then yes they make sense. If they don't then these comments are just a waste of time and you may want to look into other options, e.g. story cards.

Personally I use TODO comments occasionally but they are typically just short lived and I usually have only a very small number of them like one, two or three. I use them more as a marker in the code base than anything else. If I wait too long to take care of them then I forget about what I thought I needed 'to do'.

My preference would always be to not use these and instead use proper story cards or backlogs or similar. Use one mechanism for one task.

Title: Do TODO comments make sense?

Body:
I am working on a fairly big project and got the task to do some translations for it. There were tons of labels that haven't been translated and while I was digging through the code I found this little piece of code

```<code>//TODO translations
</code>```

This made me think about the sense of these comments to yourself (and others?) because I got the feeling that most developers after they get a certain piece of code done and it does what it's supposed to do they never look at this until they have to maintain it or add new functionality. So that this TODO will be lost for a long time.

Does it make sense to write this comments or should they be written on a whiteboard/paper/something else where they remain in the focus of developers?


答:
Modern IDEs recognize the TODO comments and they are as such visible in their own panel/window/tab, so they are theoretically not lost (I'm thinking Eclipse and Visual Studio, both I know enough to remember that they recognize it).

You can even configure additional comment words such as FIXME, BEWARE or anything else you want to customize. However, other developers on your project will have to customize their IDE the same way.

Now, I wrote "theoretically" because although not lost, the TODO more than often relates to something that is not needed for the application to work properly "at the moment". And "at the moment" may extend for 5 minutes to 5 years, depending on the type/size of the project :-)

Finally, in my opinion it still makes more sense to have them in the code, at the right place, precisely answering the question "where should I make the change" than somewhere else outside of the code.

Edit: As it is written in Wikipedia's article on comments, including the date and owner of the TODO is considered to be a good practice.

Title: Do TODO comments make sense?


答:
It may make some sense, at least I use them sometimes. The key point is to use consistent tags such as TODO or FIXME so that they can be easily found with simple text search.

For example, "quick 'n dirty" solutions are convenient to label, something like:

```<code>ConnManager.getConnection("mydatabase"); // FIXME: DB name should be configurable
</code>```

If the code does what it's supposed to do, and nobody complains, then the comment does no harm. If there ever is time to beautify the code, it's easy to start with searching for FIXME labels.

Title: Do TODO comments make sense?

Body:
It may make some sense, at least I use them sometimes. The key point is to use consistent tags such as TODO or FIXME so that they can be easily found with simple text search.

For example, "quick 'n dirty" solutions are convenient to label, something like:

ConnManager.getConnection("mydatabase"); // FIXME: DB name should be configurable

If the code does what it's supposed to do, and nobody complains, then the comment does no harm. If there ever is time to beautify the code, it's easy to start with searching for FIXME labels.


问:
What does CR mean in version numbers?
Hibernate has CR postfix in their releases for the 4.0 version of hibernate, for example 4.0.0.CR7. What does the CR part mean? When would I use this kind of release numbering?</p>

答:
It's actually Candidate Release.

CR=candidate for release

The use of the CR (Candidate Release) qualifier is for releases that we anticipate can be the GA release, but we need the community to help validate the release.  Again, there is an optional numeric qualifier that can be added if there is a need for multiple CR releases.  Finally, the use of the Final qualifier is for completed releases for the community.

Check the following links for more information and confirmation:

https://forum.hibernate.org/viewtopic.php?p=2449518

http://community.jboss.org/wiki/JBossProjectVersioning

http://antwerkz.com/javabot/javabot/home/3/%23hibernate/2/29/1/11/0/2011/

Title: What does CR mean in version numbers?


答: Usually I don't make //TODO comments but keep all them in separated file. Still can't find/write online software to easy manage them so TODO files is still being most useful for me because when I open the project after even short time I forget what to do now and then I look into TODO file and do the job. I've got "filename.cpp 354 : Recode this bla bla bla" and it's much more useful then search //TODO comment in the file. I did //TODO earler when I was lazy but I just remove those old //TODO-s from source file and do not fix them when project works well. I strongly recommend to move all //TODOs from souce to separate place and keep them together with other todos so you can priority the tasks easy. Priority is really hard thing TODO when you got all your TODOs in various files and various projects.</p>

Title: Do TODO comments make sense?


答:
If you write a TODO or FIXME with the idea that someone else will fix it when they come to that code at some indeterminate future then I'd say don't bother.  They will litter the code and clutter the reporting part of your IDE that collects this information.

To be useful they should provide a means to bookmark your code for the (very) near future so that you can get back in the proper state of mind faster.  In other words, you place them in your code only to remove them ASAP.

Anything longer lived should in fact be placed in your bug base where it belongs.

There is enough noise in our lives, let's not create a new fanfare of stuff that yell for attention while it is required elsewhere.

My 2 cent

Title: Do TODO comments make sense?


问:
MVC JSon Request architecture
I am finding myself building up a whole bunch of JSON calls all through my application, which are basically actions spread across various controllers. I am considering creating a JSON Controller to keep all the JSON actions in one controller, so instead of;

```<code>Products/GetListJSON
</code>```

I would call

```<code>JSON/Products
</code>```

Might this have ramifications that I haven't considered? Can anyone think of any compelling reasons not to do this?

答:
Rule 1.  Cool URI's Never Change.  http://www.w3.org/Provider/Style/URI

Do NOT set your resource paths based on programming "optimizations" like this.
Design your paths correctly irrespective of coding considerations.  The path lives forever.  Your code will come and go.

Having the data type ("JSON" in your case) part of the path is frowned upon by some.  They argue that the response type should not be part of the RESTful path to the object.

They argue that the response type should be encoded in a header (Accepts, specifically) and the path should be unchanged.

You can, for example, do things like this to achieve the same goal: unchanging URI with encoding not in the path.

/Products/?response=JSON

I don't totally agree with their logic.

But, what's important is that programming language considerations do not drive path design for web services requests.

I think that /Products.json is not bad RESTful design.

I've used the /path/to/json/resource technique in a couple of different forms.

The thing you need to be absolutely clear on is rule #1: Cool URI's don't change because of programming language or toolset considerations.

Title: MVC JSon Request architecture


答:
What are the different parameters to be considered while choosing the technologies/frameworks?

Politics.

Experience.

Budget for license.

Note that there are few technical considerations that really matter C#, Python and Java (for example) all work perfectly.  The choice is usually political or experience more than anything else.  Having talked to a lot of CIO's and development directors, the politics of the situation matter more than almost anything else.

How those parameters can affect the project quality, schedule, expense?

Zero effect.

Quality is a matter of doing things properly.  Right Design.  Right Requirements.  Right Budget.  Right Testing.  Right Attitude.  etc.  Technology doesn't matter.

Schedule is a matter of having the right people doing the right things at the right time.  Technology doesn't matter.

Expense is a function of licensing and schedule.  The technology choices are irrelevant.

Most -- not all -- most technology choices are based on experience.  "Go with what you know."  You build highest quality most quickly with familiar tools.

[I prefer the rare cases of choosing something new.  However, after 30 years in this business, I've seen most decisions based on experience and going with something well-known.]


答:
I once heard of a company who gave a fake advertise that they want to hire some developers. The selection criteria was to plan a project (the one they were actuly starting to working on). You had to chose the technology and how many people would work on it etc.

Then they just picked the technology that was mentioned most of the times:)

I don't recomend this but I just had to share this short story:)


答:
I used to write them in the past, but I have found that you do not usually follow them up.

Therefore now I only use them to mark things I want to work on right after I finish what I'm busy with. For example, I implement a new function and notice that a function I use has a small bug; I make a FIXME to fix this to avoid getting derailed in my current task.

To help me, our CI builds are set up to fail if there are FIXMEs in the code :-).

If you notice potential problems that cannot be addressed right away, open a ticket/bug/issue for them. That way, they can be prioritized like all bugs. I feel this is much better than having some problems in the bug DB and some in the code as TODOs.

Optionally, you can then put in a TODO with the bug ID :-).

Title: Do TODO comments make sense?


问:
Multiple classes in a single .cs file - good or bad?
Is it advisable to create multiple classes within a .cs file or should each .cs file have an individual class?

For example:

```<code>public class Items
{
    public class Animal
    {
    }

    public class Person
    {
    }

    public class Object
    {
    }
}
</code>```

Dodging the fact for a minute that this is a poor example of good architecture, is having more than a single class in a .cs file a code smell?

答: Another issue is that with very large and similar classes in the same file - when you can't see the class declaration at all times - you may end up putting breakpoints in the wrong class and wondering why they don't get hit... grrr! :)

OwnerDisplayName: Sergio


答: Well if your target audience is just linux and you are planning for desktop apps on gnome then I would recommend Vala OR Genie. Both are very well integrated with gtk the toolkit for building gnome apps and Genie has pythonic like syntax and both language are very well documented. </p>

Title: What is the starting point for Ubuntu app development?

Body:
I'm thinking of developing software for Ubuntu and other related Linux-based distros (like Linux Mint). But currently am at a loss for where to start.

Would learning Python be enough/good?
And what are the other things I should know about before starting this kind of developing?

And will I be able to publish my apps to a software store like Ubuntu store even if I am from outside USA/UK? If not, what are the options I have to make my apps reach the audience?

As a lot of users had asked, I intend to build applications only for Linux (I'm thinking of Gnome) that will be a bit business and enterprise oriented.

Currently I am an Oracle certified Java developer in J2SE and J2ME. And I know Python a bit.


问:
Is code commonly generated from UML?
So when I was at university I was educated on the benefits of UML and its future in code development.

But from my industry experience, I've found that while we do use diagrams—ranging from ER diagrams, class diagrams, state diagrams, to work flow diagrams—all of it is for communication purposes.

That is, I've never generated code automatically from diagrams, and from a communication standpoint, I generally try to keep my diagrams as simple and easy to understand as possible.

But when I look at Visio and Enterprise Architect, it seems they have many different types of graphs, shapes, properties objects, most of which I don't use.

Do people use UML to do more sophisicated things such as code or database generation?

答:
NO

The legend was based on the failed assumption that writing:

```<code>class ClassName extends SomeThing
{

}
</code>```

...it's hard and needs automation.

You still may find the occasional believer, or crowds of believers.

But that's how it goes with religions and cults.

Title: Is code commonly generated from UML?

Body:
NO

The legend was based on the failed assumption that writing:

class ClassName extends SomeThing
{

}

...it's hard and needs automation.

You still may find the occasional believer, or crowds of believers.

But that's how it goes with religions and cults.


问:
two approaches to database modeling - which one to use when
recently I have noticed a new approach to data modeling vs what I have used so far. This seems to be a way to address modeling of an entity that has a very large set of fields and quite often many of them are empty.

First approach - the one I used previously:

Main table for the main set of fields (a,b=1,c=2)

Additional table with a subset of fields  (a,e='foo',f='bar',...) - linked to Main one by a 1-1 relation

Yet another Additional table with a subset of fields (a,j=3,k='baz',...) - linked to Main one by a 1-1 relation

And one more with the rest of the fields (a,n=12.4, o='foobarbar', ...) - linked to main one by a 1-1 relation

The one I have seen recently is:

Main table with almost no data except for an ID (a)

Table that lists all the fields possible (b,'this is parameter b')

a table that links the Main one with all the fields it has (a,b,1) and (a,c,2) and (a,e,'foo') and so on.

I understand you can query same results from both models, but I do not understand what is the rationale for the second one - are there clear cases where one of those should be used vs other? Thanks for your advice.

PS. The second one is being used on Oracle 11 - my last real life experiences with SQL were in the times of Postgres 7.x might be things changed meanwhile :)

答: If I am reading it right the second format looks like something you would use if you don't know what are all the fields for the main entity.  This would be the case if you want the user to specify properties of the main entity.</p>

OwnerDisplayName: Piotr

OwnerDisplayName: hardcodedid


答:
For projects which would have had to develop from scratch the functionality provided by this software, it's a definite convenience not to do so.

But whether a comparable open source package would be better depends on other factors:

will it be used to provide some service or bundle it as a part of another product?

do they have the resources to enhance and maintain the product independently?

is there a competitive advantage to use this software over the open source version (either in the code or the project management)?

Answering no to any of these factors indicates the OSS is a better choice.

Most of the time, the code itself isn't the determining factor. One needs to examine the bigger picture.

SIDEBAR OSS projects can't legally promise they'll keep future versions open, or that there will be future versions. That's one reason why having an open license is so advantageous. Also, OSS projects aren't required to accept patches from contributors (particularly without a transfer of ownership or rights).

Title: Does it matter to you that a software is "available source" but not "open source"

Body:
You probably know the list of open source licenses officially approved by the OSI. Most notably I guess would be the GPL, MIT, [insert your favorite license here].

I recently ran into a project which although was open source (the creator made all source code available), was not officially open source under one of those official licenses.

It released the source, but made no promise to release the source in the future.

It allowed modification suggestions, but made no promises to accept patches and disallowed external distribution of externally-patched versions.

It allowed the use of the software in commercial or paid projects, but disallowed the sale of the software itself.

I suppose it could be called "available source" not open source as we like to think of it.

I can see why the management team of a company wouldn't want to do business with this software. They can't fork it, they can't sell it, they can't create their own version of the software and distribute it or sell it.

But would it matter to you as part of a software engineering team who's just using this software? I can still get my work done with it, I can use it in a project for which I'm paid (but I can't sell the software itself, which I'm not in the business of doing anyway), and I can make changes to the code to make it behave differently for my needs (but I can't make those modifications public), and if I do want those modifications officially made available to others, the approval is up to the project itself and they choose whether to incorporate them in an official release or not.

So we know that a company that wants to base its business on this "available source" software can't do that, but as someone from the software engineering team, would those differences matter to you or do they seem less relevant?

Curious what others think of this.


问:
Worth it to Learn an Archaic Language?

Possible Duplicate:

  Is COBOL still worth learning?

One of my better college professors often talked about the advantages of learning an archaic language (COBOL or SAP ABAP for example) in one's free time because of the advantages it provides when looking for high-paying jobs, or if you find yourself out of the job and in need of temp work(consulting, etc.). I was curious what your thoughts are on this, especially if you work with these languages, and whether the time investment could really pay off for future job hunts.

For a little background, I am a junior software developer relatively fresh out of college, with knowledge of mostly just Java, SQL, and web programming (JS, HTML, CSS, etc.) which have provided me with no lack of job opportunities thus far.

UPDATE: I thought this was interesting. I am currently looking for jobs (always a good thing to do in my opinion, and DICE makes it simple), and was just approached by a company for an SAP ABAP position where training in the language would be part of the job. Thank you everyone who responded, I will certainly take your advice into consideration!

答:
If your goal is to be able to compete in the job market I suppose this is country specific so I will address this from the point of view of the USA.

In the USA there are lots of older programmers who have been laid off from major companies who have 10+ years experience in these "archaic" languages. If you were a hiring manager in need of a COBOL or FORTAN programmer for a complex legacy system (unlikely they would be building a new system in an archaic language!), who would you hire? Would it be a programmer with 20 years experience on COBOL or a hotshot web developer who learned COBOL on the side for fun but has never actually worked as a COBOL programmer?

On the other hand if the goal is to broaden your knowledge in general or because you want to do it for fun then I say go for it. It is always good to learn multiple languages.

Title: Worth it to Learn an Archaic Language?


答:
About a decade ago after a conference day I happened to find myself in a pub with Erwin Unruh and a few others and I asked him about the program VJovic mentioned. We have had a couple of beers by then, it was an unofficial meeting, and it's lived in my head for a decade, so take this with a grain of salt, but according to my memories:

He said that they had added template features in order to better serve the STL. According to him, some/many in the committee felt that they were creating something without knowing its full capabilities. He himself suspected that all the template stuff, especially so partial specialization, made up a Turing-complete language, and he always meant to do a formal proof of that, but never got around doing so.

Instead one night at a standardization meeting he came up with that program which printed prime numbers as error messages (a version that should work with modern compilers is here) that it computed during the compilation. As a template meta-program it isn't very impressive by today's standards, but it was a first, after all. Someone made what he considered a joke by formally submitting the program so it became an official ISO standardization document.

I remember that I specifically asked him about Bjarne Stroustrup's reaction to the program, and in response Erwin mimicked him by covering his eyes with his hand. :)

In hindsight I regret I hadn't asked Todd Veldhuizen, who also was at that conference, how he came up with expression templates. (He certainly was a nice chap to talk to.) But I was much younger than, and let the life-time opportunity slip by. :(

Title: In C++, were SFINAE and metaprogramming intentional or just a byproduct of templates?

Body:
SFINAE and template metaprogramming can do wonderful things and many libraries also use them considerably.

Historically both of these "magic concepts" were intentionally introduced/supported in C++ ? Or they were just later discovered as useful byproducts (side products) of original template programming ?


答:
The second format you're outlining is a fairly common Data Warehouse strategy.

It's used to de-normalise data when you have an extremely large (or complex) set that needs to be stored over a long period of time, during which there may be a number of schema changes, or if you want to warehouse an entire schema into a much smaller set of tables.

In the wild it's a fairly rare to come across during application development as it is extremely slow to query compared to a standard relational model, you don't have the luxury of indexes or the query optimiser so it becomes difficult to select a sub-set of data. This is obviously only a problem if query speed is a primary concern, so certain domains will benefit massively from a de-normalised data format (medical record storage and insurance company data are two examples I can think of off the top of my head).

If I were dealing with a sparse-matrix-style dataset (which I don't often have to at my current job, but have done in the past) I'd probably go with the google-style BigTable if you're aware of the possible column set before the DDL is created, or can do column additions as a long-running batch during application downtime. That way you still have the ability to index and query effectively, which, given that you've said this is Oracle related, you really want to be able to do!

Title: two approaches to database modeling - which one to use when

Body:
recently I have noticed a new approach to data modeling vs what I have used so far. This seems to be a way to address modeling of an entity that has a very large set of fields and quite often many of them are empty.

First approach - the one I used previously:

Main table for the main set of fields (a,b=1,c=2)

Additional table with a subset of fields  (a,e='foo',f='bar',...) - linked to Main one by a 1-1 relation

Yet another Additional table with a subset of fields (a,j=3,k='baz',...) - linked to Main one by a 1-1 relation

And one more with the rest of the fields (a,n=12.4, o='foobarbar', ...) - linked to main one by a 1-1 relation

The one I have seen recently is:

Main table with almost no data except for an ID (a)

Table that lists all the fields possible (b,'this is parameter b')

a table that links the Main one with all the fields it has (a,b,1) and (a,c,2) and (a,e,'foo') and so on.

I understand you can query same results from both models, but I do not understand what is the rationale for the second one - are there clear cases where one of those should be used vs other? Thanks for your advice.

PS. The second one is being used on Oracle 11 - my last real life experiences with SQL were in the times of Postgres 7.x might be things changed meanwhile :)


问:
Will I ever be able to code client-side browser code in a language of my choice?
I'll be brutally honest: I hate writing client side code in JavaScript. I'm not a fan of this language, to say the least.

It seems silly to me that browsers support a programming language, rather than an intermediate virtual machine (like CIL or JVM). The latter would allow programmers to write in a language of their choice (to some extent), rather than in one fixed pre-set language. This language could evolve more rapidly, because only changes to the CIL/JVM/whatever would require every major browser to upgrade. Language features could be added without affecting old browser experience.

The massive savings of effort that intermediate langauges bring about are well known. Are there any initiatives out there to promote browser "scripting" in something other than JavaScript, and especially in an already designed, developed and optimized virtual machine? Do they have any momentum?

答:
This question pops up from time to time.

Why don't we have other languages in script tags instead of just Javascript

Back in the day IE introduced VB as an alternative to Javascript. I think you can already see how this would lead to standards hell if it caught on...

So why not a common standard intermediate language then?

There is an old podcast from Brendan Eich explaining why he doesn't see an intermediate bytecode language in the near future:

http://www.aminutewithbrendan.com/pages/20101122

http://news.ycombinator.com/item?id=1893686

The basic problem is that while the intermediate language (like CIL & the JVM bytecodes) tries to be generic, most of they time they turn out to be too low level and too bound to the original high level languages that compiled to them. For example, you can't really implement tail recursive functions in the JVM - what other language features or implementation choices will we be unable to implement if we couple to a low-level bytecode abstraction too early?

Meanwhile, Javascript is a flexible high level language with extablished semantics and multiple, different, efficient implementations. What we might see in the future is Javascript itself as an intermediate language -  Unfortunately this is somewhat immature and few languages compile to JS as of today.

ContentLicense: CC BY-SA 4.0


问:
Keep my classes and methods as small as possible?
A few days ago, I was talking to a Software Engineering PhD candidate and at some point she said to me:

Keep your classes and methods as small as possible

And I wonder if this is always a good practice.

I mean for example, is it worthy to have a class with only 2 attibutes in it? For instance, In  some methods I need pairs of integers to work with. Should i write a "PairOfIntgers" class?

Could this way of thinking "break" the code in too many pieces?

答:
There is a grain of truth in that advice, but IMHO it is not very well expressed, thus easy to misunderstand and/or to take to a stupid extreme. At any rate, this should be a rule of thumb, rather than hard law. And you should always imply in such rules the clause "within reasonable limits", or "but don't forget to use your common sense" :-)

The grain of truth is that in practice, classes and methods always tend to grow by nature, not shrink. A bug fix here, a little feature extension there, handling a special case over there... and voila, your once neat and small class starts to bloat. Over time, your code almost inevitably tends to become a monstrous mess of spaghetti - unless you actively fight this tendency via refactoring. Refactoring almost always produces many smaller classes / methods from a few big ones. But of course, there is a sensible limit to miniaturizing. The point of refactoring is not to have smaller classes and methods per se, but to make your code cleaner, easier to understand and maintain. At a certain point, making your methods / classes smaller starts to decrease readability, rather than increasing it. Aim towards that optimum. It is a blurry and moving target area, so you don't need to hit it spot on. Just improve the code a little whenever you notice some problem with it.


答: The God Object anti-pattern is what she was probably alluding to.  I do tend to think that if I have an "and" in my class description, I should have two classes.  If I have more than ten lines of code in a method/function, then I should break it up.  As the pirate code, those are more guidelines than rules.</p>

Title: Keep my classes and methods as small as possible?

Body:
A few days ago, I was talking to a Software Engineering PhD candidate and at some point she said to me:

Keep your classes and methods as small as possible

And I wonder if this is always a good practice.

I mean for example, is it worthy to have a class with only 2 attibutes in it? For instance, In  some methods I need pairs of integers to work with. Should i write a "PairOfIntgers" class?

Could this way of thinking "break" the code in too many pieces?


答:
I think TODO comments, to some extent, make sense. Particularly if you are working iteratively (as is common in agile and TDD shops), there will be things that you recognize are going to be needed before long but which you don't want to make the detour to implement right then and there.

What gets ugly is when such comments remain in the codebase. While you are actively working on a feature it's fine to leave them in, but as soon as you get closer to completing the feature, you should focus on getting rid of them. If you don't want to go through the work of actually replacing them with proper, working code then, at least factor out the relevant functionality. To borrow @JoonasPulakka's example, where the code initially says

```<code>ConnManager.getConnection("mydatabase"); // FIXME: DB name should be configurable
</code>```

you might change that to something like

```<code>ConnManager.getConnection(GetDatabaseName());
</code>```

with, for the time being, GetDatabaseName() being a stub that simply returns the same string that you started out with. That way, there is a clear point of future expansion, and you know that any changes made there will be reflected anywhere the database name is needed. If the database name is even moderately generic, this can be a massive improvement in maintainability.

Personally, I use a keyword of my own instead of strictly TODO, although the intent is the same: to mark things that I know will need revisiting. Also, before I check in my code, I do a global source code search for that keyword, which is chosen such that normally it should not appear anywhere in the code. If it's found, I know I forgot something, and can go ahead and fix it.

As for including the programmer name/signature with the comment, I think that's overkill if you have a source code version control system (you do, right?). In that case, its blame feature will tell you who added the comment, or more accurately who last checked in a change that touched the comment. For example, in Visual Studio, this is easily accomplished by using the "Annotate" feature found among the source control features.

Title: Do TODO comments make sense?

Body:
I think TODO comments, to some extent, make sense. Particularly if you are working iteratively (as is common in agile and TDD shops), there will be things that you recognize are going to be needed before long but which you don't want to make the detour to implement right then and there.

What gets ugly is when such comments remain in the codebase. While you are actively working on a feature it's fine to leave them in, but as soon as you get closer to completing the feature, you should focus on getting rid of them. If you don't want to go through the work of actually replacing them with proper, working code then, at least factor out the relevant functionality. To borrow @JoonasPulakka's example, where the code initially says

ConnManager.getConnection("mydatabase"); // FIXME: DB name should be configurable

you might change that to something like

ConnManager.getConnection(GetDatabaseName());

with, for the time being, GetDatabaseName() being a stub that simply returns the same string that you started out with. That way, there is a clear point of future expansion, and you know that any changes made there will be reflected anywhere the database name is needed. If the database name is even moderately generic, this can be a massive improvement in maintainability.

Personally, I use a keyword of my own instead of strictly TODO, although the intent is the same: to mark things that I know will need revisiting. Also, before I check in my code, I do a global source code search for that keyword, which is chosen such that normally it should not appear anywhere in the code. If it's found, I know I forgot something, and can go ahead and fix it.

As for including the programmer name/signature with the comment, I think that's overkill if you have a source code version control system (you do, right?). In that case, its blame feature will tell you who added the comment, or more accurately who last checked in a change that touched the comment. For example, in Visual Studio, this is easily accomplished by using the "Annotate" feature found among the source control features.


答:
In object-oriented programming, the single responsibility principle states that every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class. Usually you are doing more than one thing if your class gets too big.
In your case the class is just a data class which holds data which is totaly ok. You shouldn't name the class PairOfInteger. What does the integers describe?
Depending on your scenario a Tuple (like in C#) might be sufficient, too.
And you may want to think about a strut instead of a class.

Try to hold you classes small. And methods even smaller. Maybe 10 Lines?!?
Currently I'm trying to use flow design and event based components which seems to help to hold classes small. First I was worried to get to many classes but it really works!!!
http://geekswithblogs.net/theArchitectsNapkin/archive/2011/03/19/flow-design-cheat-sheet-ndash-part-i-notation.aspx
http://geekswithblogs.net/theArchitectsNapkin/archive/2011/03/20/flow-design-cheat-sheet-ndash-part-ii-translation.aspx


问:
Is partial classes modern Subject-Oriented programming?
Important discussion follows:

C# and other language have made partial classes more popular.
But isn't this really a tool that have reinvented the subject-orientated programming wheel?
What do you guys think? Should subject-orientated programming be taught more and get more focus to help programmers utilize partial classes better?
Resources: http://ptsoft.net/tdd/papers/MDSoC_Thesis_MsC_Final.pdf

Low important optional side track for discussion follows:

I my self use a form of subject-oriented when making a space imperium hobby project in unity3d.
In unity3d gameobjects (3d models) that exist in the 3d engine can have "scripts" (read classes or any code file) attached to them with some special global functions that can run on each frame. This is a perfect ground to use subject orientated programming.
Take for example a fleet gameObject, since i can attach one value class (weight, name, attack, defence), one gameRule class that handles all business logic and if i need a new subject, for example "Raid" i only add a raid class to the gameObject and all these are separated.

These all implements a a general interface for their subject so they can be checked for and accessed by
"
IRaid = gameObject.GetComponent[of IRaid]
if IRaid is not null:
  code
"

答: At least in C# the purpose of partial classes is largely to keep the auto-generated code separate from the code typed by programmers, I've never seen a need to have a class separated into two+ files, it seems like if there was a good reason to do that, they probably should just be separate classes.</p>


答:
The more important issue to stress here is creating good abstractions. Small classes that are loosely coupled and have high cohesion are the product of good abstractions.

Sometimes it makes perfect sense to encapsulate two integers in a class. Especially if you want to have methods 'attached' to this class to also encapsulate how one can manipulate these attributes and to make sure you protect them from other parts of the program changing them.

Another positive to create a class in this case is that the class can evolve a lot better/nicer than let's say a lower level data structure like a Map or List can.

Third, a good abstraction can improve readability a great deal. Classes that adhere to SRP are usually a lot easier to understand by a human than classes that do not.

And just as a final note... no matter how good of a student you are... to understand OOP and good abstractions and when to use them, you need experience. You need to write bad code and go through the pain to maintain it. You need to see others write good code to build up your knowledge about what is 'good' and what will be a problem down the line... So do not beat yourself up if you just do not get it right away.


答:
For example if I model a protocol as a class (or xml, etc) i use a class or maybe a few classes. But, if I ever need to add extra-features on top of those classes, I just keep my code separated by the main class, in another file, (className.Partial.cs) using partial classes.
This way it seems to be a cleaner implementation and i know exactly where to go to add/chage stuff.</p>

Title: Is partial classes modern Subject-Oriented programming?

Body:
Important discussion follows:

C# and other language have made partial classes more popular.
But isn't this really a tool that have reinvented the subject-orientated programming wheel?
What do you guys think? Should subject-orientated programming be taught more and get more focus to help programmers utilize partial classes better?
Resources: http://ptsoft.net/tdd/papers/MDSoC_Thesis_MsC_Final.pdf

Low important optional side track for discussion follows:

I my self use a form of subject-oriented when making a space imperium hobby project in unity3d.
In unity3d gameobjects (3d models) that exist in the 3d engine can have "scripts" (read classes or any code file) attached to them with some special global functions that can run on each frame. This is a perfect ground to use subject orientated programming.
Take for example a fleet gameObject, since i can attach one value class (weight, name, attack, defence), one gameRule class that handles all business logic and if i need a new subject, for example "Raid" i only add a raid class to the gameObject and all these are separated.

These all implements a a general interface for their subject so they can be checked for and accessed by
"
IRaid = gameObject.GetComponent[of IRaid]
if IRaid is not null:
  code
"


答:
TODO is just a subform of comment. Comments have great utility if the writer is at all skilled in knowing what to convey and how to convey it. A sense of humor can also be applied here in small doses to delight maintainers years later.

I got a call last year that some of my code was being retired. I was rather impressed that it had been in production and survived maintenance for 16 years. So be aware, your code could last a LONG time. Comments on intention, future needs and so forth can go a long way in helping someone out years from now who is looking at your code for the first time.

Title: Do TODO comments make sense?


答:
I strongly recommend that every TODO or FIXME be entered into a formal log. If they are not, they are easily searchable, and it should be a phase in each iteration to check for outstanding TODOs and FIXMEs. These can then be catalogued, and either set for immediate remedy, or the team can plan to fix them at the appropriate time.

Finally, once fixed they need to be removed - if they are not eliminated in a systematic manner after being resolved, they will lose their effectiveness.

Bottom line: They're better than not logging issues at all, but you actually have to maintain them.

Title: Do TODO comments make sense?


问:
Is it a bad idea to stray from CSS selector syntax in a JavaScript selector engine?
I'm designing a JavaScript selector engine, and I'm currently focused on parsing the selector string. Specifically, combinators.

The CSS3 combinators I know of are:

> (children)

space (descendants)

+ (next sibling)

~ (all next siblings)

Which is fine for how CSS works (how style rules are applied). However, I'm now realizing (now that I'm examining this paradigm more closely) that this seems a bit limiting in a JavaScript setting.

Below I've created an alternative list of combinators. What I would like to know is:

Do any of the current selector engines stray from standard CSS selection methods? (I'm familiar with Sizzle and Sly, but none of the others)

Do you see any reason why any of the combinators I've listed wouldn't work well?

Do you think having more selector string options (more combinators, more filters, etc) is beneficial or are just a waste/confusing/dumb/etc?

Thanks all in advance for your thoughts!

> (children)

>> (descendants) (also, space would still work)

+ (next sibling)

++ (all next siblings) (also, tilde would still work)

- (previous sibling)

-- (all previous siblings)

* (previous and next siblings)

** (all siblings)

^ (parent)

Example 1: div ^ span - get all spans with a div child

Example 2: div ** span - get all span siblings of div

Example 3: .lastListItem -- li - all li previous to the li with class .lastListItem

Example 4: #thing ^ div ** .error - all items with class .error that are siblings of #thing's parent (assuming #thing's parent is a div)

p.s. Oh, and I also thought of having a placeholder character that could stand in for any simple selector. So, Example 4 might look like this (with an underscore as a placeholder):

Example 4 alt: #thing ^ _ ** .error - all items with class ".error" that are siblings of #thing's parent (no matter what kind of element #thing's parent is)

答: Before you go too far into implementing your custom selector engine, I would suggest you check to see wether you aren't just reimplementing XPath. It is an alternate XML selector engine that is implemented by most browsers</p>


答:
The huge advantage of todo comments over any of the other million or so ways one can create a task list is that todo comments travel with the code so they can't get separated.

Probably the more appropriate place for stuff like this is the issue tracker rather than the code though.

Title: Do TODO comments make sense?


答:
That is OK advice, but it needs to be implemented somewhat intelligently.  Definitely don't follow it blindly.

When I look at my code I know if a method is too big. If it is doing too much, and would be too hard to read, then it is refactor time.

Here's a good example: you have a loop, and you have maybe 60 lines of code in that method.  In that case, it is probably time to refactor because you are likely doing too much in that method.

But, it isn't a hard and fast rule.  It's only something you get to learn by doing.  And, other developers you are working with my not always agree and may call you out in a code review or whatever.


答:
Make things as simple as possible, but not simpler. That's the rule I try to go by. Sometimes, it actually makes sense for a class to do what strictly speaking amounts to more than one thing, if those things are related on some common theme. Look at .NET; there are tons of classes that implement a large number of interfaces, each with its own list of required members. A method might end up needing to become somewhat long if it does something complex with a number of intermediate steps which are all interconnected and thus don't lend themselves very well to further refactoring. (Refactoring to keep methods short should ultimately be about readability and maintainability; if the long method is more readable and/or maintainable than a short one, all else equal, I will take the long one any day.)

To only "make classes and methods as small as possible" is, in my opinion, misguided. The real challenge is, as @c_maker points out, to provide good abstractions. Your example of grouping two numbers together is great, for example, if you are working on an implementation of complex numbers arithmetic, or if on a Unix system you need to refer to a user/group context. It makes very little sense if the numbers represent, say, an invoice ID and a product ID to be added to that invoice.


答:
"Partial classes" is a way to split up the implementation of a class to different files - which is just a physical separation. Fullstop. Nothing more. It does not imply any logical separation per se.

For what purposes one uses this feature is a different thing. Typically this can be used to separate autogenerated code from hand written code. And also you can use it for dividing your class code into logical groups. Or you use it to group methods with names beginning from A-E in one file, F-M in a second and so on (just kidding).


问:
How should I write my if statements?

Possible Duplicate:

  Make a big deal out of == true?

When I was a young padawan in the world of programming, a person I considered a mentor told me that if statements are more aesthetically pleasing if written in the following way:

```<code>if (condition == false) {
    doSomething()
}
</code>```

or

```<code>if (condition == true) {
    doSomething()
}
</code>```

I personally found that in the first case it's true, or at least it's easier to read than

```<code>if (!condition) {
    doSomething()
}
</code>```

In the "true" case, it's probably an overkill.

So I just use it when I want to test the condition for the "false" case.

Almost all my current coworkers tell me that way is plain wrong.

Does writing the if statements like that have a performance problem? Am I wasting milliseconds on each evaluation by doing it like that?

Sonar reports them as too complex

Can you convince me to not do it anymore? ...or that it's ok to do it like that?

答:
Performance problem? No.

I personally prefer

```<code>if (!condition)
</code>```

And

```<code>  if (condition)
</code>```

I like my If statements to ALWAYS resolve to true.

For example I would never to something like this: (I don't even know if this is valid syntax) (Looks very complex Doesn't it?)

```<code>if ((a==b)==False)
</code>```

I Would do:

```<code> if (!(a==b))
</code>```

or likely

```<code> if (a<>b)
</code>```

Title: How should I write my if statements?

Body:
Performance problem? No.

I personally prefer

if (!condition)

And

  if (condition)

I like my If statements to ALWAYS resolve to true.

For example I would never to something like this: (I don't even know if this is valid syntax) (Looks very complex Doesn't it?)

if ((a==b)==False)

I Would do:

 if (!(a==b))

or likely

 if (a<>b)


答:
```<code>if (condition == true) {
    doSomething();
}
</code>```

This is just wrong. You're violating DRY. You want to know if it's true, then you check it again in the if. Anyone who can't grasp the == true of the if statement needs to go back to school. The same is true of the other example.

For this reason, they're also more difficult to read. When I read statements like that, I lose trust in the coder who wrote it and add it to a list of potential bugs. Doesn't he understand the concept of if? Is it a mistake for the condition to be that way? Do I need to stop and understand this whole function to try and grasp whether or not that is actually correct? What else is lurking here?

Also, in some languages, this is a bug in as of itself. Imagine, in C++11,

```<code>std::unique_ptr<int> i;
if (i) // valid

if (i == true) // not valid
</code>```

In C++11, the language statements which expect boolean expressions are an explicit conversion to bool, which can invoke the ones used in e.g. smart pointers, but your comparison to true won't. Fortunately, the compiler will spank you for it, but it's still a bug.

There's no need at all to invoke boolean constants in such statements.

Title: How should I write my if statements?

Body:
Possible Duplicate:

  Make a big deal out of == true?

When I was a young padawan in the world of programming, a person I considered a mentor told me that if statements are more aesthetically pleasing if written in the following way:

```<code>if (condition == false) {
    doSomething()
}
</code>```

or

```<code>if (condition == true) {
    doSomething()
}
</code>```

I personally found that in the first case it's true, or at least it's easier to read than

```<code>if (!condition) {
    doSomething()
}
</code>```

In the "true" case, it's probably an overkill.

So I just use it when I want to test the condition for the "false" case.

Almost all my current coworkers tell me that way is plain wrong.

Does writing the if statements like that have a performance problem? Am I wasting milliseconds on each evaluation by doing it like that?

Sonar reports them as too complex

Can you convince me to not do it anymore? ...or that it's ok to do it like that?

Body:
if (condition == true) {
    doSomething();
}

This is just wrong. You're violating DRY. You want to know if it's true, then you check it again in the if. Anyone who can't grasp the == true of the if statement needs to go back to school. The same is true of the other example.

For this reason, they're also more difficult to read. When I read statements like that, I lose trust in the coder who wrote it and add it to a list of potential bugs. Doesn't he understand the concept of if? Is it a mistake for the condition to be that way? Do I need to stop and understand this whole function to try and grasp whether or not that is actually correct? What else is lurking here?

Also, in some languages, this is a bug in as of itself. Imagine, in C++11,

std::unique_ptr<int> i;
if (i) // valid

if (i == true) // not valid

In C++11, the language statements which expect boolean expressions are an explicit conversion to bool, which can invoke the ones used in e.g. smart pointers, but your comparison to true won't. Fortunately, the compiler will spank you for it, but it's still a bug.

There's no need at all to invoke boolean constants in such statements.


答:
By using ==, you’re subverting the meaning of if: if the condition is true, carry on; if it’s false, do the else case, if any. if (x == true) says “if it is true that x is true”, and if (x == false) says “if it is true that x is false”. This is not only redundant, but quickly becomes misleading.

I defy you to tell me at a glance: what does if (!(notDone != false)) mean? “If it is not true that notDone is not false”? Why say something so convoluted when if (!done) (“if not done”) suffices?

Simplify, simplify.

Title: How should I write my if statements?


答:
Use whatever is more readable.

In our company, it's customary to choose

```<code>if (isReportOpen()) {
    doSomething();
}
</code>```

but

```<code>if (int.TryParse(a, b) == true) {
    doSomething();
}
</code>```

In the first case, it's obvious that the method call isReportOpen() is used as a Boolean condition, so I'll use it as it is. It also reads fluently: if [the] report is open, [then] do something.

In the second case, it's not at all obvious that the method returns a Boolean indicating success or failure. Thus, it reads: if trying to parse a as an integer returned true, [then] do something.

Title: How should I write my if statements?

Body:
Use whatever is more readable.

In our company, it's customary to choose

if (isReportOpen()) {
    doSomething();
}

but

if (int.TryParse(a, b) == true) {
    doSomething();
}

In the first case, it's obvious that the method call isReportOpen() is used as a Boolean condition, so I'll use it as it is. It also reads fluently: if [the] report is open, [then] do something.

In the second case, it's not at all obvious that the method returns a Boolean indicating success or failure. Thus, it reads: if trying to parse a as an integer returned true, [then] do something.


答:
A more obnoxious, yet effective method is probably to turn your todo comments into compiler messages, that way you and everyone else sees it when the program is compiled.

in Delphi:

```<code>{$message 'todo: free this thing when you know its not going to blow up'}
</code>```

Title: Do TODO comments make sense?

Body:
A more obnoxious, yet effective method is probably to turn your todo comments into compiler messages, that way you and everyone else sees it when the program is compiled.

in Delphi:

{$message 'todo: free this thing when you know its not going to blow up'}