问:
How can I improve my user interface and usability design skills?
I invested most my time and resources in programming, and now I think it's time I should invest some time in learning about user interface design, user experience, and usability.

What are some good resources about usability and designing user interfaces? I'm mainly looking for more theoretical topics, such as color theory and color physiology and how they affect users, along with information about best practices.

答:
Start by bookmarking https://ux.stackexchange.com/
If you are concerned about UI design then start by creating some custom controls. Think of something that you think is not possible on one platform (like an awesome looking control on WinForms) and try to design it yourself. I've learned a lot this way. More you experience more you learn. I also recommend reading any or all of the following books:

Rocket Surgery Made Easy => From the author who wrote Don't Make Me Think

Designing Interfaces => This book is a big one and covers the design patters for UI. There is a chapter on psychological aspect too.

Visualize This => I just started reading it and it is awesome. It is mostly about using statistics to visualize your data but is a great book on cool looking visualization.


问:
Do you sign each of your source files with your name?

Possible Duplicate:

  How do you keep track of the authors of code?

One of my colleagues is in the habit of putting his name and email address in the head of each source file he works on, as author metadata.  I am not; I prefer to rely on source control to tell me who I should be speaking to about a given set of functionality.

Should I also be signing files I work on for any other reasons?  Do you?  If so, why?

To be clear, this is in addition to whatever metadata for copyright and licensing information is included, and applies to both open sourced and proprietary code.

答:
I do. The reason is not because I want to "own" it somehow, by putting my name on it. If someone wanted to edit that line out, I could care less. And saying version control will store my data is true, and yet pointless if someone doesn't have access to my repo.

I work for a big corporation, and my code wanders from business unit to business unit. The poor schmuck who gets the code from a guy, who got it from another guy, who got it from my idiot boss, isn't going to have the faintest clue who to call for support unless I leave a hint in the code itself.

And, because I don't expect to stay here forever, I leave real contact information, so people can contact me after I've left my current job if they need something. It's just courtesy.

ContentLicense: CC BY-SA 3.0


问:
Class as first-class object
Could a class be a first-class object? If yes, how would the syntax for dynamically creating new classes look like?

To narrow the question - how would you give this functionality while keeping language consistent?

For example how you create reference for new type. Do you make reference first-class object too and then use something like this:

```<code>Reference<newType> r = new Reference<newType>();
r.set(value);
</code>```

Well this could get messy so you may just force user to use Object type references for dynamically created classes, but then you loose type-checking.

I think creating concise syntax for this is interesting problem which solving could lead to better language design, maybe language which is metalanguage for itself (I wonder if this is possible).

答:
Different programming languages are designed according to different philosophies and with different kinds of users in mind. Some languages treat classes (or, more generally, types) as first class objects; other languages do not.

Languages that treat types as first-class objects can be divided in two groups:

Those that treat types as immutable objects at runtime (i.e., you
can query, but not modify the valid operations on a type, and the
types of the parameters and return values of these operations)

Those that treat types as regular objects at runtime (i.e., you can
dynamically define and modify types and operations at runtime).

The latter are particularly powerful, although these capabilities usually come at a performance cost, because a runtime must take care of the types and operations you have dynamically defined.

Regarding how the implementation would look: Are you asking this as a language user or as a language designer?

To a language user, the only thing that matters is what I said in the previous part: a runtime must take care of the types and operations you have defined.

To a language designer, well, you have to design such runtime. Oh, and implement it, if you want your language to be used in the real world.

I do not see the point of the question regarding how the syntax would be. Syntax is, by definition, language-specific. If you are a language designer, I would suggest you to get the semantics right before worrying about syntax.

Title: Class as first-class object


问:
What are the boundaries of the product owner in scrum?
In another question, I asked about why I feel scrum turns active developers into passive developers, and it seems that the overall problem is not scrumy (related to scrum), and rather it's related to the bad implementation of scrum. So, here I have some questions about the scope of the responsibilities of PO (product owner) and the limitations he/she shouldn't pass.

Should PO interfere the UI design, when there are designers at work in scrum team? (an example of this which has happened to us, is to replace checkboxes with a drop down list with two items, namely, yes and no; or to make some boxes larger, or to left-align some content instead of centering them on the page, or stuff like that). If yeah, to what extent? Colors? Layout?

Should PO interfere in Design and architecture of coding? This hasn't happened to us yet, but I'm really curious about the boundaries. For example does PO has the right to change the platform (moving from ASP.NET MVC to PHP, or something like that), or choosing the count of servers (tier architecture), etc.

Should PO interfere in validation mechanisms? For example, this field should be required, or we don't need to get this piece of information from user. Sometimes, analyzers and designers confirm that something can be handled behind the scene, like extracting the user profile info from another source, instead of asking for it in UI.

How granular could/should PO get into the analysis and design? For example, a user story might be: "As a customer, I'd like to be able to buy new domains online". However, scrum team can implement this user story in a wizard of five steps, or in one single page. To which level PO should monitor, or govern, or supervise the technical analysis, design, and implementation?

I asked these questions to judge whether our implementation is right or wrong?

答:
Product owner has financial responsibility for the product.

That says everything. It means that product owner is the first person who will be blamed if:

Product will not make money

Product will not meet requirements

Product will not meet expectations

Product will not satisfy stakeholders

Product will not satisfy end users

So what do you think now?

Yes product owner can interfere design. The PO should know what end user expects. Perhaps end user uses similar UI in other applications and he simply expects to have the new application with the same user experience.

Yes product owner can demand technology. This is called non functional requirement and it exist in Scrum as well. If customer has only Linux server application in ASP.NET MVC will be useless.

Yes perhaps customer doesn't want magic on behind.

To the level which is needed to maintain information for further discussion about user story. This usually depends on the type of project and its size. Sometimes few notes are enough and sometimes you need little bit more.

Anyway Scrum and any agile methodology is about communication. You should not be at war with your Product owner and Product owner should make only necessary interference to meet customer's criteria. He should not put his personal involvement into developers job. That is their responsibility. Who is responsible to control that team is not usurped by Product owner? The Scrum Master - it is his job to defend the team even against Product owner who transcend his role.


问:
Do I need an equivalent for MAMP to work as a Ruby Server?
I am just starting to learn Ruby, and I want to do something that required a DB but I'm unsure whether MAMP would work or do I need something else?</p>

答: Both the Rails (heavy) and Sinatra (light) frameworks have built in dev servers, fire them up and they'll be on ports 3000 and 4567 respectively. You can use the MySQL database that is part of MAMP with either framework or you could use SQLite as your dev database.</p>


问:
Why is Objective-C not widely used beyond Cocoa environments?
Objective-C features nice object orientation, simplicity, elegance, and (as a superset of C), low level ability. It could seem like the simple, modern alternative to C++ that many people look for and try to find in Go. But it is just used at Cocoa and post-NextSTEP environments, and even in this case is seen more as a burden for historical reasons than as an optimal choice.

Why it's not more widely used then? What are its problems?

答:
Well, basically, Apple is the driving force behind Objective-C since some time now:

While the last version is virtually abandoned, Objective-C 2.0 is actually starting to become increasingly tied to some of the core foundation classes/protocols, which means, there is an inherent link between the language features and the framework, NSFastEnumeration springing to my mind, which is needed for objects to properly respond to for in loops. This means, there is a growing link between the language and the platform.

There's virtually no real alternative to Cocoa. And Cocoa in turn is starting to depend on more and more OSX features. While technically, you can have an Objective-C implementation running on any OS with any core framework, there's not really much recent stuff out there for any other platform.

As it is now, Apple has full control over Objective-C and drives the language according to its needs, while there's no organization on this planet interested in running Objective-C on a non-Apple device, that would be sufficiently large to provide a standard library and toolkit to start with, that could even remotely rival the ecosystems presented by .NET/Mono, C++ or Java.


问:
How much should Developers interact with Clients?
A philosophical discussion has come up in my department that I'd like p.se's opinion on. We're a 6 person development department inside a 60 person IT shop. All other departments are growing FAST, and ours has been the same size (and not fully booked at that size) for a few years.

My manager, and old-school mainframe guy, contends that developers should never ever have ANY client contact. That all interaction with the client should be mitigated by a Project Management layer. He asserts that this allows a coder the focus they need in order to CODE, and protects the business's relationship with the client from the autism-spectrum tendencies of Joe Average Code Monkey. (My words, not his.)

His boss, the owner of the company, told him this morning that every single person in the company needs to think of themselves as an extension of the sales department, and needs to be listening all the time for upsell opportunities. To this end, he thinks clients ought to have more or less full access to developers directly, in part so that devs have the opportunity to hear sales opportunities.

I'm somewhere in the middle, myself. I think it's nice to shield devs from clients to some extent, but in practice that will never be total. And yes, every single job in the company includes sales, but that doesn't necessarily mean that everyone has the same opportunity for it.

EDIT: We're not an agile shop. Some of us (cough) would like to head that direction, but for now assume this is a traditional fixed-bid-contract shop.

EDIT2: The autism joke wasn't funny. Got it. Entirely possible that autism jokes never are. That said: there are developers who have a capacity to represent themselves and their employers well and developers who don't (currently) have that capacity. My manager has a real concern about how the company would be represented if all developers were structurally empowered to be company representatives.

It's also getting increasingly clear from reading your responses that the real push-and-pull here is between waterfall and agile.

答:
I think it is generally better to have a PM as a buffer. When there has not been, I have noticed the following:

developer gets overwhelmed by the unorganized and not-so-thought-out form that requirements come in when they are directly from the client. Good PM's do an astounding amount of work refining the raw ideas of the client before handing them off to development. Few developers have time to do this and actually build the product.

developer is offended by client, because they are dissatisfied with some component. Client is offended by developer because the developer seems to be ignoring their needs. PMs provide an objective communication channel between the two parties that is less likely to become heated under pressure.

For things to work, however, the following factors must be in place:

The project manager must be a good one. They have to have the ability to be a punching bag to everyone. Clients get frustrated with developers, testers get frustrated with business analysts, and developers get frustrated with just about everyone :).  The PM must be there to listen to all sides, and try to keep everyone happy and productive.

The developers must be willing to go through tight testing iterations. Since there will not be as much direct contact with the client, and no PM is perfect in conveying requirements, the client and testers need to see as many iterations as possible throughout the process, to continuously verify that the developer is interpreting the spec correctly. IMHO, developers that like to sit on their code until the end of project, just asking questions about the requirements, but not actually releasing deliverables frequently will not do well with this sort of structure. It is not any fault of theirs, but I think that devs with this sort of style really need to interact with the client more directly to create a better feedback loop.

Some developers hate the PM buffer structure, but I have come to love it. Having someone in the middle of a project who is accountable for the requirements is a complete lifesaver. Who else would be accountable? The client cannot be expected to describe what the want with the required detail, and you cannot put to much responsibility on the person with the check anyway. The developer could be held accountable, but they typically already have enough on their plate without having to interpret the cryptic ramblings of the BAs. A good PM who buffers out all the heat from the client makes a developer's job far less stressful IMHO.


问:
Rails: controllers vs models which should handle file manipulation
This post by Jamis Buck about keeping Rails controllers skinny has always stuck with me. I have an app in which a zip file consisting of an XML file and some images is uploaded and used to create the model (mostly from the xml file, which points to the images).

Should all the code dealing with extracting the files from the zip and moving them to their appropriate place go in the controller or the model?

thanks!

答:
Simple answer: Yes, as you already guess, this goes into the model.

Depending on how exactly the content of the zip look, you most likely hand it to a class method of the Image model, which then unpacks and evaluates the xml an creates the database records, downloads the images or whatever needs to be done.

In the controller you should have not much more than something like: (together with whatever authentication you need to handle of course)

```<code>Image.scan( params[:image_zip] )
</code>```

An alternative way would be to write a class  independently if the Image model to handle this task if you don't want to get too much code into this single model.

Body:
Simple answer: Yes, as you already guess, this goes into the model.

Depending on how exactly the content of the zip look, you most likely hand it to a class method of the Image model, which then unpacks and evaluates the xml an creates the database records, downloads the images or whatever needs to be done.

In the controller you should have not much more than something like: (together with whatever authentication you need to handle of course)

Image.scan( params[:image_zip] )

An alternative way would be to write a class  independently if the Image model to handle this task if you don't want to get too much code into this single model.


答: I would suggest picking up a copy of Don't Make Me Think.  It's an excellent beginners guide to usability that goes over some important fundamentals.</p>

Title: How can I improve my user interface and usability design skills?

Body:
I invested most my time and resources in programming, and now I think it's time I should invest some time in learning about user interface design, user experience, and usability.

What are some good resources about usability and designing user interfaces? I'm mainly looking for more theoretical topics, such as color theory and color physiology and how they affect users, along with information about best practices.


答:
That article is pretty much classic. Yes, you should stick to the "fat models, skinny controllers, stupid views" architecture as long as the models make sense as objects (and they almost always do).

In your case, I'm not really sure what the output "model" should look like, but let's say it's a gallery. So you can create a model like this:

```<code>class Gallery # no "< ActiveRecord" if don't work with database

  attr_accessor :zip_file_path, :xml, :images

  def initialize(params ={})
    @zip_file_path = params[:zip_file_path]
    @xml = nil
    @images = []
    @output = nil # model: html code, path to file...
  end

  def generate_model
    unzip_file! # populates @xml and @images
    transform_xml! # creates model into @output
    @output
  end

  def unzip_file!
    ...
  end

  def transform_xml!
    ...
  end

end
</code>```

It's just a rough design, you might want to make it more function-oriented (@xml, @images = unzip_file(@zip_file_path) ) etc.

Controller will then act just as a mediator between model and views/user:

```<code>class GalleriesController < ApplicationController
  def new()
    # display upload form for zip_file
  end

 def create()
   # check input here, or leave it to model validations

  @output = Gallery.new(params).generate_model
 end

end
</code>```

Title: Rails: controllers vs models which should handle file manipulation

Body:
This post by Jamis Buck about keeping Rails controllers skinny has always stuck with me. I have an app in which a zip file consisting of an XML file and some images is uploaded and used to create the model (mostly from the xml file, which points to the images).

Should all the code dealing with extracting the files from the zip and moving them to their appropriate place go in the controller or the model?

thanks!

Body:
That article is pretty much classic. Yes, you should stick to the "fat models, skinny controllers, stupid views" architecture as long as the models make sense as objects (and they almost always do).

In your case, I'm not really sure what the output "model" should look like, but let's say it's a gallery. So you can create a model like this:

class Gallery # no "< ActiveRecord" if don't work with database

  attr_accessor :zip_file_path, :xml, :images

  def initialize(params ={})
    @zip_file_path = params[:zip_file_path]
    @xml = nil
    @images = []
    @output = nil # model: html code, path to file...
  end

  def generate_model
    unzip_file! # populates @xml and @images
    transform_xml! # creates model into @output
    @output
  end

  def unzip_file!
    ...
  end

  def transform_xml!
    ...
  end

end

It's just a rough design, you might want to make it more function-oriented (@xml, @images = unzip_file(@zip_file_path) ) etc.

Controller will then act just as a mediator between model and views/user:

class GalleriesController < ApplicationController
  def new()
    # display upload form for zip_file
  end

 def create()
   # check input here, or leave it to model validations

  @output = Gallery.new(params).generate_model
 end

end


问:
What would motivate you to do free programming work for work after work?
I'm not talking about working overtime for a project, but R&D, or test bed applications that benefit the company. These would become teaching tools, and eventually sales tools. I know it sounds crazy to even ask, but I'm seeing a trend in this industry with regard to rapidly changing technology, and a problem with getting programmers to bring the after hours knowledge gained in house. You would think it would spill over naturally, but I find most leads holding back because the work would then be "managed" by the company, and now the property of the company. Are there solid programs or initiatives that stimulate a back-and-forth, where you can actually bring something to the table and be rewarded for it?

EDIT

Can anyone provide additional feedback on this:

Are there solid programs or initiatives that stimulate a back-and-forth, where you can actually bring something to the table and be rewarded for it?

There appears to be a miscommunication here, where some users are under the impression I'm trying to figure out how to get free work out of colleagues. Just the opposite is true. I want to know if there are programs that exist, or ideas that you have that would motivate you, which doesn't necessarily have to be money.

答:
Something the company I work for (an agile consultancy) has done is to get involved with what we call Social Impact Projects.

http://www.rapidftr.com/ is one example I'm aware of.

Whilst the company does support it more formally now by donating some developer time, there have been regular code-jams going on for at least a year, this is where volunteers meet up in the office after work one night a week and do some free development work, the company usually supplied a few beers and pizza and 10-20 people complete some stories, or fixed some bugs etc.

Of course it can just be for fun as well, find a few other passionate devs and you could do some form of code-dojo where you get together just to collectively solve some interesting problems (try here for some ideas http://codekata.pragprog.com/).


问:
Why is the c family the standard CS study regiment for Mathematics/CS programs instead of the LISP family?
I have been familiarizing myself with LISP for self improvement purposes. One of the things I have noticed is that LISP is much more within the paradigm of Mathematics than say C. The syntax and design structure seems to echo directly the actual mathematical model of an algorithm. It doesn't make sense to me why even good Mathematics based CS programs study C instead of LISP. I think that LISP more directly employs higher mathematical concepts than C. I am not saying that you can't model mathematical structures in C. I am merely noticing that LISP seems to be hard-wired for mathematicians.

I have read many of Joel Spolsky's rants on the JAVA schools and what not--and I agree with his assesment--, but my school didn't teach JAVA for that very reason. They were stringent in teaching fundamental concepts like pointers, algorithm design, recursion, and even assembly instructions. However, they did this all in C and c++. Does anyone know the reasons for this and/or its history?

答:
This really depends on the university.  Scheme (a dialect of lisp) has been the language for the introductory course in computer science at MIT for ages, although it has been replaced by python recently.  I got my BS in CS at an engineering school, where I was exposed to C, Scheme, Prolog, and C++ during my first year.  I think that was a good mix.

I firmly believe that what language you start with is much less important than being exposed to multiple paradigms early on, before your brain freezes into one way of looking at the world.


问:
How to best approach planning and budgeting of software performance optimization efforts?
There is a software system that has been with the client for some time now. If is feature-rich, mature, complex enterprise application that client uses in production. Due to the rapid expansion of the client's business the software system in subject cannot handle the volumes efficiently and overall performance does not satisfy the customer anymore.

So the customer asks the vendor of the software system for improvements in performance and efficiency of the system. The customer also expects the vendor to prepare a plan and ballpark budget so the cost of such optimizations is roughly known upfront.

What do you think is the best approach for such plan and high level budget that one could prepare for the customer? I'm asking the question because I've seen some of this kind of plans before and they are usually very vague and imprecise mainly due to the fact that such exercise is kind of chicken and egg dilemma. In order to know what exactly should be optimized and tuned in complex system the benchmarking, profiling and research is required. And that investigation is also the part of the planned project, so it is impossible to know upfront what efforts can such benchmarking results require to implement improvements.

答:
I can only give you a bit of personal experience.
We had a product with a serious performance problem, and people could only hold their finger in the wind and guess what the problem might be.

I've done a fair amount of performance tuning over the years, so I asked the manager to let me try. I pulled a number out of the air - 4 weeks.

He was skeptical and said - won't it take you that long just to set up profilers and whatnot?
I said I don't use profilers, I just take samples manually.
He said how are you going to get enough samples to get valid measurements?
I said if you have an infinite loop how many samples do you need?
If it's not infinite, just long-running, how many do you need?
He said ah-hah, and gave me the go-ahead.

It took me 2 weeks just to get the build/debug environments set up on my machine. There were two languages (possibly three, I forget).
That got me to the point where I could reproduce the problem and take a few manual stack samples, and immediately pinpointed the first problem.
From taking first samples to locating the problem took less than an hour.

Now comes the hard part - getting the owner(s) of the code to change it.
The first problem was not too hard.
The code was fixed, and there was a big reduction in execution time.
Then I took some more samples, and located the second big problem.
This time, it was not so easy to get the cooperation of the code's owner.
The required change ran against his notion of "proper design".
It seems my "political capital" was used up.
So we did not succeed as far as we could have.
If you can keep going over multiple steps, larger speedups are possible,
but there is always the danger of the "blame game".
That's where the owner of the code doesn't want to change it,
because someone might ask them why they didn't make the code that way in the first place.

It's hard to convey that performance problems are just like bugs - anyone can make them, and a measure of adulthood is being able to admit it.

Bottom line - about 3 weeks was spent, out of the 4 estimated.
We got some of the possible speedup.

Lesson learned - If you're going to do this, it needs to be spelled out to all the developers that they may have to make multiple code changes, including design changes. What's more, the changes may appear "wasteful" in the sense of making prior changes irrelevant. You need to get their buy-in.


答: Also ready the book "The Design of Everyday Things" by Donald A. Norman.  It's not about software and it was written quite a few years ago, but the concepts are very sound and useful.  Plus, it's fun to read.</p>


答:
Fundamentally, computer science theory is mathematical. Software engineering, however, is not. Modelling mathematical concepts directly is not an inherent advantage- I'd argue it can often be a disadvantage.

Good theories and good programs are not necessarily related.

Title: Why is the c family the standard CS study regiment for Mathematics/CS programs instead of the LISP family?

Body:
I have been familiarizing myself with LISP for self improvement purposes. One of the things I have noticed is that LISP is much more within the paradigm of Mathematics than say C. The syntax and design structure seems to echo directly the actual mathematical model of an algorithm. It doesn't make sense to me why even good Mathematics based CS programs study C instead of LISP. I think that LISP more directly employs higher mathematical concepts than C. I am not saying that you can't model mathematical structures in C. I am merely noticing that LISP seems to be hard-wired for mathematicians.

I have read many of Joel Spolsky's rants on the JAVA schools and what not--and I agree with his assesment--, but my school didn't teach JAVA for that very reason. They were stringent in teaching fundamental concepts like pointers, algorithm design, recursion, and even assembly instructions. However, they did this all in C and c++. Does anyone know the reasons for this and/or its history?


问:
What's the difference between an API and an SDK?
I was looking through various APIs and SDKs, when I realized that I couldn't really tell the difference between something called an API and something called an SDK.

Both of them are, conceptually, a way for your program to interface with and control the resources provided by another piece of software, whether that other software is a web service, an end-user app, an OS service or daemon, or a kernel device driver.

So, what is the semantic difference between an SDK and an API?

答:
I think it rather falls along the lines of "All SDKs are APIs but not all APIs are SDKs".

An SDK seems to be a complete set of APIs that allow you to perform most any action you would need to for creating applications. In addition an SDK may include other tools for developing for the platform/item that it is for.

An API on the other hand is just a series of related methods that may be good for a specific purpose.

As an example, the JDK (Java Development Kit) contains the API as well as the compilers, runtimes, and other miscellaneous tools. The Java API is simply all the libraries that make up the core language that you can work with out of the box.

ContentLicense: CC BY-SA 4.0


答:
An SDK could be nothing but an API (files to help interface with another app), but usually includes other code to help with debugging and other pieces for your IDE.

I'm all out of acronyms.

Title: What's the difference between an API and an SDK?

Body:
I was looking through various APIs and SDKs, when I realized that I couldn't really tell the difference between something called an API and something called an SDK.

Both of them are, conceptually, a way for your program to interface with and control the resources provided by another piece of software, whether that other software is a web service, an end-user app, an OS service or daemon, or a kernel device driver.

So, what is the semantic difference between an SDK and an API?


答:
Sure, nothing simpler than having a class be a first class object:

```<code>Object subclass: #MyObject
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'My-Category'
</code>```

(Smalltalk.)

Title: Class as first-class object

Body:
Could a class be a first-class object? If yes, how would the syntax for dynamically creating new classes look like?

To narrow the question - how would you give this functionality while keeping language consistent?

For example how you create reference for new type. Do you make reference first-class object too and then use something like this:

```<code>Reference<newType> r = new Reference<newType>();
r.set(value);
</code>```

Well this could get messy so you may just force user to use Object type references for dynamically created classes, but then you loose type-checking.

I think creating concise syntax for this is interesting problem which solving could lead to better language design, maybe language which is metalanguage for itself (I wonder if this is possible).

Body:
Sure, nothing simpler than having a class be a first class object:

Object subclass: #MyObject
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'My-Category'

(Smalltalk.)


答:
API = Application Programming Interface

SDK = Software Development Kit

So the real difference is: an API is no more nor less than an interface to "some service", while an SDK is a set of tools, components and/or classes for a specific purpose. An SDK in fact presents you with an API to interface with. But you might use an API without having the underlying components, for example when the API is provided through a web service.

Examples of APIs:

Java API

Google Maps API

Flash Player API

Examples of SDKs:

JDK

GWT

Flex SDK


答: Everything mentioned before is true, but about SDK I would like to add that a software development kit is (or should be) a really complete package with (almost) all the necessary tools for the development process, while API is "just" an interface to interact with.</p>


答:
Classes are objects in Objective-C, a feature which I think comes from Obj-C's Smalltalk roots. You generally don't create new "class objects" yourself in code; the compiler does that for you. That makes sense when you think about it: a class object is an object that happens to represent a class; if you instantiate it by sending it an +alloc message, you'd end up with a new object of the class represented by the class object, not another class object. That last bit really does make sense, I promise, but it's hard even for me to follow it, so here's some code to illustrate:

```<code>Class foo = [NSString class];        // foo points to the the object
                                     //    representing the NSString class
NSString *bar = [[foo alloc] init];  // bar points to an object of type NSString
int length = [bar length];           // length will be 0 because bar is empty
</code>```

Note that both foo and bar are valid objects to which we can send messages.

It is actually possible to add class objects at runtime, but you do it by making calls to the Objective-C runtime directly.

Title: Class as first-class object

Body:
Classes are objects in Objective-C, a feature which I think comes from Obj-C's Smalltalk roots. You generally don't create new "class objects" yourself in code; the compiler does that for you. That makes sense when you think about it: a class object is an object that happens to represent a class; if you instantiate it by sending it an +alloc message, you'd end up with a new object of the class represented by the class object, not another class object. That last bit really does make sense, I promise, but it's hard even for me to follow it, so here's some code to illustrate:

Class foo = [NSString class];        // foo points to the the object
                                     //    representing the NSString class
NSString *bar = [[foo alloc] init];  // bar points to an object of type NSString
int length = [bar length];           // length will be 0 because bar is empty

Note that both foo and bar are valid objects to which we can send messages.

It is actually possible to add class objects at runtime, but you do it by making calls to the Objective-C runtime directly.


答: I'm a big fan of being your own usability lab. What I mean by this is we typically make developers walk in end-user's shoes and use the things they build if at all possible -- as in make them take orders using the screens they built. Funny how tab order gets fixed when the guy who can change it has to fight it. And funny how he doesn't make the same mistake again.</p>


问:
What is an effective way to convert a shared memory-mapped system to another data access model?
I have a code base that is designed around shared memory.  Each process that needs to access the memory maps it into its own address space.  The data structures in the shared memory are directly accessed, that is, there is no API.  For example:

Assume the following:

```<code>typedef struct {
  int x;
  int y;
  struct {
    int a;
    int b;
  } z;
} myStruct;

myStruct s;
</code>```

Then a process might access this structure as:

```<code>myStruct *s = mapGlobalMem();
</code>```

And use it as:

```<code>int tmpX = s->x;
</code>```

The majority of the information in the global structure is configuration information that is set once and read many times.  I would like to store this information in a database and develop an API to access the database.  The problem is, these references are sprinkled throughout the code.  I need a way to parse the code and identify global structure references that will need to be refactored.

I've looked into using ANTLR to create a parser that will identify references to a small set of structures and enter them into a custom symbol table.  I could then use this symbol table to identify which source files need to be refactored.  It looks like a promising approach.

What other approaches are there?  Of course, I'm looking for a programmatic approach.  There are far too many source files to examine each one visually.

This is all ordinary ANSI C.  Nothing else.

答: Since your code is in C - rename the typedef, build the code, watch the compiler complain. Now you know where the struct is referenced. Since you'll be converting the code to use a completely different way of accessing this data, you're gonna need to eyeball every single case anyway. So put on a fresh pot of coffee and get hacking... :-)</p>


答:
First you have to identify the performance blocks before you can estimate the time to fix. If the block is caused by needing a newer server with more memory and processing power that doesn't take long to fix. If they have a good equipment, but the problem is the basic design of the database, that could take a year or more to fix. Or maybe they need database partitioning to be able to access things faster.

In a mature product, you should have dbas finding the long-running queries and fixing them on a regular basis. Performance tuning should be continual. Further your devs probaly have a good idea of where the technical debt lies and that is a good place to start looking for performance problems.

I would estimate the time to identify the performance blocks and tell them that you will prepare an estimate to solve the problems once the problems are known. I would also start right now to look at your long running queries and fix them. Each incremental improvement will help keep the client on your side. You might also have them give you a prioritized list of the areas where they have the slowest performance to give you an idea of what to start with. You might even consider proposing an interative process when you spend a week or two identifying problems in one specific part of the application and then another week or two fixing those problems then move on to the next section, etc. That way, you can start improving before identifying all the items causing the poor performance.

There are known performance issues with certain types of SQL structures (this varies by database backend), but for SQL server, if you are frequently using such things as correlated subqueries, cursors, functions in joins and where clauses, scalar UDFs, views that call views that call views, then it is likely your database needs a major overhaul. If all your foreign keys are not indexed that is an easy, cheap (in terms of time) win. If your devs don't know what sargable means, then likely you have badly written queries and almost every query will need to be examined for poor practices.

Frankly, it is nice your client is willing to pony up some of the money for this, but you did the poor design, your company should pay for the majority of the fixes.

Finally, make sure you learn from this. If the problem is bad design of databases or poorly performing queries, train your devs to write performant queries and/or hire a data specialist. Anyone who designs an Enterprise system without data specialists in the design phase is likely to have a system that fails when the load gets high. Performance should be considered in the design phase of database. This is NOT premature optimization, this is avoiding known performance issues. It is far harder to fix a mature Enterprise system in production that to fix a bad design.

I'm not saying the database is the only source of your performance issues, just that it is one of the most likely places. You do need to profile to see what is happening. I can remember one time when we were having a performance issue and it turned out the application was calling the same proc thousands of times for each page when it only needed to be called once. But as a data specialist, my experience has been that there are many poorly designed and poorly performing databases out there.

Title: How to best approach planning and budgeting of software performance optimization efforts?

Body:
There is a software system that has been with the client for some time now. If is feature-rich, mature, complex enterprise application that client uses in production. Due to the rapid expansion of the client's business the software system in subject cannot handle the volumes efficiently and overall performance does not satisfy the customer anymore.

So the customer asks the vendor of the software system for improvements in performance and efficiency of the system. The customer also expects the vendor to prepare a plan and ballpark budget so the cost of such optimizations is roughly known upfront.

What do you think is the best approach for such plan and high level budget that one could prepare for the customer? I'm asking the question because I've seen some of this kind of plans before and they are usually very vague and imprecise mainly due to the fact that such exercise is kind of chicken and egg dilemma. In order to know what exactly should be optimized and tuned in complex system the benchmarking, profiling and research is required. And that investigation is also the part of the planned project, so it is impossible to know upfront what efforts can such benchmarking results require to implement improvements.


答:
UI design is one of those things that seems to alude many of us software developers (especially those of us that are the data-driven type).  But, in my experience, UI design gets better...a lot better...with not just time, but a lot of practice.

A while back when I started to get into the visual aspect of software development, my WinForms applications looked hurrendous.  Something straight out of the '90s.  I got better at it, and before I knew it I picked up a few desktop/thick client design skills.

Then I made the shift into web development.  The first few web applications I wrote were just an eyesore.  Then all of a sudden, I got really good with HTML/CSS/JavaScript and a hint of graphic design and everything started to look better.

UI design is one of those things that just isn't boolean.  There is such a gray area that nobody can really tell you how to do it and what is the way to go about it.  You need to do it.  You need to make some terrible looking applications.  Then, and only then, will you know how to progress and what to change/modify/add/delete from your UI toolbox.


答:
Certainly.

A specific example: In a prototype-based approach, a class is effectively the same thing as an instance of a class, and it can just be cloned with new fields added or overwritten to make new instances.

A simple prototype-based example in Clojure:

```<code>(def human
  {:species-name "Human"
   :leg-count 2})

(def john-smith
  (merge human
    {:first-name "John"
     :last-name "Smith"
     :profession "Brewer"}))

(def john-silver
  (merge human
    {:first-name "John"
     :last-name "Silver"
     :leg-count 1
     :profession "Pirate"}))

(:leg-count human) ; class value
=> 2

(:leg-count john-smith) ; inherited value
=> 2

(:leg-count john-silver) ; overridden value
=> 1
</code>```

Title: Class as first-class object

Body:
Certainly.

A specific example: In a prototype-based approach, a class is effectively the same thing as an instance of a class, and it can just be cloned with new fields added or overwritten to make new instances.

A simple prototype-based example in Clojure:

(def human
  {:species-name "Human"
   :leg-count 2})

(def john-smith
  (merge human
    {:first-name "John"
     :last-name "Smith"
     :profession "Brewer"}))

(def john-silver
  (merge human
    {:first-name "John"
     :last-name "Silver"
     :leg-count 1
     :profession "Pirate"}))

(:leg-count human) ; class value
=> 2

(:leg-count john-smith) ; inherited value
=> 2

(:leg-count john-silver) ; overridden value
=> 1


答:
"SDK" is collective in a larger sense than "API".

You typically find only one SDK to cover an entire platform. There's one MacOS X SDK and one iOS SDK, for example, and those each contain the API's for many different areas of functionality.

"API" was originally used as a collective term as well, and it's still often used that way (MAPI, WSAPI, etc.), but it's usually limited to some particular technology. The scope implied by the "API" seems to have diminished over the years; people used to talk about the "Mac Toolbox API" or the "Windows API," both of which obviously contained a lot of functionality. These days, it's not uncommon to hear "API" used to mean a single system function; a new version of an operating system might be said to contain hundreds of new API's, and what's meant is hundreds of new system calls.

Neither term is very precise without some context.


问:
XML vs SQL for small projects?
I'm working on a small project which will only have one user at a time since it's a local application (developed in WPF and C#). To store data I was thinking of using an XML file but I'm wondering if this would be the best approach.

What the data is for:

Shedules

Library of files in folders (with Artist name, Title, Location on HDD)

Possibly statistics based on the shedule data

...

Information regarding the library would be fine in XML I imagine but about all the rest I'm not so sure. Also LINQ to SQL seems to be alot more profitable in terms of development speed than LINQ to XML. Is this correct or am I wrong? I was unsure if I should post this on SO or here but it seemed more appropriate here!

Thank you in advance

答: It sounds as if your data could potentially grow infinitely (unless I misunderstood your application).  In which case, I would say it's best to leave persistant storage up to a database engine for efficiency and performance.</p>

Title: XML vs SQL for small projects?


答:
If you will be doing lots of IO, SQL is your better choice. SQL is designed to work well to get/store data which is why we use it for storing data on something like a website as opposed to XML.

XML is good for human readable data that can be shared and interpreted between applications, as was its intention. XML parsing involves LOTS of string manipulation which can be come ever costly as the size of the data set increases.

Title: XML vs SQL for small projects?

Body:
I'm working on a small project which will only have one user at a time since it's a local application (developed in WPF and C#). To store data I was thinking of using an XML file but I'm wondering if this would be the best approach.

What the data is for:

Shedules

Library of files in folders (with Artist name, Title, Location on HDD)

Possibly statistics based on the shedule data

...

Information regarding the library would be fine in XML I imagine but about all the rest I'm not so sure. Also LINQ to SQL seems to be alot more profitable in terms of development speed than LINQ to XML. Is this correct or am I wrong? I was unsure if I should post this on SO or here but it seemed more appropriate here!

Thank you in advance


答:
Eli Bendersky recently posted Python Metaclasses, which discusses that very question. In it, he starts with

In Python, everything is an object. And that includes classes. In
  fact, classes in Python are first-class objects – they can be created
  at runtime, passed as parameters and returned from functions, and
  assigned to variables.

He goes on to show some working Python examples of creating a new Metaclass, which can be used to create new classes. Highly worth reading.

Title: Class as first-class object


答: Yes, I sign my code. I take pride in producing quality work. </p>

Title: Do you sign each of your source files with your name?

Body:
Possible Duplicate:

  How do you keep track of the authors of code?

One of my colleagues is in the habit of putting his name and email address in the head of each source file he works on, as author metadata.  I am not; I prefer to rely on source control to tell me who I should be speaking to about a given set of functionality.

Should I also be signing files I work on for any other reasons?  Do you?  If so, why?

To be clear, this is in addition to whatever metadata for copyright and licensing information is included, and applies to both open sourced and proprietary code.


答:
Go with the database approach. It is the proven technology to handle data.

On the performance issue, you may be able to speed your access by having indexes, where in XML, no such means exist.

On a database, you can calculate statistical data using aggregate functions, in XML you got to code that.

Using a database, you can change the database structure with relative ease (add column, table, etc.) and there are tools to help you move the data between databases, where as in XML you got to do that yourself.

In a database, you can enforce integrity rules and you can let the users write their own selects if needed, not quite easy in XML.

In database, you can sort data very easily, also you can add security.
Using a database, you can forget about size and concurrency, so in the future, your application can grow without code changes.

For the above, use a database!
EK

Title: XML vs SQL for small projects?


问:
Why do websites have to ask language and country when the browser can tell them that?
So, why do websites have to ask (spoken) language and country when the browser can tell them that?

Edit:
Specifically, I mean why not use the accept-language section in the http header, set by the language settings in the browser, not based on the IP address.  This question focuses the websites that put up a wall, forcing the user to select a language before using the website, that should instead make available an easily accessible setting.

Edit:
This is a user experience question, focused on the point that the user should have set the language settings in the browser when they first set up their computer (if the user is smart enough, or can ask someone smart enough).

答:
Personally, I like that websites explicitly ask me what language I want their content to be displayed in. Even though I am a native Spanish speaker, I find Spanish grammar and syntax unsuitable for technical communication because of its excessive rigidity. It also does not help that the Spanish Royal Academy still believes it has the sacred duty to contain the menace posed by terms and idioms of foreign origin (Anglicisms in particular). Basically, I can choose between using "illegal" Spanish and not saying anything useful at all! In practice, I have switched to English for most of my online interactions, including content consumption. So, at least in my case, "I am a native speaker of language X" does not necessarily mean "I want to consume content in language X".

With respect to asking users what their country is, this has never affected me, as I am not a frequent traveler, and, when I do travel, I only rarely use the Internet. But some people are simultaneously much more frequent travelers than I am, and much heavier Internet users when abroad. I cannot tell what their experiences are, but I guess most of them want to be able to visit the versions of websites associated to their countries or regions of origin/residence.


问:
How can a borderline beginner jump into open source?
With all the options and project available, especially the size of most of them, Open Source can be pretty daunting for a newbie to it all. My question is, how can I start helping and learning from open sourced software? Where do I start? Which files do I read first? Any advice to help a programmer above beginner level start contributing? </p>

答:
Find an (open source) application which you enjoy running. In this way, you're already a "tester".  It could be anything (an operating system, an application like a media player, or a library, or a network tool, or an application skin, or a desktop theme).  Find out what languages such software is written in; pick the ones you know or learn a new one.  Get the source.  Read it and the developer docs.  Build it, then run your own builds.  Make some tweaks through your own usage and what you think might be neat to add.  Learn diff.  Make a patch diff and email it to the developers; do this a couple times then ask if you have commit permissions.

Then put it on your resume and circulate this online.


答:
The lead engineer should typically interact with the customers only during highly technical meetings (or the portions of the meetings which are highly technical); or, for technical roadmap discussions.  By lead engineer, that means the best engineer on the team, not the lead engineer for particular projects.

The PM is not always responsible for knowing all the latest acronyms and architectural decisions.  The PM (and your manager) may lag behind by one or more generations of technology.  This is where the lead engineer needs to bridge the gap.

Title: How much should Developers interact with Clients?

Body:
A philosophical discussion has come up in my department that I'd like p.se's opinion on. We're a 6 person development department inside a 60 person IT shop. All other departments are growing FAST, and ours has been the same size (and not fully booked at that size) for a few years.

My manager, and old-school mainframe guy, contends that developers should never ever have ANY client contact. That all interaction with the client should be mitigated by a Project Management layer. He asserts that this allows a coder the focus they need in order to CODE, and protects the business's relationship with the client from the autism-spectrum tendencies of Joe Average Code Monkey. (My words, not his.)

His boss, the owner of the company, told him this morning that every single person in the company needs to think of themselves as an extension of the sales department, and needs to be listening all the time for upsell opportunities. To this end, he thinks clients ought to have more or less full access to developers directly, in part so that devs have the opportunity to hear sales opportunities.

I'm somewhere in the middle, myself. I think it's nice to shield devs from clients to some extent, but in practice that will never be total. And yes, every single job in the company includes sales, but that doesn't necessarily mean that everyone has the same opportunity for it.

EDIT: We're not an agile shop. Some of us (cough) would like to head that direction, but for now assume this is a traditional fixed-bid-contract shop.

EDIT2: The autism joke wasn't funny. Got it. Entirely possible that autism jokes never are. That said: there are developers who have a capacity to represent themselves and their employers well and developers who don't (currently) have that capacity. My manager has a real concern about how the company would be represented if all developers were structurally empowered to be company representatives.

It's also getting increasingly clear from reading your responses that the real push-and-pull here is between waterfall and agile.


答:
Real world example:  The web interface to the company e-mail system used the browser info to decide what language to send, no way to override it.  I was using an internet cafe in a country where I don't speak the language.

I ended up having to use a personal account to tell some coworkers things because while I could figure out how to read a message despite the language barrier I couldn't figure out how to reply.

Had I been just an average user I doubt I could have even figured out how to get into the account at all.

Title: Why do websites have to ask language and country when the browser can tell them that?

Body:
So, why do websites have to ask (spoken) language and country when the browser can tell them that?

Edit:
Specifically, I mean why not use the accept-language section in the http header, set by the language settings in the browser, not based on the IP address.  This question focuses the websites that put up a wall, forcing the user to select a language before using the website, that should instead make available an easily accessible setting.

Edit:
This is a user experience question, focused on the point that the user should have set the language settings in the browser when they first set up their computer (if the user is smart enough, or can ask someone smart enough).


问:
Incanter for real world statistical projects
I'm interested in statistical computing. R is a leader platform obviously but what about Incanter?

Incanter is at the top of my list since I'm a Clojure and JVM guy.

Do you have any real world projects with Incanter? Is it a proven platform or I have to fall back to R?

What are the advantages of R over Incanter? What I'm going to miss?

答:
Major advantages of R are (well, apart that it's the industry standard in a way, which is something that should never be underestimated) its large number of libraries and its large and rather active community which again contributes to the number of libraries.
Also, it has good plotting capabilities.

Incanter (note; I've not used neither R nor Incanter for prolonged periods of time) is in a way a port of R in Clojure. Some prefer coding in Clojure so to them this will be the obvious advantage, but the last time I saw it it seemed rather immature. Its community is also much smaller, and although it may grow, it's still marginal nowadays.

If you want to go mainstream along the path of least resistance, I'd stick with R. I've never seen any even mid size projects done with Incanter (although, I should repeat, I was not in the business where statistics were primary occupation).


答:
There are roles in IT that should be utilized and respected.
Each role has 0, 1 or more contact reasons with the customer.

The contact reason must be defined by the PM.

The correct roles such as Systems Analyst, Requirements Analyst and Business Analyst should be assigned to capable team members under the PM supervision.

Customer interaction is not a trivial skill. Both the Skill and the project policy should be laid out by the PM.

Pluses you want to encourage are:

Positive relationship between IT and business

Single or very limited source of requirements

Accurate requirements gathering

Things you don't want to happen:

Making promises to the customer outside the project plan / policy

Denying the customer requirements that can be delivered

Loosing track of whom promised what

Documenting requirements inadequately

Making IT look like they don't talk to one another

Making the customer loose confidence in IT

Too many emails going back and forth with no integration

So, to answer your question, "designated" developers may interact with the client in the roles defined by the PM and only in the instances specified by the PM (say prototyping and joint testing).

Hope I made my point clear...


问:
How do I deal with a slow and undedicated colleague in the team?
I have been working on a new project. The project works like this: The end user can access a webapp using a link and he can add multiple systems on his network and manage that particular systems details. My part involves the front end and the webserver, which is done in python. My python actually communicates with another project which is entirely done in c & c++. The c/c++ project is the main app which does all the functionality. My python sends the user request to it and displays the response from it to the user.

I am very familiar with my work and I will finish it soon. Since that's not much work in it. And I am a person who loves to work. I spends most of the time in office and only go home when I feel sleepy.

The c/c++ app is managed by another colleague who has 5+ year experience and can do things much faster than me, but he never does it. May be he doesn't like to do it. His app crashes often when my python communicate with it or returns wrong values. It's full of bugs. Since my app depends on it, I am having a hard time building it. Instead of fixing the bugs, he asks me to slow down my work. He asks me to tell manager that my work needs a lot of time. He is asking me to fool the manager and even forcing me to work slowly like him.

During project meeting, when manager asks him about the bugs he says that he fixed everything and it works fine. Since he is my colleague, I couldn't tell anything to the manager. I obviously need to have a good relationship with my colleagues more than my manager, since most of the time we will be with our colleagues, not with the manager.

I am not able to tell the manager anything regarding this, since if manager asks him why, then he may think I complained about him to the manager. And he keeps on lying in the meeting. And since he fixes the bug slowly, it even slows down my work. Now I thought of working on the front-end part of my app  and finishing it off so that in the mean time he can make his project stable. Now he is asking me to tell the manager that my front end part require a lot of work and I may need more and more time, simply so that he can drag the project down. And the sad thing is our actual manager has gone to the US, so we have a temporary manager and this guy doesn't know about the project much, so the c,c++ just fools him.

Can anyone suggest me how I deal with this?
I wanted to finish off the project soon. How can I make him work even by maintaining a good relationship with him?

Responses to comments:

If he's really deliberately misleading the company, you should report him to management.

I am new to this company and the other guy has been there for many years. And I have just started knowing my colleagues. If I directly go and complaint him, I don't think so I can make good relationship with my other colleagues. Even he has the power to mislead them. I am not telling he is a bad guy, he can do the work, but he is not doing it.

Doesn't your company have any kind of bug tracking system ?

Here actual bug tracking system isn't there. The company tries to finish off the project as soon as possible and gives it to the QA. And then fixes the bugs reported by QA.

This is why companies should give employees stock / options or some sort of ownership. That way you can literally tell the guy "You are costing me monetary growth... don't you want to make money also?".

The company has the stock options they have given me a 2500 share, mostly he too would have got some more.

Seniority does deserve some benefit of a doubt. You really need to speak to him first and try to understand the problem. He may be out of his depth, you may be able to help him, there could easily be variables you are unaware of. It may be hard now, but you could easily make the situation a lot worse by jumping the gun.

I even does it, first his app wasn't handling multiple requests at a time, he was using a queue to handle the requests I sent to him. I even suggested to him some of my ideas on it. He said he already had these ideas, and will be executing them. His explanations was: "Everything require certain time to do and this is a project which may need two years to complete and we are asked to finish it in two months". I used to have a hard time coding during first few weeks because of this bug. But now he fixed it. But he is using a single queue for a user requests and that is now slowing down the app, since it processes one request at a time.

What is QA doing this whole time? Why aren't they reporting/confirming the status of the project(s)?

The manager is the person who decides when to give to the QA. As of now it has not yet given to QA. He said we should give it by this month end.

答:
It's difficult and unreasonable to estimate the relative effort and complexity of another project if you aren't familiar with the code base. You say his code is error-prone, but it could be in great shape with all of the remaining issues at a very high level of abstraction... Problem is, that is the only code that your front end needs!

Or, maybe he's a bad employee and taking the company for a ride. I can't say, and you may not have all the information you need to know with confidence, either.

I'd suggest a midway tactic. Next time you meet, bring some details of a major bug in his code that is affecting you. When he says everything is fine, politely say there is one outstanding issue that's blocking your progress.

Politically, saying it like that let's you assert that he's not quite correct, while still giving him an opening to play dumb and not be put on the defensive.

Your manager should ask at the next meeting if it's fixed. If not, the pressure falls on him to fix one bug. If it is fix, say thanks, it's working great now, and you found a new blocker. If you want to be especially nice, say you ran into it shortly before the meeting.

You're not lying, per se, nor are you taking sides. You're playing politics by calling attention to problems and letting your colleague save face if things are really not proceeding all that well.

It's tempting to just talk to your manager, but don't forget which one of them you have to work with the most.


答:
API → documented interface (at a certain point in time, and for a certain audience. Documentation might be incomplete and/or unavailable to the general public and this might be on purpose, but this does not dimish the fact it was meant to be documented for third parties to use it.)

SDK → interface documentation ( + examples & tools )


问:
Is there an analogue to "FizzBuzz" for choosing clients?
This is for the freelancers.

In my past life as a full-time employee, I was involved in hiring and interviewed a good number of developers. I learned that it was much more valuable to see a developer work through a problem, however small, than to talk about experience, etc.

Now I'm working as a freelancer/consultant. One of the nicer things is the freedom to choose what I want to work on. But now, a few years in, I've learned (the hard way) that some clients are not worth the money. They can be fickle, unreasonable, demanding, and difficult to work with in a very demoralizing way.

So I've been wondering: is there a better way to "interview" clients? Obviously any method would have to be subtle, as the client probably isn't expecting to be tested. But is there an analogue to "FizzBuzz" that will tell me whether I should sign on, or back away slowly?

答:
How much of a commitment are you going to make to the project? If they think they can throw out some general needs, get you to write a detailed proposal (free of course), build the whole thing only to come back and find out what they really want and not pay for the extra time, they fail the test. And speaking testing, they don't want to do that either. They think you're a programmer, you should know how to do all this (which includes mind reading.).

If their last project wasn't a success, it may not have been the developer's fault.

You may not be an agile fan, but sometimes this methodology can prevent you from getting too deep into a project with a problem client. Phase I wasn't what either of you expected; part ways and be thankful you didn't try Mega Phase I-X.


答:
As others have mentioned, behaving professionally is the single most important thing for your long-term career.  And honestly, as long as you behave professionally, you'll be in pretty good shape, no matter how those around you behave.

In this situation, there are a couple of considerations you need to take into account.

First, you need to understand that you are responsible for your program working to the desired specifications, by the given deadline.  If your program interoperates with someone else's program, you are also responsible for making sure that that other program also works by the same deadline.  To put this differently:  If the other person misses their deadline, then you have also missed your deadline, even if your own part of the project was on time.  In management terms, this is called owning the inputs.

You have correctly noted that when your colleague declares in a meeting that his program's bugs are fixed, that you can't immediately declare him as incorrect to the manager (your manager would see that as "throwing your co-worker under the bus";  a very bad career move).  Others, on the other hand, have pointed out that it is unprofessional not to declare the true state of the project to the manager.  Both sides are completely correct.

So if it's bad to contradict your colleague in front of the manager, and it's also bad to not contradict him, then what do you do?

The answer is actually pretty simple:  You need to talk to your colleague well before the meeting with the manager, and let them know that at the upcoming meeting you're going to need to tell the manager about the troubles you've been having with their program, and that it's impacting your ability to deliver your side of the project on time, and whether there's anything you can do to help them address the troubles you've been having.  You need to have this conversation at least two full days before the meeting where you will tell the manager, and preferably a full week in advance.

In most cases, just telling your colleague that you're going to have to list their program as a risk at a particular meeting will get them motivated to address the problems you're having, and you never have to talk to the manager at all.  In others, where the problems are more schedule-driven, the colleague will often agree with you, and the two of you can go to the manager together.

I've never had a colleague who didn't either fix things up for me quickly or else agree with my concerns, when expressed this way.  But if it did happen, by giving your colleague advance warning you'd still be in a better position when talking to the manager.  Since you talked to your colleague and tried to work out a solution on your own, and warned them well in advance that you would need to raise the issue at this meeting, your colleague won't be surprised when they do, and the manager won't think that you're simply trying to shift the blame.

Do please remember that when you express your concerns, either to the colleague or to the manager, that your concerns are about your colleague's program which is returning bad data (or whatever else it's doing);  these are measurable things which can be verified and fixed.  Your concerns are not about your colleague being slow or undedicated;  these are not measurable things, which may or may not be true, and which are unlikely to be fixed by bringing them up in a meeting in front of the boss.

Title: How do I deal with a slow and undedicated colleague in the team?

Body:
I have been working on a new project. The project works like this: The end user can access a webapp using a link and he can add multiple systems on his network and manage that particular systems details. My part involves the front end and the webserver, which is done in python. My python actually communicates with another project which is entirely done in c & c++. The c/c++ project is the main app which does all the functionality. My python sends the user request to it and displays the response from it to the user.

I am very familiar with my work and I will finish it soon. Since that's not much work in it. And I am a person who loves to work. I spends most of the time in office and only go home when I feel sleepy.

The c/c++ app is managed by another colleague who has 5+ year experience and can do things much faster than me, but he never does it. May be he doesn't like to do it. His app crashes often when my python communicate with it or returns wrong values. It's full of bugs. Since my app depends on it, I am having a hard time building it. Instead of fixing the bugs, he asks me to slow down my work. He asks me to tell manager that my work needs a lot of time. He is asking me to fool the manager and even forcing me to work slowly like him.

During project meeting, when manager asks him about the bugs he says that he fixed everything and it works fine. Since he is my colleague, I couldn't tell anything to the manager. I obviously need to have a good relationship with my colleagues more than my manager, since most of the time we will be with our colleagues, not with the manager.

I am not able to tell the manager anything regarding this, since if manager asks him why, then he may think I complained about him to the manager. And he keeps on lying in the meeting. And since he fixes the bug slowly, it even slows down my work. Now I thought of working on the front-end part of my app  and finishing it off so that in the mean time he can make his project stable. Now he is asking me to tell the manager that my front end part require a lot of work and I may need more and more time, simply so that he can drag the project down. And the sad thing is our actual manager has gone to the US, so we have a temporary manager and this guy doesn't know about the project much, so the c,c++ just fools him.

Can anyone suggest me how I deal with this?
I wanted to finish off the project soon. How can I make him work even by maintaining a good relationship with him?

Responses to comments:

If he's really deliberately misleading the company, you should report him to management.

I am new to this company and the other guy has been there for many years. And I have just started knowing my colleagues. If I directly go and complaint him, I don't think so I can make good relationship with my other colleagues. Even he has the power to mislead them. I am not telling he is a bad guy, he can do the work, but he is not doing it.

Doesn't your company have any kind of bug tracking system ?

Here actual bug tracking system isn't there. The company tries to finish off the project as soon as possible and gives it to the QA. And then fixes the bugs reported by QA.

This is why companies should give employees stock / options or some sort of ownership. That way you can literally tell the guy "You are costing me monetary growth... don't you want to make money also?".

The company has the stock options they have given me a 2500 share, mostly he too would have got some more.

Seniority does deserve some benefit of a doubt. You really need to speak to him first and try to understand the problem. He may be out of his depth, you may be able to help him, there could easily be variables you are unaware of. It may be hard now, but you could easily make the situation a lot worse by jumping the gun.

I even does it, first his app wasn't handling multiple requests at a time, he was using a queue to handle the requests I sent to him. I even suggested to him some of my ideas on it. He said he already had these ideas, and will be executing them. His explanations was: "Everything require certain time to do and this is a project which may need two years to complete and we are asked to finish it in two months". I used to have a hard time coding during first few weeks because of this bug. But now he fixed it. But he is using a single queue for a user requests and that is now slowing down the app, since it processes one request at a time.

What is QA doing this whole time? Why aren't they reporting/confirming the status of the project(s)?

The manager is the person who decides when to give to the QA. As of now it has not yet given to QA. He said we should give it by this month end.


问:
Is Groovy going away?
I am sure this question has been asked many times. However, I like to ask it again with the intention of what is the future of these languages.

I was first introduced to Groovy and really liked it. I felt the syntax was simpler and it was much closer to Java and I was able to quickly learn Grails.

Then there was Scala, and the web frame work Lift. I am still learning Scala and I find the syntax very difficult at times.

However, I still wonder what is the future of Groovy. When the author of Groovy says he would have never created groovy if he knew about Scala, then it makes me wonder if there is a future at all. Of course Groovy has came a long way and Grails is used today by many large companies.

If one was to look at Grails vs Lift today, then Grails would be clear winner. More companies are using it.  But given everything I have said so far, I am interested to know if one should invest in Groovy? Is Groovy going away and Scala the better choice? If the CEO of BMW says he drives a Mercedes then one would wonder why shouldn't we all drive Mercedes too, right?

(I understand if this question is really broad and might be closed. I hope to make it an open Wiki for others though.)

答:
I don't think Groovy is going to disappear, it is a self sustained entity now. Grails framework is built around Groovy language, which it is a good reason to stay alive. Groovy got its killer application.

I'm not saying Grails is the only vital Groovy project, Gradle is also pretty good. GORM is really handy. Gant is a nice improvement over Ant.

Not mention that Groovy/Grails are now under the umbrella of SpringSource and they are committed to the both.

If the CEO of BMW says he drives a Mercedes then one would wonder why shouldn't we all drive Mercedes too, right?

Guess what James Gosling chose?

Title: Is Groovy going away?


问:
How do I cluster strings based on a relation between two strings?
If you don't know WEKA, you can try a theoretical answer. I don't need literal code/examples...

I have a huge data set of strings in which I want to cluster the strings to find the most related ones, these could as well be seen as duplicate. I already have a set of couples of string for which I know that they are duplicate to each other, so, now I want to do some data mining on those two sets.

The result I'm looking for is a system that would return me the possible most relevant couples of strings for which we don't know yet that they are duplicates, I believe that I need clustering for this, which type?

Note that I want to base myself on word occurrence comparison, not on interpretation or meaning.

Here is an example of two string of which we know they are duplicate (in our vision on them):

The weather is really cold and it is raining.

It is raining and the weather is really cold.

Now, the following strings also exist (most to least relevant, ignoring stop words):

Is the weather really that cold today?

Rainy days are awful.

I see the sunshine outside.

The software would return the following two strings as most relevant, which aren't known to be duplicate:

The weather is really cold and it is raining.

Is the weather really that cold today?

Then, I would mark that as duplicate or not duplicate and it would present me with another couple.

How do I go to implement this in the most efficient way that I can apply to a large data set?

答:
It seems overambitious.  This is nearly equivalent to understanding a sentence.

I can't even quite think of a way to parametrize a sentence; you probably don't want to just input two strings of characters in your classifier.  You would need a very complex model to describe your problem and therefore a huge data set.  Your model would need to learn which words are synonyms/antonyms... among many many things it would need to learn.

OwnerDisplayName: TomWij


问:
Ruby IDE code completion
I just started writing some ruby in my spare time and am currently using Netbeans 7 with the Ruby and Rails plugin v0.111. I'm primarily a Java programmer coming from IntelliJ and Eclipse.

One downside of my Ruby programming setup is that my Netbeans isn't very helpful when it comes to code completion. This seems due to the fact that Ruby is not strongly typed and since the IDE doesn't know the type it can't suggest methods. As a result I must spend a lot of time in my browser looking at documentation and switching back to my IDE to manually type in the method there.

Are there any changes I can make to my setup to get code completion for Ruby or is it pretty much impossible due to the nature of the language? How do other developers work with Ruby, other than memorizing all the methods in the Core Library?

答:
You said you are coming from IntelliJ IDE.  The good news is that you can install the Ruby/Rails plugin for IntelliJ.  The plugin is a little bit older than the one the is used to power RubyMine, but JetBrains folks are always updating it. Give it a try.

No one memorize all the methods in any given programming language.

Check these two resources:

Ruby-Doc.org
and RubyDoc.Info

Title: Ruby IDE code completion


问:
Introducing "20% time" at a workplace
20% time it's the culture of an employer allowing it's employees to spend 20% of their time working on projects that they find interesting - it may be inventing a new app, or improving an existing process, etc. Some people may know this as skunk work, however that term may not mean anything (or something entirely different) to you.

There are many documented cases of great products being born out of 20%/skunk work at a company. It seems like a win/win situation; the company potentially gain a great new product or application, and the developer has the opportunity to flex his/her creative muscles and innovate.

I tried on numerous occasions to introduce some form of 20%/Skunk working at my previous employer with no success.

How can I better justify it to management? What's the "right" way to approach this kind of work arrangement?

答:
Fourteen months after I wrote this answer, I came up with a much better one.

I haven't worked in a place where such works were officially recognized.  But from my conversations and attempts to learn about this practice, I found this - well, mostly what the "20% time" is not:

it's indeed a culture and not a policy

it can't be decreed by the senior management

it can't be instituted by a committee of developers

it is not 32 hours on this and 8 hours on that

Title: Introducing "20% time" at a workplace


问:
Anyone experienced in Gaming/Gambling industry?
Are there any legal hassles when you work in these Casino kinds of industry? I'm offered a job and I like it owing to clever algorithms and multi-threaded enviornment. I'd like some advice on legal issues before taking the offer.

*Ok I'm not going to sue any one of you for bad advice. I just wanted to know if people have any experience in such affairs. And I'm not looking for a lawyer's advise at all, I'm trying to know the gaming industry trends in general and what the programmers there have to say about their work when it comes to gamblings. And how would the lawyer know what goes inside the casino programming industry?
*

答:
I once did some freelance work for a bookie that wanted to integrate to BetCris to get the latest lines for his clients from his website.

Every industry needs software, even gambling industry.

Most of the time, its the gambling aspect that needs legal advice.  For example, in my state, bookies are illegal, but running his operations offshore is perfectly legal.  As a programmer, I just wrote the code.  In my case, my code was uploaded to a server somewhere offshore where the it was legal, so there wasn't any issues.

I think the biggest takeways are:

Is your client operating legally in regards to gambling and following state and federal laws.  If so, I think you have nothing to worry about.  If not, then you are particapating and aiding in an illegal operation.  So just make sure your "client" is following the rules.

The other thing is the morality of the whole thing.  Some people may frown upon working in industries such as gambling, pornagraphy, etc.  I never lost sleep over it even though I was enabling his gambling operations, but to me it was just another paying client.

*This isn't legal advice.  I am not a lawyer.  These are my experiences working in the gambling industry.  Sueing me would be pointless and not profitable.  :)


答:
This is obviously non-trivial, but there are algorithms that at least attempt to do things like this. I hasten to add, however, that they're statistical, so trying to use only two sentences as a basis is going to be extremely iffy at best.

The usual approach runs something like this:

filter out stop words

use a thesaurus to substitute one canonical word for each word

count occurrences of words in each document/sentence

compute the cosine distance between the base document(s) and each candidate similar document

pick the N closest to the base documents

Note that there's room for a lot of variation here though. For example, the thesaurus can get considerably better results if it's context sensitive, and to maintain the context you often want to retain the stop words, at least until that step is complete. For example, consider your base documents about the weather being compared to: "I have a cold", and "It is cold". If you follow the steps above, these will both be just "cold" by step 2, and both seem equally close to the base documents.

With a context-sensitive thesaurus step (an ontology, really), you'd use the extra words to disambiguate the two uses of "cold", so when you compute distances, one would refer to the disease named "the cold", and the other to "cold weather". The base documents would both refer to cold weather, so your result would show "It is cold" as similar, but "I have a cold" as different.

If you're trying to keep things simpler, however, you might skip the thesaurus completely, and just stem the words instead. This turns "rainy" and "raining" both into "rain", so when you do comparisons they'll all show up as synonymous.

As far as details go, there are quite a few lists of stop-words easily found. At least in my testing, the choice isn't particularly critical.

For a thesaurus, I've used the Moby Thesaurus, with some (substantial) processing to basically invert it -- i.e., rather than finding multiple synonyms for one word, find one canonical word for a given input.

There aren't as many papers on context-sensitive synonym/definition searching -- but some are still quite good. A lot of work on the "semantic web" and related ontologies is along this line as well (though little of it is likely to be of much help in your case).

For stemming, the Porter Stemmer is well known. There's a newer, slightly modified version (Porter2) that should be covered somewhere on the same page(s). Another well-known  algorithm is the Lancaster Stemmer. There's also the Lovins stemmer, but I wouldn't really recommend it1 -- though it's still widely known because it was the first (well known) stemming algorithm published. Note that most (all?) of these strip only suffixes, not prefixes.

Quite a few papers discuss cosine distance. It's well enough known that even the Wikipedia entry for it is pretty decent.

Quite a few people have already assembled these pieces together into coherent (at least they generally try to be coherent) tool-kits, complete programs, etc. A few reasonably well known examples include WordNet, NLTK, Apache OpenNLP, and Freeling.

1In particular, Lovins only ever removes one suffix from a word. If you had, for example, "Loverly" and "lovingly", Porter would reduce both to "lov" and they'd show up as synonyms, but Lovins would reduce them to "lover" and "loving", respectively, and they'd show up as different. It is possible to repeat the Lovins algorithm until it removes no more suffixes, but the result isn't very good -- Porter has quite a bit of context sensitivity so (for example) it only removes one suffix if it did not remove another; multiple applications of Lovins wouldn't take this into account.

Title: How do I cluster strings based on a relation between two strings?

Body:
If you don't know WEKA, you can try a theoretical answer. I don't need literal code/examples...

I have a huge data set of strings in which I want to cluster the strings to find the most related ones, these could as well be seen as duplicate. I already have a set of couples of string for which I know that they are duplicate to each other, so, now I want to do some data mining on those two sets.

The result I'm looking for is a system that would return me the possible most relevant couples of strings for which we don't know yet that they are duplicates, I believe that I need clustering for this, which type?

Note that I want to base myself on word occurrence comparison, not on interpretation or meaning.

Here is an example of two string of which we know they are duplicate (in our vision on them):

The weather is really cold and it is raining.

It is raining and the weather is really cold.

Now, the following strings also exist (most to least relevant, ignoring stop words):

Is the weather really that cold today?

Rainy days are awful.

I see the sunshine outside.

The software would return the following two strings as most relevant, which aren't known to be duplicate:

The weather is really cold and it is raining.

Is the weather really that cold today?

Then, I would mark that as duplicate or not duplicate and it would present me with another couple.

How do I go to implement this in the most efficient way that I can apply to a large data set?


答:
The paper Pairwise data clustering by deterministic annealing seems to cover exactly what you need: you have a pairwise similarity measure and you want to form a certain number of groups based on this measure. (I managed to find some free full-text pre-prints of this article a while back, so you might not need to pay to access that one; unfortunately I don't have time to hunt for them again now).

I've used this technique in signal processing (see p15), but not text-based data mining, so I'm not sure how much I'll be able to help with the specifics.


答:
http://www.differencebetween.com/difference-between-api-and-vs-sdk/

What is API?

API is an interface that allows software programs to interact with each other. It defines a set of rules that should be followed by the programs to communicate with each other. APIs generally specify how the routines, data structures, etc. should be defined in order for two applications to communicate. APIs differ in the functionality provided by them. There are general APIs that provide library functionalities of a programming language such as the Java API. There are also APIs that provides specific functionalities such as the Google Maps API. There are also language dependent APIs, which could only be used by a specific programming language. Furthermore, there are language independent APIs that could be used with several programming languages. APIs needs to be implemented very carefully by exposing only the required functionality or data to the outside, while keeping the other parts of the application inaccessible. Usage of APIs has become very popular in the internet. It has become very common to allow some of the functionality and data through an API to the outside on the Web. This functionality can be combined to offer an improved functionality to the users.

What is SDK?

SDK is a set of tools that can be used to develop software applications targeting a specific platform. SDKs include tools, libraries, documentation and sample code that would help a programmer to develop an application. Most of the SDKs could be downloaded from the internet and many of the SDKs are provided free to encourage the programmers to use the SDK‘s programming language. Some widely used SDKs are Java SDK (JDK) that includes all the libraries, debugging utilities, etc., which would make writing programs much easier in Java. SDKs make the life of a software developer easy, since there is no need to look for components/ tools that are compatible with each other and all of them are integrated in to a single package that is easy to install.

What is the difference between API and SDK?

API is an interface that allows software programs to interact with each other, whereas a SDK is a set of tools that can be used to develop software applications targeting a specific platform. The simplest version of a SDK could be an API that contains some files required to interact with a specific programming language. So an API can be seen as a simple SDK without all the debugging support, etc.


问:
Should I use try catch in my test methods?
I am doing unit testing.

I am trying to test one function.

I call it from my test component. But If remote function cannot handle the exception then my tester component will also get exception, I guess.

So should I worry about getting exception in my tester component?

Thanks.

EDIT:

PS:

Throwing an error is good, but only for other functions, not to end users until its a last option!

OMG I wrote a programming quote!!

答:
Short answer: NO.

Don't catch exceptions in unit tests.  You are unit testing to find errors and situations where exceptions are raised.

The unit test framework should handle exceptions in a sane manner.  Most (if not all) xUnit frameworks have a construct to expect certain exceptions which you use when you want to induce a particular exception condition in the system under test and have a test pass if the expected exception is raised but fail if it does not.


问:
What is the biggest support a boss can give to his/her developers?
Buying the best hardware, paying the most precious bonus or reward, treating them politely, provide the opportunity for improvement, etc.?

We want to improve the productivity of our development team. We want to see what can be regarded the biggest support (or generally a good support), so we can start from there.

答:
That really depends on the developer as not everyone will be happy when he just gets more money if he has to build low quality software for example.

In my opinion most developers like to have a certain amount of freedom to make their own working experience pleasant. Some developers want to build really good software while others have a stronger focus at their working hours (not working longer than they should).

I would say treating them politely and being thankful for the software they produce (as long as it's correct of course) is the least. Everyone likes their effort to be valued. On top of that I think it becomes hard to make a single support measure which everyone likes.


答:
There are extrinsic motivations like you mentioned bonus, paycheck which helps to some extent in getting things done but a major chunk is depended on intrinsic motivations and which is where you need to focus bit more

Give a proper picture of the tasks at hand and allow them to
individually execute them (instead of micro managing)

a healthy work environment (apart for great machines) whereby they
can voice their opinion and have people who can hear them out

The technology you are using are of their interest and they love to
work on them

appreciate their work

give space for their personal life

This could also be an interesting read -Joel Spolsky

Title: What is the biggest support a boss can give to his/her developers?

Body:
Buying the best hardware, paying the most precious bonus or reward, treating them politely, provide the opportunity for improvement, etc.?

We want to improve the productivity of our development team. We want to see what can be regarded the biggest support (or generally a good support), so we can start from there.


答:
It's a complex approach.

Hardware and good place to work are extremely important. Monitors increase productivity greatly and faster machine makes the world seem a better place.

For me the biggest thing that can motivate me on a job is empowerment and responsibility - try not to have deciders and code monkeys.


答:
Two basic things really:

The resources needed, so I will be able to do the task at hand in time

The confidence needed, so I can be trusted that I can do the task at hand in time

Everything else follows from those two things.


答:
I release a lot of my own work as open source and free, that way others can see your work and judge it, thus making it easier to join an existing open source project or have others contribute to your open source project.

Try OpenHatch. There you can find projects to contribute to. I haven't used it yet, but I plan to when I feel comfortable.

This fall I'll be working with other students on an open source project via UCOSP. There's other groups like that, for instance, Google Summer of Code. If you're still in school, definitely try to get into these programs.

You can also subscribe to a mailing list of your preferred project or join their IRC room and get to know some of the people and go from there.

Try some online code repositories. Some are more social than others, but they're all good. You can submit patches, or even submit bugs (which is still contributing). Some of the popular ones are GitHub, Google Open Source Code (specifically Google Project Hosting), and SourceForge.

You can read this free book on how to produce open source software. I use it as a reference sometimes.

Title: How can a borderline beginner jump into open source?

Body: With all the options and project available, especially the size of most of them, Open Source can be pretty daunting for a newbie to it all. My question is, how can I start helping and learning from open sourced software? Where do I start? Which files do I read first? Any advice to help a programmer above beginner level start contributing? </p>