答:
Terminology is not that important unless it is used incorrectly and creates confusion. In this case, should another program which is an wrapper program be introduced to the users, they will become confused because they will see two programs described the same way, but with different functionality.

An example - A "classic" of this I've seen over and over again in development teams is where someone starts writing stub or fake classes for testing purposes. But calls them "mocks", even using the word "mock" in the class names. I.e. MockOfExternalThing. There is nothing wrong with this except that when someone else comes along and needs to use an actual mocking framework such as EasyMock or Mockito. Now the programmers cannot tell what they are dealing with. Worse yet, developers who have not used any mocking frameworks before get completely confused about the term mock and what it means.

So in your case I'd not worry too much about the other guy using the term wrapper, if and only if you think it's unlikely that the users will be presented with something else that works differently, yet uses the same term.

Title: What is a "wrapper" program?

Body:
Where I work, employees use a third-party desktop program for their clients. This program saves data to a flat file. My colleague wants to write a Java program that uploads that flat file to a remote server, opens the desktop program when the flat file is downloaded from a Web site, and checks if the desktop program is running or not by looking at the Windows processes.

He keeps calling this helper/utility program a "wrapper." But it doesn't wrap anything! I tried to clear it up with him, but he said, "Well, I call it a wrapper." He now has everyone in the company calling it a "wrapper." What would you call it? I say that it's a helper program or utility program.


问:
I have an MIS degree. How do I sell myself as a programmer?
So, I graduated with a BSBA in Management Information Systems with honors almost 2 years ago which is more of a business degree.  As of right now, I do have a job title of "Programmer", but it's more of a report writing position in an arbitrary, proprietary language called PowerOn with the occasional interesting project using more mainstream technologies like .Net and Java.  I am also somewhat isoloated being the only programmer in the workplace, which I beleive is a detriment to my career path.  The only people I have to bounce ideas against are those on the various SE sites.

I don't regret going MIS, but over the past couple of years I have discovered my passion for coding, even though I have been doing some form of coding profesionally and as an enthusiast for years.  I do want to persue my Masters in CS (at a later time), but I am not sure if I necessarily need a CS degree to get in with a team of programmers.  In addition, I do have a number classes I have taken for different laguanges on the way (C++, Java, SQL, and VB.Net)  I beleive my strength is in problem solving where code is just a tool to tackling to problem if needed.

My question:  How do I best sell myself as a programmer?  Should I continue pounding out reports and wait till I have my masters in CS?  Or am I viable to be a programmer as I stand?

答:
How do I best sell myself as a programmer? Should I continue pounding out reports and wait till I have my masters in CS?

Start with your resume and reflect projects that you have accomplished. Creating your own little projects, creating new things everyday would help you gain confidence and hand-on practice. Your report building skills might also be useful, so include them as well.

You may present your MIS degree as the way would wanted better understand how IT and software development should be organized and worked.

Even-though you are a lonely programmer, you may get up-to speed on what skills are in demand for programmers. I would recommend to attend local community events to help with that. You may find some of these groups in communitymegaphone.com.

Talk with your local buddy programmers, they are mostly good people who would not mind to help a college.

ContentLicense: CC BY-SA 3.0


答: If you want to sell yourself as a programmer, program something. Something you can share. Then you'll have something concrete to demonstrate your ability to do the job.

Title: I have an MIS degree. How do I sell myself as a programmer?

Body:
So, I graduated with a BSBA in Management Information Systems with honors almost 2 years ago which is more of a business degree.  As of right now, I do have a job title of "Programmer", but it's more of a report writing position in an arbitrary, proprietary language called PowerOn with the occasional interesting project using more mainstream technologies like .Net and Java.  I am also somewhat isoloated being the only programmer in the workplace, which I beleive is a detriment to my career path.  The only people I have to bounce ideas against are those on the various SE sites.

I don't regret going MIS, but over the past couple of years I have discovered my passion for coding, even though I have been doing some form of coding profesionally and as an enthusiast for years.  I do want to persue my Masters in CS (at a later time), but I am not sure if I necessarily need a CS degree to get in with a team of programmers.  In addition, I do have a number classes I have taken for different laguanges on the way (C++, Java, SQL, and VB.Net)  I beleive my strength is in problem solving where code is just a tool to tackling to problem if needed.

My question:  How do I best sell myself as a programmer?  Should I continue pounding out reports and wait till I have my masters in CS?  Or am I viable to be a programmer as I stand?


问:
Declaring interface in the same file as the base class, is it a good practice?
To be interchangable and testable, normally services with logic needs to have interface, e.g.

```<code>public class FooService: IFooService
{ ... }
</code>```

Design-wise, I agree with this, but one of the things that bothers me with this approach is that for one service you will need to declare two things (the class and the interface), and in our team, normally two files (one for the class and one for the interface). Another discomfort is the difficulty in navigation because using "Go to definition" in IDE (VS2010) will point to the interface (since other classes refer to the interface), not the actual class.

I was thinking that writing IFooService in the same file as FooService will reduce the above weirdness. After all, IFooService and FooService are very related. Is this a good practice? Is there a good reason that IFooService must be located in its own file?

答:
According to SOLID, not only should you create the interface, and not only should it be in a different file, it should be in a different assembly.

Why? Because any change to a source file that compiles into an assembly requires recompilation of the assembly, and any change to an assembly requires recompilation of any dependent assembly. So, if your aim, based on SOLID, is to be able to replace an implementation A with an implementation B, while the class C dependent on interface I doesn't have to know the difference, you have to make sure the assembly with I in it doesn't change, thus protecting the usages.

"But it's just a recompile" I hear you protest. Well that may be, but in your smartphone app, which is easier on your users' data bandwidth; downloading one binary that changed, or downloading that binary and five others with code that depends on it? Not every program is written to be consumed by desktop computers on a LAN. Even in that case, where bandwidth and memory are cheap, smaller patch releases can have value because they're trivial to push out to the entire LAN through Active Directory or similar domain management layers; your users will wait only a few seconds for it to be applied the next time they log in instead of a few minutes for the whole thing to be reinstalled. Not to mention that, the fewer assemblies that must be recompiled when building a project, the faster it will build, making you more productive because you spend less time sitting around waiting for 50 assemblies to build for each change you make.

Now, the disclaimer: This is not always possible or feasible to do. The easiest way to do this is to create a centralized "interfaces" project. This has its own downsides; code becomes less reusable because the interface project AND the implementation project have to be referenced in other apps reusing the persistence layer or other key components of your app. You can overcome that problem by splitting the interfaces into more tightly coupled assemblies, but then you have more projects in your app which makes a full build very painful. The key is balance, and maintaining the loosely-coupled design; you can usually move files around as necessary, so when you see that a class will need many changes, or that new implementations of an interface will be needed regularly (perhaps to interface with newly-supported versions of other software, or file types, etc) you can sever it from its interface and protect usages from knowledge of those changes.


答:
There are many times where you want your interface to be not only in a separate file to the class, but even in a separate assembly altogether.

For example, a WCF Service Contract interface can be shared by both client and service if you have control over both ends of the wire. By moving the interface into its own assembly, it will have fewer assembly dependencies of its own. This makes it much easier for the client to consume, loosening the coupling with its implementation.

Title: Declaring interface in the same file as the base class, is it a good practice?

Body:
To be interchangable and testable, normally services with logic needs to have interface, e.g.

```<code>public class FooService: IFooService
{ ... }
</code>```

Design-wise, I agree with this, but one of the things that bothers me with this approach is that for one service you will need to declare two things (the class and the interface), and in our team, normally two files (one for the class and one for the interface). Another discomfort is the difficulty in navigation because using "Go to definition" in IDE (VS2010) will point to the interface (since other classes refer to the interface), not the actual class.

I was thinking that writing IFooService in the same file as FooService will reduce the above weirdness. After all, IFooService and FooService are very related. Is this a good practice? Is there a good reason that IFooService must be located in its own file?


问:
Sending an email with attachment from server side
I have to create a word document in a specific format and send it as attachment to some email addresses.

I have a preview screen for the report which on approval has to be send in email. This is an ASP.NET MVC 3 application.

I am left with a few options here.

I am creating the preview using html. I can convert this html into doc and send it, which would be a straight solution. But capturing the Response object's output is being a tough job.

I thought of using Mail merge functionality of MS word, where I'll be filling the placeholders of the doc template. But the problem is conceptually, it doesn't appear to be mail merge.

I have found someone suggesting to use RTF format and replace the placeholders with database values.

Which is the right thing to do? What's the best solution here? Is there any other option than the three listed above?

答:
Dealing with MS Office is always requiring a lot of tweaks and trade-offs. Did you had a chance to look at Open XML SDK?

You may easily use Open Xml SDK. It's free, you don't need any Office libraries and there are many resources on the web. This one, for example.


答: I've had a lot of success using SyncFusion's DocIO library. I had a scenario similar to yours. I stored a Word Template in the database, used the DocIO library to generate the final document off the template and emailed the file.</p>

Title: Sending an email with attachment from server side

Body:
I have to create a word document in a specific format and send it as attachment to some email addresses.

I have a preview screen for the report which on approval has to be send in email. This is an ASP.NET MVC 3 application.

I am left with a few options here.

I am creating the preview using html. I can convert this html into doc and send it, which would be a straight solution. But capturing the Response object's output is being a tough job.

I thought of using Mail merge functionality of MS word, where I'll be filling the placeholders of the doc template. But the problem is conceptually, it doesn't appear to be mail merge.

I have found someone suggesting to use RTF format and replace the placeholders with database values.

Which is the right thing to do? What's the best solution here? Is there any other option than the three listed above?


问:
How are operators organized in memory
How are operators organized/saved in the memory in context of a programming language.  Are they procedures/functions saved somewhere and compilers just manipulate things to call these procs whenever the operators are used in the program? </p>

答:
The whole file and code that it contains is loaded to the memory. The reserved expressions like operators and commands are treated in different ways by each different compiler.

The compiler plays most important role in this case. Compilers may act differently depending on which programming language and version are you using.

For more detailed information here is a nice article to look - Operator (programming) - Wiki

Title: How are operators organized in memory


问:
May I remove ads from feed in my news reader app?
I'm creating a News Reader app for Tablets and PCs. My app is fetching data from news sources by RSS feed of websites (in the server-side).

But some of these sites are showing some advertising banners at the end of each article.

Should I remove those banners from the feed? Am I legally/ethically allowed to do this?

And what about If I want to put some other ads in my application? (Right at the end of each article)

I mean, If I want to have my own advertising service...

Update: And what if I use feed for content titles and summaries, but use other thing, like Readability API to show full article, and then put my own ads below content? (Readability gets the HTML page, and gives you a clean page without any ads and such.)

答:
This is a legal question. You better treat this seriously.

Read the privacy disclaimers on RSS feed that you are using. There should be information on what is allowed and what they don't want to be used or removed.


答:
In compiled languages, entire expressions, including the operators that they contain, get transformed to binary code corresponding to the calculation represented by the expression. An operator gets translated into a sequence of one or more binary instructions to the CPU, directing it to perform the required operation. For example

```<code>a = b + 2;
</code>```

may get converted into something like this:

```<code>LOAD  R1, @b
LOAD  R0, #2
ADD   R0, R1
STORE R0, @a
</code>```

@a and @b represent addresses of variables a and b; #2 represents the value of an integer constant 2.

If an operator does not correspond to a single assembly instruction, a compiler implementation may choose an inlined or a non-inlined function to implement it. For example, in 8-bit CPUs that lacked multiplication instructions (and were short on memory, restricting the opportunities for inlining, e.g. 6502), multiplication and division have been commonly implemented as subroutines.

In interpreted languages operators are stored as part of the code, in the form of a data structure if preprocessing is used, or in their textual form in the rare case when preprocessing is not used.

Title: How are operators organized in memory

Body: How are operators organized/saved in the memory in context of a programming language.  Are they procedures/functions saved somewhere and compilers just manipulate things to call these procs whenever the operators are used in the program? </p>

Body:
In compiled languages, entire expressions, including the operators that they contain, get transformed to binary code corresponding to the calculation represented by the expression. An operator gets translated into a sequence of one or more binary instructions to the CPU, directing it to perform the required operation. For example

a = b + 2;

may get converted into something like this:

LOAD  R1, @b
LOAD  R0, #2
ADD   R0, R1
STORE R0, @a

@a and @b represent addresses of variables a and b; #2 represents the value of an integer constant 2.

If an operator does not correspond to a single assembly instruction, a compiler implementation may choose an inlined or a non-inlined function to implement it. For example, in 8-bit CPUs that lacked multiplication instructions (and were short on memory, restricting the opportunities for inlining, e.g. 6502), multiplication and division have been commonly implemented as subroutines.

In interpreted languages operators are stored as part of the code, in the form of a data structure if preprocessing is used, or in their textual form in the rare case when preprocessing is not used.


答:
Most operators are just "syntactic sugar" for functions or procedures, so you can look at them mostly the same way:

They may be ordinary lists of machine instructions stored at a particular address to be called like an ordinary function.  Sometimes these functions are actually callable as normal functions if you know the correct syntax, but in other situations/languages it may be that the compiler handles it completely internally without granting developers access to the functionality through anything but the compiler's own lexer and parser.

Sometimes the compiler can replace the operator at the place it is called, in the source, to avoid the overhead of the machine instructions needed for a function call, directly placing the machine code there (i.e. like inlining, in some cases EXACTLY like inlining).

Sometimes you might be working in an interpreter / runtime, where the functions are stored in an intermediate language which is "interpreted" by the runtime for the correct machine code, which could conceivably also be inlined but would still need to be interpreted.

In some cases, where the operands of the operator are types that are very close or identical to the machine code instruction set the operators may get translated directly into only very few statements.  How many statements would mostly depend on whether the operands involved are currently stored in registers or memory (which is a whole compiler topic on its own).

In nearly all cases, what actually happens inside the compiler, interpreter or runtime will depend on the types of the operands.  An operator between two operands of the same type will end up resolving to the operator for that type (which may or may not be entirely different from the same operator for different types).  An operator between operands of different types may be implemented directly (which is rare) or additionally call conversion operators on one or more of the operands to turn them into types that can be operated on, before actually performing the operator itself.

Title: How are operators organized in memory


答:
The parser converts it first into an abstract syntax tree.  The kind of operator ends up as a node, and the operands end up as its child nodes.  The compiler then basically walks the abstract syntax tree and does different things depending on the types of the operands.

Most of the time, the operator code is going to be simple enough to inline.  However, there are also situations where it's complex enough to create a function call.  For example, in C++ you can override operators on classes by creating your own functions to handle them.  Usually in simple, interpreted domain specific languages it also ends up as a function call because that's the easiest way to do it when performance isn't paramount.

Title: How are operators organized in memory


问:
"Do you have any questions for us?" In an interview
You know the prospective company fairly well but are asked "Do you have any questions for us?".  To show interest, what are some of your favorite questions to reply?</p>

答: As a developer I like to ask "What are some ways an individual on your team can distinguish themselves?"  This tells a lot about the culture of the team.  I don't want to be the stereotypical code monkey, I want to be able to actively add value to the business.</p>

ContentLicense: CC BY-SA 2.5


问:
GPU Data Flow Architecture
I am currently working on CUDA, DirectX. I want to know the data flow architecture of GPUs. The one presented for CUDA and DirectX are parallel programming model and graphics pipelines respectively. But, I  want to know the data flow architecture (like, the data flow architecture of 8086 processors).</p>

答:
You're making the mistake of assuming that GPU architectures are as well-defined and consistent as CPU architectures; this isn't the case.  GPU architectures can and will vary between different manufacturers, and can and do vary even between different hardware generations from the same manufacturer.

What APIs model is a graphics pipeline, which describes at quite a high level how the various stages interact.  A recent example (for D3D11) may be viewed here: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476882%28v=vs.85%29.aspx

Microsoft also publish register specs for D3D versions; for example the specs for vs_3_0 are here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb172963%28v=vs.85%29.aspx

Both of these are still at a fairly high level and are API-specific rather than hardware-related.  As explained above, there is not going to be any single set of hardware-specific info.  Even if there was, you would not be able to make use of it as modern operating systems disallow direct access to hardware, and even if you could, any code you write making use of it would have a high risk of not being valid on other manufacturer's hardware, or on other hardware from the same manufacturer.

That's one of the reasons why graphics APIs exist - because all hardware is so different it's just not possible to meaningfully and usefully access the hardware at a lower level.  In other words, the kind of info you're asking for is something that you shouldn't have to worry about - that's the job of the API and driver; you worry about your own code.

Title: GPU Data Flow Architecture


答:
I'd say no, you should not remove ads from the feeds, especially if you're just going to add some ads of your own - that may or may not be legal (check with a lawyer), but it's definitely rude as all get out to remove his ads and put on your own.

It's like those stupid web sites that take some other site's content, plaster tons of crummy ads and try to generate revenue from page views. It may or may not be legal, but sure as heck no one wants to do any real business with those folks.

Edited in response to question edit: I don't think how you go grabbing stuff really matters. If you take out the original site's ads, you are being rude. Basically, I'd say display whatever the site sends, and then put your own ads nearby, but separate enough that it's obvious they go with the reader not the site.

Title: May I remove ads from feed in my news reader app?

Body:
I'm creating a News Reader app for Tablets and PCs. My app is fetching data from news sources by RSS feed of websites (in the server-side).

But some of these sites are showing some advertising banners at the end of each article.

Should I remove those banners from the feed? Am I legally/ethically allowed to do this?

And what about If I want to put some other ads in my application? (Right at the end of each article)

I mean, If I want to have my own advertising service...

Update: And what if I use feed for content titles and summaries, but use other thing, like Readability API to show full article, and then put my own ads below content? (Readability gets the HTML page, and gives you a clean page without any ads and such.)


问:
How to discriminate commented code and documentation comments
After using version control tools, it is no longer necessary to comment out old code.
However, some team members still comment out old code. Therefore, I want to clean them up.

I want to mark commented lines which are really comments / documentation, so that every time I do not need to re-read all commented regions. The unmarked lines left are new commented code.

How do I achieve this? Any existing tools or need to write on my own?

Similar concept: in git, we have 'partial commit' to select some lines to commit.
However, the lines marked in 'partial commit' is valid once only.

答: If you want an automated solution you could parse the comments to see if they are valid code. In general this would identify commented out code. Example code is one thing you have to be wary of accidentally deleting. Though you could check if there is a somewhat standard way of formatting them that you could use to identify or ignore them. E.g. they are in a header or function comment block, or marked in some other way. </p>


问:
What am I missing about PHP?
It's like this mythical thing that a dominating portion of developers say is just the best option for back-end development, a part of development about which I know virtually nothing beyond the absolute basics.

So I've looked up PHP tutorials a bunch of times, trying to figure out why it's so powerful and common, but it's annoying as hell-- all the tutorials treat you like a new programmer. You know, this is how you make an If Else statement, here's a for loop, etc. The "Advanced Topics" show you how to make POST and GET statements and whatnot.

But there must be more to it! I don't get it! That's practically no different from JavaScript. What am I missing about this language? What else can it do? Where's the power and versatility? I've heard it called a function soup; where are all the functions?

Please chide me. I'm clearly missing something.

答:
You mentioned "That's practically no different from JavaScript". Certainly allot of common languages like C/C++/C#/Python share similar syntax.

However the bigger difference compared to say Javascript is that it's most commonly used on the server side hence you can interact with a database, create an authentication system, manipulate images etc.

Title: What am I missing about PHP?


问:
Domain Models (PHP)
I have been programming in PHP for several years and have, in the past, adopted methods of my own to handle data within my applications.

I have built my own MVC, in the past, and have a reasonable understanding of OOP within php but I know my implementation needs some serious work.

In the past I have used an is-a relationship between a model and a database table. I now know after doing some research that this is not really the best way forward. As far as I understand it I should create models that don't really care about the underlying database (or whatever storage mechanism is to be used) but only care about their actions and their data.

From this I have established that I can create models of lets say for example a Person an this person object could have some Children (human children) that are also Person objects held in an array (with addPerson and removePerson methods, accepting a Person object).

I could then create a PersonMapper that I could use to get a Person with a specific 'id', or to save a Person.

This could then lookup the relationship data in a lookup table and create the associated child objects for the Person that has been requested (if there are any) and likewise save the data in the lookup table on the save command.

This is now pushing the limits to my knowledge.....

What if I wanted to model a building with different levels and different rooms within those levels? What if I wanted to place some items in those rooms?

Would I create a class for building, level, room and item

with the following structure.

building can have 1 or many level objects held in an array level can have 1 or many room objects held in an array room can have 1 or many item objects held in an array

and mappers for each class with higher level mappers using the child mappers to populate the arrays (either on request of the top level object or lazy load on request)

This seems to tightly couple the different objects albeit in one direction (ie. a floor does not need to be in a building but a building can have levels)

Is this the correct way to go about things?

Within the view I am wanting to show a building with an option to select a level and then show the level with an option to select a room etc.. but I may also want to show a tree like structure of items in the building and what level and room they are in.

I hope this makes sense. I am just struggling with the concept of nesting objects within each other when the general concept of oop seems to be to separate things.

If someone can help it would be really useful.

Many thanks

答:
OOP isnt meant to just plain "seperate things". It's more about organization and intent and reusability (when appropriate). Take a look at Domain Driven Design (DDD). Specifically, identifying where your "Value Objects" are, your "Entities" are and which "Services / Factories / Repositories" are needed to support them to get you where you need to be.

In answer to your qeustion:

Would I create a class for building, level, room and item with the following structure

-Yes, it seems those would be your Models

building can have 1 or many level objects held in an array level can
  have 1 or many room objects held in an array room can have 1 or many
  item objects held in an array

-That sounds right, the Building then would be your Entity, because each building is unique and has a distinct existance, as opposed to an "item" or "room" which have a clearly defined value, but no distict existance other than it's uniqueness to who owns it.

and mappers for each class with higher level mappers using the child
  mappers to populate the arrays (either on request of the top level
  object or lazy load on request)

-This is where you're going to want expand a bit. Basically, you're going to want to create repositories / factories which will be able to fetch and load your "entities" with data. This might be what you are referring to as "Mappers", but when I hear mappers I think of "Active Record's". which are objects which save and load themselves and pretty much are 1-1 with the database. With that concept, breaking out the core "properties" per intent can become messy (it probably works for some).

Here are some good resources which should aid in your development.

Check out Domain Driven Design Concepts, there are a few Moguls out there which you'll come across very quickly which will offer you detailed insight into the theories at hand. Here are some links to get you started:

this is a pretty brief explanation:
http://mattpeters.net/2009/03/24/domain-driven-design-part-1-introduction-and-entities/

this one has the cool domain name and turns out to be a great resource:
http://domaindrivendesign.org/

Title: Domain Models (PHP)


问:
What makes Erlang suitable for cloud applications?
We are starting a new project and implementing on our corporations's instantiation of an openstack cloud (see http://www.openstack.org/). The project is security tooling for our corporation. We currently run many hundreds of dedicated servers for security tools and are moving them to our corporations instantiation of openstack.

Other projects in my company currently use erlang in several distributed server applications, and other Q/A point out erlang is used in several popular cloud services. I am trying to convince others to consider where it might be applicable on our project.

What are erlang's strengths for cloud programming? Where are areas it is particularly appropriate to use erlang?

答:
One aspect of cloud that is different than traditional hardware deployments is the ease with which you can spin up new instances when needed. The ability to monitor other nodes, and processes on other nodes, makes it relatively simple to build highly dynamic systems that can add or remove vms and manage them as needed.

This is particularly so if you're building your system using erlang's OTP (Open Telecom PLatform) framework, which provides both structure and mechanisms (supervisor trees) to support building some pretty sophisticated stuff with far less effrot than you'd imagine. Erlang handles all the tricky bits so that you don't have to.


问:
What is a "wrapper" program?
Where I work, employees use a third-party desktop program for their clients. This program saves data to a flat file. My colleague wants to write a Java program that uploads that flat file to a remote server, opens the desktop program when the flat file is downloaded from a Web site, and checks if the desktop program is running or not by looking at the Windows processes.

He keeps calling this helper/utility program a "wrapper." But it doesn't wrap anything! I tried to clear it up with him, but he said, "Well, I call it a wrapper." He now has everyone in the company calling it a "wrapper." What would you call it? I say that it's a helper program or utility program.

答:
If it's explained in layman terms, which non-techie people can understand, there won't be any problem.

From my understanding, a wrapper program is wrapped around a standard program to handle the sophisticated or restrictive steps for the end users as in a customized program that maybe adhere to company policies.

Title: What is a "wrapper" program?


问:
Code bases for desktop and mobile versions of the same app
I have written a small Java Swing desktop application. It seems like a natural step to port it to Android since I am interested in learning how to program for that platform. I believe that I can reuse some of my existing code base. (Of course, exactly how much reuse I can get out of it will only be determined as I start coding the Android app.)

Currently I am hosting my Java Swing app on Sourceforge.net and use Git for version control. As I start creating the Android app, I am considering two options:

Add the Android code to my existing repository, creating separate directories and Java packages for the Android-specific code and resources.

Create a new Sourceforge project (or even host a new one) and creating a new Git repository.

a. With a new repository, I can simply add the files from my original project that I will reuse. (I don't particularly like this option as it will be difficult to modify both copies of the same file in both repositories.)

b. Or I can branch the original repository. This adds the difficulty of merging changes of shared source files.

Mostly I am trying to decide between choices 1. and 2b. If I'm going to branch the existing repository, what advantages are there to hosting it as a separate SF project (or even using another OSS hosting service) as opposed to keeping all my source code in the current SF project?

答: The correct way to go is to divide your code in three parts: common, Swing-desktop, Android. Whether you use one repo or three is up to you; three repos might make sense if their nature is going to be different: different committers, different branching/versioning policies, etc. or perhaps the repos are going to be huge and you don't want to burden Swing-desktop developers from downloading the Android code and the other way round.</p>


答:
The best way to accomplish your code reuse would be to take the common functions of the apps and extract them to an external library that is linked in both projects which are each in their own repository. This eliminates duplicating code through branching or having a single complex repository. It would likely be a lot of work to accomplish this depending on how your desktop app is designed, the amount of effort involved to get everything set up this way may be to large of an investment because the returns are mostly in long term maintainability.

The next best option would be to put both projects in the same repository, this could get a bit tricky to manage if your project grows in scope. This option would also be a bit difficult to manage if you ever had more people involved, though this could be a non issue for you.

I would avoid branching to create the android app you will run into problems maintaining a single correct version of your shared code, and you will have sizable portions of each branch that are separate distinct code that should never be merged together. That isn't how branches are designed to work and it will cause headaches for you.

Title: Code bases for desktop and mobile versions of the same app

Body:
I have written a small Java Swing desktop application. It seems like a natural step to port it to Android since I am interested in learning how to program for that platform. I believe that I can reuse some of my existing code base. (Of course, exactly how much reuse I can get out of it will only be determined as I start coding the Android app.)

Currently I am hosting my Java Swing app on Sourceforge.net and use Git for version control. As I start creating the Android app, I am considering two options:

Add the Android code to my existing repository, creating separate directories and Java packages for the Android-specific code and resources.

Create a new Sourceforge project (or even host a new one) and creating a new Git repository.

a. With a new repository, I can simply add the files from my original project that I will reuse. (I don't particularly like this option as it will be difficult to modify both copies of the same file in both repositories.)

b. Or I can branch the original repository. This adds the difficulty of merging changes of shared source files.

Mostly I am trying to decide between choices 1. and 2b. If I'm going to branch the existing repository, what advantages are there to hosting it as a separate SF project (or even using another OSS hosting service) as opposed to keeping all my source code in the current SF project?


问:
Resources for popular domain models
I have come across many situations where I had to build a system for a library or a clinic or other popular domains.

The thing is a domain model for a library was probably done 1000 times already with different level of details of course. Here is an example.

Is there a popular website or community where one can find ready made domain models for popular systems?

The whole purpose I'm trying to achieve is to quickly get a grasp of the domain I'm modelling and customise it to my needs. Re-inventing the wheel seems really absurd when the same system might have been modelled properly previously.

Note

I know Google might sound like the perfect source, but it will better if there is a repository out there that people can post there models, so that others can share them.

答:
Hmmm...that's interesting. A communal repository of domain models for discussion and shared knowledge. No such thing exists...but I could see the benefits of having something like it.

To go with it, maybe a service that allowed you to deploy one of these Domain Models ready to be customized in your preferred language.

In the meanwhile, here is a read-only collection of database models which could be used as the basis for a domain model.

Title: Resources for popular domain models


问:
What are the advantages of Ceylon over Java?
Looking for the recent and powerful upcoming programming languages over net, I came across Ceylon. I dropped in at ceylon-lang.org and it says:

Ceylon is deeply influenced by Java. You see, we're fans of Java, but we know its limitations inside out. Ceylon keeps the best bits of Java but improves things that in our experience are annoying, tedious, frustrating, difficult to understand, or bugprone.

What are the advantages of Ceylon over Java?

答:
It has some nice features not found in java:

Reified Generics

Type Inference

Mixins (although this is coming in JDK8)

Union and Intersection types (which is really cool and not found in
many languages)

"Higher order functions" (although not quite functions as first
class objects)

Closures (also coming in JDK8)


问:
How to join the World of Programming?
Name's Vlad and I am currently on my third year of Community College, studying Computer Science with emphasis on Programming in C++ and Networking. I have completed a few programming courses with general ease, but have not gained advanced understanding of programming through school. None of my friends are serious programmers working in the industry.

Being an active lurker on many programming websites, and in general tech oriented sites I have noticed how little I know about the industry, the lingo and terminology. (I have no clue how Git hub works, but I generally understand what its for). So I am looking for help as to where I should look for information on the programming world and the industry in which I a very interested. By that I mean, what sites I should utilize to gain information on programming practices, introduction to advanced C++ and resources that simply introduce a 20some programming noob. I like programming, but I haven't dug my hands deep into it yet, I want to start to do so before I transfer to a University. All in all, where do I find information on becoming an actual programmer (Information that lays out a path).

答:
Take what you know and figure out a problem you think you can solve with your programming skills. then expand that program to do a little bit more, using Google to help fill in the blanks and then if you get stumped www.stackoverflow.com or Programmers.stackexchange.com for specific questions.

Read one book at a time. on one subject at a time, otherwise you may get confused.  there are languages that work together but they are not the same, they function differently.

Title: How to join the World of Programming?


问:
Entity Framework with large systems - how to divide models?
I'm working with a SQL Server database with 1000+ tables, another few hundred views, and several thousand stored procedures.  We are looking to start using Entity Framework for our newer projects, and we are working on our strategy for doing so.  The thing I'm hung up on is how best to split the tables into different models (EDMX or DbContext if we go code first).  I can think of a few strategies right off the bat:

Split by schema

We have our tables split across probably a dozen schemas.  We could do one model per schema.  This isn't perfect, though, because dbo still ends up being very large, with 500+ tables / views.  Another problem is that certain units of work will end up having to do transactions that span multiple models, which adds to complexity, although I assume EF makes this fairly straightforward.

Split by intent

Instead of worrying about schemas, split the models by intent.  So we'll have different models for each application, or project, or module, or screen, depending on how granular we want to get.  The problem I see with this is that there are certain tables that inevitably have to be used in every case, such as User or AuditHistory.  Do we add those to every model (violates DRY I think), or are those in a separate model that is used by every project?

Don't split at all - one giant model

This is obviously simple from a development perspective but from my research and my intuition this seems like it could perform terribly, both at design time, compile time, and possibly run time.

What is the best practice for using EF against such a large database?  Specifically what strategies do people use in designing models against this volume of DB objects?  Are there options that I'm not thinking of that work better than what I have above?

Also, is this a problem in other ORMs such as NHibernate?  If so have they come up with any better solutions than EF?

答: I use a hybrid approach -- OLTP stuff is handled by EF while heavy operations such as batch inserts, mass updates, report queries, etc are handled by Stored Procs.  It also makes the migration path easier if you're not doing a full re-write of your data layer all at once.</p>


答: Build a personal website from scratch, find some small open-source projects and try to contribute and most important READ READ READ.  Read lots of books. This will get you half way home.</p>

Title: How to join the World of Programming?

Body:
Name's Vlad and I am currently on my third year of Community College, studying Computer Science with emphasis on Programming in C++ and Networking. I have completed a few programming courses with general ease, but have not gained advanced understanding of programming through school. None of my friends are serious programmers working in the industry.

Being an active lurker on many programming websites, and in general tech oriented sites I have noticed how little I know about the industry, the lingo and terminology. (I have no clue how Git hub works, but I generally understand what its for). So I am looking for help as to where I should look for information on the programming world and the industry in which I a very interested. By that I mean, what sites I should utilize to gain information on programming practices, introduction to advanced C++ and resources that simply introduce a 20some programming noob. I like programming, but I haven't dug my hands deep into it yet, I want to start to do so before I transfer to a University. All in all, where do I find information on becoming an actual programmer (Information that lays out a path).


问:
How do I hire testers by giving them a buggy app for testing their efficiency?
My boss wants to recruit testers based on their testing efficiency (number of bugs identified). So, he's shortlisted 5 people and I need to give them an app full of bugs and see how they fare in reporting obvious bugs, and hidden bugs. I know.... it kind of sounds weird. I guess, this is just like the coding world, where you hire a programmer by assessing his/her programming ability (which is a little easier). Once hired, these testers would be testing a java swing app, so their familiarity of testing frameworks/tools is not really required.

So, my question here is - How do I go about finding buggy apps (web/non-web), preferably java ones, that I can have the shortlisted testers have a go at? How would you go about this task if your boss asks you to do so? I am kind of clueless at this point - I googled a bit, thought about finding new apps on sourceforge with lots of bugs, but both approaches didn't work for me.

答:
This should be easy.  You have one or more applications already, right?  And you used source control, I hope.  And you should have a record of historical bugs.  And you really ought to be able to easily build from old versions in source control.

So see how well they can find the bugs you actually had.  If that isn't a realistic test I don't know what is.


问:
Memory concerns while plotting escape from DLL Hell in Delphi
I work on a program with about 50 DLLs that are loaded from one executable, it's an old organically grown program where the only rationale for creating a new DLL is that one previously didn't exist to fill a given need. (and namespaces didn't exist in Delphi so it never crossed our mind to make dll1.main.pas, dll2.main.pas or something even more unique)

What we want to do is consolidate all these DLLs into one executable, since none of them are used out of the program, there shouldn't be much of a problem.  The concern my boss has is that if we did this, the memory overhead for terminal server clients would go through the roof.

So, I've stepped through enough initialization code to know that lots of stuff is done every time a DLL is loaded in to memory, but say I've got a project with about 4000 files, and 50 dlls, 10 of which are probably utilized by any one user in any one session of the program. The 50 dlls are about 2/3rds form files, if not more, but beyond that there's not a lot of other resources being loaded (only a few embedded pictures, icons, cursors, etc..). If I loaded all these files in to memory, how much memory is used per unit? how much is used per class? How do I keep the overhead down? and what is the biggest project one can reasonably expect to build with Delphi?

This tidbit won't help answering, but I think it might clarify what my boss is worried about, we currently start our program at about 18megs, normal working conditions are usually less than 40 megs, he thinks it could climb as high as 120 megs.

答:
Memory usage wont be a problem for you.  A couple of my Delphi apps routinely use a GB or more.  So long as you are not running into the platform limits you'll be fine. I'm not sure if resources themselves are loaded from disk when the exe starts.  Certainly they would be for auto-created forms.  So you'll want to avoid those, and continue to create the forms manually.  And free them, too.

I dont think there's a lot in the way of concrete answers for you since its really going to depend on whats in the dll's.  Best is to compile everything up into a single exe and see how it looks.  A single exe would certainly be easier to manage (and frankly, is one of the strengths of Delphi).  The big issue is if it'd be a problem to run such large exe's on a terminal server, since you'd have multiple copies running.  Ultimately it might be more cost effective to compile to a single exe and add some ram to the terminal servers if needed. On a normal desktop I dont think it'd be an issue at all.


答:
Start by creating your own little projects, creating new things everyday would help you gain confidence and hand-on practice with programming language/frameworks that you use.

Also look and learn from open-source projects which are hosted free for curious  programmers. They would really help you understand on how to use best practices while doing your coding and how decide on design. In addition, try to get involved in open-source project development, it will boost your self-learning and improvement dramatically.

Even-though you are a beginner/newbie programmer, you may get up-to speed on what skills are in demand for programmers. I would recommend to attend local community events to help with that. You may find some of these groups in communitymegaphone.com.

Talk with local buddy programmers, they are mostly good people who would not mind to help a college.

Title: How to join the World of Programming?


问:
Implenting ActiveRecord with inheritance?
I recently converted an old application that was using XML files as the data store to use SQL instead. To avoid a lot of changes I basically created ActiveRecord style classes that inherited from the original business objects.

For example

```<code>SomeClassRecord :SomeClass
//ID Property
//Save method
</code>```

I then used this new class in place of the other one, because of polymorphism I didn't need to change any methods that took SomeClass as a parameter.

Would this be considered 'Bad'? What would be a better alternative?

答:
I would not say this is a 'Bad' thing to do.  But there are alternatives with their own trade-offs.

Assuming that the way the original classes were used was the ActiveRecord pattern, here are some alternatives.

Modify each business object's Save() method to delegate the saving work to a class responsible for dealing with storage, whether it's XML or SQL.  Instead of decorating each class, you delegate the saving to a single interface, say, IDataStore.  For example:

```<code>public class SomeClass {
    IDataStore dataStore; // how this gets set can vary also
    public void Save() {
        dataStore.Save(this);
    }
}
</code>```

Now the change is in the implementation of IDataStore.

Continue using your business objects in the business layer, but when doing data access, map your business objects to data access objects, and use the Repository pattern.  For example:

```<code>public class SomeBusinessProcess {
  public void DoSomeWork(SomeClass someClass) {
    // ... do some work on someClass ...

    // now save
    SomeClassDAO someClassDao = AutoMapper.Map<SomeClass, SomeClassDAO>(); // can use AutoMapper, for example
    repository.Save(someClassDao);
  }
</code>```

You really can take it as far as you want, based on what your needs are.

Body:
I would not say this is a 'Bad' thing to do.  But there are alternatives with their own trade-offs.

Assuming that the way the original classes were used was the ActiveRecord pattern, here are some alternatives.

Modify each business object's Save() method to delegate the saving work to a class responsible for dealing with storage, whether it's XML or SQL.  Instead of decorating each class, you delegate the saving to a single interface, say, IDataStore.  For example:

public class SomeClass {
    IDataStore dataStore; // how this gets set can vary also
    public void Save() {
        dataStore.Save(this);
    }
}

Now the change is in the implementation of IDataStore.

Continue using your business objects in the business layer, but when doing data access, map your business objects to data access objects, and use the Repository pattern.  For example:

public class SomeBusinessProcess {
  public void DoSomeWork(SomeClass someClass) {
    // ... do some work on someClass ...

    // now save
    SomeClassDAO someClassDao = AutoMapper.Map<SomeClass, SomeClassDAO>(); // can use AutoMapper, for example
    repository.Save(someClassDao);
  }

You really can take it as far as you want, based on what your needs are.


问:
Conditional attribute in XML - most concise solution?
I am tasked with setting up conditional profiling - a method of tagging chunks of XML with an attribute, which will then be used as a conditional value to extract subset of that XML.
Have a look at another definition/example: DITA profiling
The XML is documents that are equivalent to printed books - i.e. documents that are often looked at by a human, even if indirectly.
Therefore I am looking at a few requirements here:

keeping the value list brief - so it doesn't affect the readability of the document

be able to process with standard XML tools - a space-separated list inside an attribute is still probably fine, but I'd rather not use too much regexp for this

be obvious for various users, including 3rd parties, which content goes where

Be easy to maintain going forward

Therefore one easy solution is:

```<code><test condition="print epub"/>
<test condition="web kf8 app mobi"/>
</code>```

The problem with this:

As the list grows the value of the attribute can be a bit verbose

One needs to explicitly state every value even if it's a scenario of this vs everything else

Therefore I am also looking at other approaches such as:

Using "+" and "-" modifiers, Apache htaccess style to override the default cascading of profiling - by default all content goes everywhere and if we want to exclude a bit we just say "-kindle". It does require parsing the whole tree, is not supported by editing tools and one needs to regexp the attribute value a bit deeper...

Using an intermediate file to define groups of values such as "other" or "non-print", example of this in DITA. It allows concise XML as well as different grouping and values for each document but it does create a certain level of abstraction which may make it a little less obvious for a 3rd party?

Altogether, if you received such XML and were tasked to process it, which option you'd rather receive?
If you have any experiences like that, even in an unrelated areas such a builds, don't hesitate to comment!

答:
you could use more than one Attribute, like Condition and Condition1 or whatever would make sense for what you are doing, so that you would have categories of Attributes.
then you could search on one Attribute when you know you are looking for something that is going to be listed under one attribute and not another, it would probably speed things up a little bit

..just a suggestion, not super sure I know what you were talking about but I figured I would throw that out there.


问:
Using prefix incremented loops in C#
Back when I started programming in college, a friend encouraged me to use the prefix incrementation operator ++i instead of the postfix i++, citing that there was a slight chance of better performance with no real chance of a downside. I realize this is true in C++, and it's become a general habit that I continue to do.

I'm led to believe that it makes little to no difference when used in a loop in C#, regardless of data type. Apparently the ++ operator can't be overridden. Nevertheless, I like the appearance more, and don't see a direct downside to it.

It did astonish a coworker just a moment ago though, he made the (fairly logical) assumption that my loop would terminate early as a result. He's a self-taught programmer, and apparently never came across the C++ convention. That made me question whether or not the equivalent behavior of pre- and post-fix increment and decrement operators in loops is well known enough.

Is it acceptable for me to continue using ++i in looping constructs because of style preference, even though it has no real performance benefit? Or is it likely to cause confusion amongst other programmers?

Note: This is assuming the ++i convention is used consistently throughout all code.

答: I think you should stick with the conventions that your co-workers are used to.  The principle of least surprise.  You don't want to sit and figure out why a simple operation is written in an uncommon manner for no reason, so why should the next guy who is reading your code?</p>

Title: Using prefix incremented loops in C#


答:
Good practice is to use the coding convention that your team members/colleges are agreed on. It does not really matter how you decided to do that as far as it works and inconstantly implemented. Keeping code as simple and as clean (KISS principle) should be the main goal.

It is far more important to have consistent style of coding in big projects to ease the maintenance at later stages.

Here you are a MS guidelines link - C# Coding Conventions (C# Programming Guide)

Title: Using prefix incremented loops in C#

Body:
Back when I started programming in college, a friend encouraged me to use the prefix incrementation operator ++i instead of the postfix i++, citing that there was a slight chance of better performance with no real chance of a downside. I realize this is true in C++, and it's become a general habit that I continue to do.

I'm led to believe that it makes little to no difference when used in a loop in C#, regardless of data type. Apparently the ++ operator can't be overridden. Nevertheless, I like the appearance more, and don't see a direct downside to it.

It did astonish a coworker just a moment ago though, he made the (fairly logical) assumption that my loop would terminate early as a result. He's a self-taught programmer, and apparently never came across the C++ convention. That made me question whether or not the equivalent behavior of pre- and post-fix increment and decrement operators in loops is well known enough.

Is it acceptable for me to continue using ++i in looping constructs because of style preference, even though it has no real performance benefit? Or is it likely to cause confusion amongst other programmers?

Note: This is assuming the ++i convention is used consistently throughout all code.


答:
++i and i++ are different operations.

Check this Link out  it gives a better example than what I had. but I was on the Right Track.

```<code>int i = 1;

Console.WriteLine(++i); // <-- will output 2

i = 1; // <-- reset i

Console.WriteLine(i++); // <-- will output 1
</code>```

Title: Using prefix incremented loops in C#

Body:
++i and i++ are different operations.

Check this Link out  it gives a better example than what I had. but I was on the Right Track.

int i = 1;

Console.WriteLine(++i); // <-- will output 2

i = 1; // <-- reset i

Console.WriteLine(i++); // <-- will output 1


答:
I'm actually working on the exact same thing at the moment.  Personally, I find it easiest to keep everything in one repo, one branch.  I use separate java packages for common, swing, and android code.  I have interfaces for all the calls from the common package into the GUI packages, so the common code has no idea which GUI it's running against.

The advantage to this approach is it forces you to keep your code bases synced up, sort of like a personal continuous integration.  If your versions aren't isolated from each other in source control it's a lot easier to keep them from diverging.

Don't think about what you might need later.  Think about what works best for you right now.  The most important thing is to make your code modular.  If you do that, putting it into a separate library, separate branch, or separate repo if and when you need it later is trivial.


问:
When should you use a private/inner class?
To clarify, what I'm asking about is

```<code>public class A{
    private/*or public*/ B b;
}
</code>```

vs.

```<code>public class A{
    private/*or public*/ class B{
        ....
    }
}
</code>```

I can definitely think of some reasons to use one or the other, but what I would really like to see are convincing examples that show that the pros and cons are not just academic.

答: According to Jon Skeet in C# in Depth, using a nested class was the only way to implement a fully lazy thread-safe singleton (see Fifth Version) (until .NET 4).  </p>


答:
Unoptimized, i++ makes a copy, so j = i++ translates to:

```<code>iTemp = i;
i = i + 1;
j = iTemp;
</code>```

Whereas j = ++i translates to:

```<code>i = i + 1;
j = i;
</code>```

That extra copy into a temp variable is what causes the theoretical performance hit with the post-increment.  However, since the new value of i doesn't depend on j, it can be optimized to:

```<code>j = i;
i = i + 1;
</code>```

Which, barring any pipeline oddities, has exactly the same runtime as the pre-increment version.  It turns out there are very few real world circumstances where a similar compiler optimization is not possible, so there is practically zero reason to choose pre-increment for optimization reasons.  Standalone increments, such as in a for loop, are even easier to optimize down to the same instruction.

In other words, follow the coding convention unless it's syntactically significant.  But it doesn't hurt to educate your colleagues either if the only reason they don't use it is based on an erroneous understanding of how for loops work.

Title: Using prefix incremented loops in C#

Body:
Unoptimized, i++ makes a copy, so j = i++ translates to:

iTemp = i;
i = i + 1;
j = iTemp;

Whereas j = ++i translates to:

i = i + 1;
j = i;

That extra copy into a temp variable is what causes the theoretical performance hit with the post-increment.  However, since the new value of i doesn't depend on j, it can be optimized to:

j = i;
i = i + 1;

Which, barring any pipeline oddities, has exactly the same runtime as the pre-increment version.  It turns out there are very few real world circumstances where a similar compiler optimization is not possible, so there is practically zero reason to choose pre-increment for optimization reasons.  Standalone increments, such as in a for loop, are even easier to optimize down to the same instruction.

In other words, follow the coding convention unless it's syntactically significant.  But it doesn't hurt to educate your colleagues either if the only reason they don't use it is based on an erroneous understanding of how for loops work.


问:
Where do you use Java Channels?
I have only used Java Channels and BufferedOutputStream and the input counter part for reading and writing simple integers and some strings here and there to the file.

However I do not understand the use of all these classes when there is java.util.Scanner class that provides easy ways to read and write to the files.

Java veterans please tell me the use of Channels and Streams over Scanner.

答: You use Java Channels for applications that have much more traffic coming to them, not just for simple stuff. Same goes, (kind of) for buffered IO. If you're writing to a file, and you're using any considerable amount of output, then you're going to want to use a buffered IO driver. If you're reading from a file, and don't have to read that much information, use Scanner, otherwise, use buffered IO. </p>

Title: Where do you use Java Channels?


问:
How to communicate within a company what is being Continually Deployed
I work for a small development company, 20 people total in the entire company, 3 in actual development, and we've adopted CD for our commits to trunk, and it works great, from a code management and up-time side.  However - we're getting flak from our support staff and marketing department that they don't feel that they're getting enough lead time on new features and notifications on bug fixes that could change behavior.  Part of why we love the CD system is for us in development, it's fast, we fix the bug, add the quick feature, close the Bugz and move on with our day to the next item.

All members of our company are now on HipChat at all times, and when a deployment occurs, a message is sent to a room that all company members are in, letting them know what was just deployed (it just shows the commit messages from tip back to the last recorded deployment).  We in development are also attempting to make sure that when we're making a change that modifies the UI or a public facing behavior, we post a screenshot to the All Company room and explain what the behavior change is, seeking pushback or concerns.  Often, the response is silence.  Sometimes, it's a few minor questions, but nothing that need stop the deployment from happening.

What I'm wondering is how do other users of the CD method deal with notifications of new features and changes to areas of the company that are not development - and eventually on to customers in the world?

Thanks,

Francis

答:
The best way to keep everyone in the loop is to have a set production deployment day/time on a reoccurring basis. Then you can send out a notification to all affected employees a list of all changes that will be implemented with the next deployment. This should be sent out well in advance of the changes being deployed (I would say at least an 8hr notice for non break-fixes), and preferably at the same time every cycle so all users know when they have to look for upcoming changes. Asking users to be continually aware of a chat-room message or up to date on their email at all times every day is unreasonable.

On a side note it sounds like there is not staging/QA step in your process, if this is true you should add one, otherwise you are sitting on a time bomb.


问:
Service Layer - how broad should it be, and should it also be used from the local application?
The background:

I need to build a desktop application with some operations (CRUD and more) (=winforms), I need to make another application which will re-use some of the functions of the main application (=webforms). I'm using service layer for reusing my functions. The service is calling the functions on the BL layer (correct me if I'm doing this wrong).
so my desktop has 4 projects - DAL, BL, UI, WEBSERVICES.

The dilemma (simple but I still need some more experienced opinions):

In my main winform UI - should I call the functions from the BL - bl.getcustomers(), or do it similar to how I call it in the webform, and call the functions from the service - webservices.getcustomers?

Should I create a service for every single function on the BL even if I need some of the functions only in one UI? for example - should I create services for all the CRUD operations, even though I need to re-use only update operation in the webform?

YOUR HELP IS MUCH APPRECIATED

答:
If all your service is doing is a pass-through to the business layer, why not just use the business layer? If it's an internal app, then sharing libraries is quick, easy and relatively painless.

If not, then your service should focus on the publically visible operations the service supports. If it makes sense to have two different interfaces for the service (and thus two different contracts for consumers) then do that. The service exists as an encapsulation mechanism for the underlying implementation. Don't violate that.


问:
Getting URLs from search results
After 1 months research I basically give up on getting all URL's from a search results programmatically,

I looked at Google Search API to find a way to get millions of search results "URL's" to be specific to a text file or something relative but no success, but I am 100% there must be a way or trick of doing it.

Real Question :

Is there anyway programmatically or manually I can get 1000+ search results (URLs using search query e.g. "Apple" returns million of results on google and I want as much as possible URLs of them results in a text file)

Note :

Don't care for any specific search engine or programming language or technique or software or just point me to right direction, but yeah I tried it with google API i can't get more then 100 results at all.

答:
Here is an open source project that you could use to model what you want.  It is in Java, but the source looks well commented.

http://code.google.com/p/google-search-java-sdk/

Title: Getting URLs from search results


问:
"Do you have any questions for us?" In an interview
You know the prospective company fairly well but are asked "Do you have any questions for us?".  To show interest, what are some of your favorite questions to reply?</p>

答: The worst possible is "currently I have no such questions".. just ask any thing that demonstrates your interest in the company or the Job. Ask 2 or 3 such questions so that people feel that you are genuinely interested in joining the company.</p>


问:
How to Be a Software Engineer?
My problem is kind of weird so please bear with me.

I have been working in a start up concerned basically with mobile development since my graduation 2 years ago. I develop apps for iOS but it's not really relevant. The start up structure is simply founders > developers, with no middle-tier technical supervision or project management whatsoever.

A typical project cycle of ours is like this: meet with a client > send very vague requirements to an outsourced graphics designer > dig in development right after we get the design, no questions asked > then improvise improvise improvise! It's not that we are unaware that stuff like requirements analysis, UML, design patterns, source code control, testing, development methodologies... etc. exist, we just simply don't use them, and I mean like never.

The result is usually a clunk of hardly-maintainable yet working code. Despite everything we are literally flourishing with many successful apps on all platforms and bigger clients each project. The thing is, we want the chaos to stop and we're looking for advice.

How would you fix our company technically? Given that you can't hire project managers or team leaders just because we are barely 5 developers, so it wouldn't be a justified cost for the founders, but one-time things like courses, books, private training... etc is an option. Lastly, if it's relevant, we are based in Egypt.

Thank you a lot in advance.

答:
I have a start up background. What you are experiencing is highly typical, and despite what many say - if you are making enough money to survive, you are doing it right....for now. Your question is very valid, very relevant, and (assuming the start-up is about 2-3 years old, based on how long you have been there) very timely.

The most common failure time for a company is where you are now - at about 2-4 years, you need to transition to a small company from a start up. To avoid failure at this point,  one phase that comes to mind is "Speculative investment" Read up on it, understand it, and understand when you are doing it. (Spending more time coding than needed to get the job done is speculative investment.) I am not saying don't do it, I am saying understand when you are doing it and make a conscious decision that it is appropriate (or not) for today. Adding Unit Tests is a very good example.

The transition will require some changes, however, those changes must not jeopardize the finances. No point bringing in a BA, a PM, and "Manager of software" and all sorts of unproductive processes if it drives you bust. Evey thing you do must be done in the context "How can we make this happen today, and still be in business tomorrow"

One start up I worked for the team wrote software for a product. Four years later it was describe as a ball of mud/pile of S..., the worst code he had ever seen etc,  that should never have been released, by a new recruit. I pointed out to him the shareholders had just sold the company and put $50Million into their back pockets based on it. I asked him how he intended to make 50Mil in 4 years, and how "doing it right" would have helped - In fact, doing it right would have taken us 8 months, not 8 weeks, the cash reserves would have lasted 3 months, the competitors would have released into the market, and the company would have folded. I left and he became a team lead. They rewrote the code from scratch using "best practice" bla bla bla, the company now has less than 5% of market share, down for about 75%... revenues down from $250Mil to about $40mil.....

So here are my suggestions

keep "hacking" balls of mud.

Introduce Agile/SCRUM - but don't let it slow you down- do courses on this if nothing else.

Consider TDD and Unit testing. It will help keep on top of those balls of mud - careful - don't spend too much time on it or you won't be in business to reap the rewards

Perform DeBono's 6 Hats at the end of each project.

As you grow, be careful - be very very careful - who you bring in. You need people who have through the transition before. Do NOT recruit big company types.

read this - I particularly like "And there's another factor involved, which is that you can divide our industry into two kinds of people: those who want to go work for a company to make it successful, and those who want to go work for a successful company. Netscape's early success and rapid growth caused us to stop getting the former and start getting the latter. "

Title: How to Be a Software Engineer?


答:
When I've worked with companies that were very ad hoc in methodology, we looked at the top two or three process or infrastructure issues that mattered "right now" and started investing time in them alongside our normal commitments.

I don't think traditional "software engineering" is necessarily the right model for a small team that's dealing with frequently changing business requirements; software engineering is more important for dealing with multiple vendors and situations where change is very expensive and needs risk and quality gates. If you're building software for space shuttle parts or cars, the software engineering approach may make sense.

Instead, I advocate a "software craftsmanship" approach for most organizations. But software engineering has created tools and discovered processes that work for lots of kinds of teams, so I am not saying that you should ignore those lessons, just that you should work from a different perspective that's more about continuous improvement, dealing with ambiguity and change, and taking a couple of hours every month or so to do retrospectives on what's working well and what's not working well with your development and business processes.

In your shoes, I'd say you can probably not worry about UML for now; you need to focus on getting a lightweight version control system into place. Just start with Git or Mercurial, and either sign up for private repositories with a third party vendor to push your repositories to (Bitbucket, Github), or set up a local server to push to.

Then worry about setting up a continuous build system (like Jenkins).

Small teams may not be able to afford full time testers, but they can start building automated unit test coverage; even starting this practice without religiously adhering to any particular methodological dogma may help you start writing new code in a more maintainable state, because you'll get annoyed enough by any friction in writing tests that you'll either want to fix your code or give up testing. If you've got the other stuff in place, and you start to get even the slightest value out of testing, you'll probably prefer to fix your code rather than give up testing.

You can do this on your own by just investing time in it. It may be worthwhile to hire a person to work on either your infrastructure or process problems, but the three items above are usually low hanging fruit that will show immediate returns and require relatively minimal investment.

As for books, read the Pragmatic Programmer, Software Craftsmanship: The New Imperative, and any of the books available on distributed version control and continuous integration. You should evaluate Extreme Programming, Scrum, and Kanban to see what you think will work best for your team . To get better at process, attend local meetups or events with other small software shops and talk about what's working and not working for you, and get better ideas from your peers on how to cope with high velocity with small teams. Software Engineering isn't really about maintaining velocity, it's about maintaining control of things that interact with your product.

Once you have a 5 person team, though, some sort of process management help makes financial sense for most organizations. Hiring a program manager or ScrumMaster or something along those lines will have some value to your founders if it will help you deliver work more consistently and predictably.

Title: How to Be a Software Engineer?

Body:
My problem is kind of weird so please bear with me.

I have been working in a start up concerned basically with mobile development since my graduation 2 years ago. I develop apps for iOS but it's not really relevant. The start up structure is simply founders > developers, with no middle-tier technical supervision or project management whatsoever.

A typical project cycle of ours is like this: meet with a client > send very vague requirements to an outsourced graphics designer > dig in development right after we get the design, no questions asked > then improvise improvise improvise! It's not that we are unaware that stuff like requirements analysis, UML, design patterns, source code control, testing, development methodologies... etc. exist, we just simply don't use them, and I mean like never.

The result is usually a clunk of hardly-maintainable yet working code. Despite everything we are literally flourishing with many successful apps on all platforms and bigger clients each project. The thing is, we want the chaos to stop and we're looking for advice.

How would you fix our company technically? Given that you can't hire project managers or team leaders just because we are barely 5 developers, so it wouldn't be a justified cost for the founders, but one-time things like courses, books, private training... etc is an option. Lastly, if it's relevant, we are based in Egypt.

Thank you a lot in advance.


问:
I have an MIS degree. How do I sell myself as a programmer?
So, I graduated with a BSBA in Management Information Systems with honors almost 2 years ago which is more of a business degree.  As of right now, I do have a job title of "Programmer", but it's more of a report writing position in an arbitrary, proprietary language called PowerOn with the occasional interesting project using more mainstream technologies like .Net and Java.  I am also somewhat isoloated being the only programmer in the workplace, which I beleive is a detriment to my career path.  The only people I have to bounce ideas against are those on the various SE sites.

I don't regret going MIS, but over the past couple of years I have discovered my passion for coding, even though I have been doing some form of coding profesionally and as an enthusiast for years.  I do want to persue my Masters in CS (at a later time), but I am not sure if I necessarily need a CS degree to get in with a team of programmers.  In addition, I do have a number classes I have taken for different laguanges on the way (C++, Java, SQL, and VB.Net)  I beleive my strength is in problem solving where code is just a tool to tackling to problem if needed.

My question:  How do I best sell myself as a programmer?  Should I continue pounding out reports and wait till I have my masters in CS?  Or am I viable to be a programmer as I stand?

答:
You have a degree with honors - you have proved that you are not a twit and can learn. You also have skills sadly lacking in many companies. How I would approach this is fill in my resume, and start applying for junior programmer jobs. </p>

<p>While waiting, read up on a language that is most commonly advertised in your town - usually Java or C#, and start coding something useful in it. Ideally find something at work that needs to be done and do that. </p>

Body:
You have a degree with honors - you have proved that you are not a twit and can learn. You also have skills sadly lacking in many companies. How I would approach this is fill in my resume, and start applying for junior programmer jobs.

While waiting, read up on a language that is most commonly advertised in your town - usually Java or C#, and start coding something useful in it. Ideally find something at work that needs to be done and do that.


答:
You are actually on a right direction to see all the shortcomings of the software development process that is followed in your company. Fixing this software and becoming more reliable, testable and maintainable will NOT happen overnight. You can achieve it gradually, step-by-step.

You may start to discuss this with colleges about what can be improved through introduction of proper  SDLC   and the ways how to gradually achieve it. For sure, it will take time and will to make this happen. However, sooner you start better for yourself :)

Title: How to Be a Software Engineer?


问:
Methods for systematically researching technologies to use in a project?
If I want to recommend a technology/plugin/library to my company for use in a project, are there any methodologies I can use that will produce more reliable results and a more convincing presentation of said results than just my own "common sense" approach?</p>

答:
Yes.

Dogfood the candidate technology/library/plugin(s) with plausible use cases for your application.

Plot your experience with the candidate technology/library/plugin(s) on a spreadsheet, and note performance, scalability, extensibility, cost, and anything else that your company finds useful.

Finally, schedule a half hour meeting with your manager to relay your findings. The strongest candidates should almost be self-evident.


答:
Rather vague question with a lot of possible answers. But here's my take.

First you need to be clear about why you want to bring in this new tech. So:

What is the problem that exists?

How does this tech fix it?

What are the benefits to the company?

and what are the risks?

Once you have some clear answers to these questions, you can put together your presentation. Then it simple comes down to good presentation techniques. Some that I follow:

Keep slides and detailed reading material separate. Slides show be simple and visual back up for you as a presenter, the details should be in the reading material people can take away to read later.

Remember to tell a story, people are there to see you, to find out what the problem is and how you will solve it, and even to be entertained to a degree. Keep this in mind.

Speak out, not to fast, and not in a m-o-n-o-t-o-n-e. Keep what you are saying simple, so don't bore people with technical details unless they are really important.

Most people who come to a presentation don't really care about the technical details, they want to see that you are confident, knowledgable and fluent in the problem domain. Once they see that, they will trust your assessment and probably never read the details.

Title: Methods for systematically researching technologies to use in a project?

Body: If I want to recommend a technology/plugin/library to my company for use in a project, are there any methodologies I can use that will produce more reliable results and a more convincing presentation of said results than just my own "common sense" approach?</p>


问:
Game programming : C# or C++?
I've decided what I really want is to do game programming. So the question is, as a 18 years old who wants to learn self taught programming, what is the most suited programming language between C# and C++? (I should state that I don't care about Unix because I believe windows will be still the most used OS)

I know the basics of C++, but none about C#. I know that C++ has more tutorials guides, dlls and stuff like that, while C# doesn't, but it's far easier to learn and to use for a single person to develop a program, but I've read even if the program is obfuscated it's easy to get the source of it.

Well, I kinda want to focus on basic a lot first, I must say that I have a preference for C++ just because it feels more suitable to me, but I must consider that I work alone. So even if I like it, it may not be the best thing to do.

I am really not sure of which one to go for, I've read a lot of threads on various websites and it looks like C# is becoming more popular than C++. But yeah, that said, I also specified I want to do game programming. So I need to know some better points than just "C# is easier because of .net memory handling while C++ isn't" because I couldn't just find it.

答: I would vote C++ - primarily because it can be cross-platform (depending on how you write your code, of course) and also because I think it gives you more knowledge about memory management - because you need to care about it. But since you don't care about linux/unix, if you want to leave the memory complexity out for the moment, why not focus in C# right now and then learn C++ too?

Title: Game programming : C# or C++?


答:
I feel your pain. I went through the same discovery process over this decision and decided to write about it- hoping to connect with like-minded people.

I have taken a semester off to study web development (technical) and returned to Commerce to major in MIS. Having the perspective and experience with real life software development has provided me with a extremely real appreciation for all those charts you learn doing MIS. This stuff is super powerful.

I think you will find yourself in very high demand in any new venture / tech startup company  if not in a larger firm. Look for 'incubators' and 'accelerators' in your community and they will connect you with people that are thirsting for your perspective and skills.

Michael


问:
What am I missing about PHP?
It's like this mythical thing that a dominating portion of developers say is just the best option for back-end development, a part of development about which I know virtually nothing beyond the absolute basics.

So I've looked up PHP tutorials a bunch of times, trying to figure out why it's so powerful and common, but it's annoying as hell-- all the tutorials treat you like a new programmer. You know, this is how you make an If Else statement, here's a for loop, etc. The "Advanced Topics" show you how to make POST and GET statements and whatnot.

But there must be more to it! I don't get it! That's practically no different from JavaScript. What am I missing about this language? What else can it do? Where's the power and versatility? I've heard it called a function soup; where are all the functions?

Please chide me. I'm clearly missing something.

答:
A number of reasons:-

Shallow learning curve. Its easy for beginners to write a simple working web site.

Pricing. Its really free as in beer.

Freedom. Its truly open source, this encourges a large development community.

Packaging. The projects such as XAMP provide a complete working web server and development environment will all the libraries, databases and tools most developers will ever need.

While there are features that annoy CS graduates the language is actually pretty nice to work with.

Focus. The language developers, the library integrators, almost everybody involved in what is a very, very large development community has a single focus -- build a working web application with the least effort.

Documentation. The documentation/wiki on the PHP web site is probably the best example of how to do on-line documentation. Well organized, searchable and full of user provided samples and hints.

Title: What am I missing about PHP?


答:
Your problem isn't one of communication of changes and isn't one of a poor execution of CD, it is fundamentally a problem of the current structure of your company, and one of developer fanaticism.

Organizations that LIKE Continual Delivery

Much like with people, companies can lean Conservative and Liberal.  No I am not talking politics, just a fundamental way that day to day business is viewed and looked at.  Liberal companies tend to be open to communication and the inflow of information.  They thrive on it.  They are more excited about change and see adaptability as opportunity.  They tend not to care for following strict processes and can suffer from wild swings in stability and solvency.

Companies that are more conservative are very good at having a specific business objective in mind and achieving their goals in a careful methodical process driven way.  Rapid influx of information can be daunting and sometimes threatening.  Stability and predictability are more important than being cutting edge and experiencing the latest and greatest.  They are good at finding a niche and tenaciously protecting their market positions.  They tend to be more stable and consistent in performance.

Liberal companies like startups that are getting off the ground are much more interested in Continual Delivery because it gives them the latest information about progress immediately.  They don't have a stable source of funding and fierce competition means that time can be even more valuable than money.  Continual Delivery ensures that there is no wasted time from the business perspective when the opportunities for growth are endless.

Conservative companies will ignore CD at best and be annoyed or threatened by it at worst.  Their management culture formed as a result of a successful business venture that ensures a steady stream of income.  They frown on unnecessary change as it could be risky, introduce new bugs, and the benefit can sometimes be null.  It may not matter if the user is any happier with your new features if you already have the users company locked into a service agreement or contract.  The money is separate from the quality of the software at this point.

Your company doesn't seem to understand it because perhaps their business model and customer base lend them to lean conservative and fear the constant change that is implied by CD.

Developer Fanaticism and missing the big picture

They may not understand why you even are motivated to achieve this, and to be honest I don't either.

Is it something that you wanted to pad your CV with?

Is it a misguided attempt to organically change the culture of the company from within?

Is there a specific misunderstanding or tension between Customer Support and Development that you are hoping to solve?

This you will have to figure out for yourself.  Ultimately though I come to these conclusions about your company by the fact that it seems the Developer Group in your organization needs to "win over" Customer Support on this thing.  In a Developer centric organization that is open to change, opportunity and continuous improvement, the Developer group will set the rules and standards and customer support will have to adapt to you.

In the end I am not saying that CD is a bad thing by any means, but it won't benefit your organization.  Customer support would ideally be happy to do nothing but order bug fixes from the Developer group as needed like the drive-thru at a fast food restaurant.

Title: How to communicate within a company what is being Continually Deployed

Body:
I work for a small development company, 20 people total in the entire company, 3 in actual development, and we've adopted CD for our commits to trunk, and it works great, from a code management and up-time side.  However - we're getting flak from our support staff and marketing department that they don't feel that they're getting enough lead time on new features and notifications on bug fixes that could change behavior.  Part of why we love the CD system is for us in development, it's fast, we fix the bug, add the quick feature, close the Bugz and move on with our day to the next item.

All members of our company are now on HipChat at all times, and when a deployment occurs, a message is sent to a room that all company members are in, letting them know what was just deployed (it just shows the commit messages from tip back to the last recorded deployment).  We in development are also attempting to make sure that when we're making a change that modifies the UI or a public facing behavior, we post a screenshot to the All Company room and explain what the behavior change is, seeking pushback or concerns.  Often, the response is silence.  Sometimes, it's a few minor questions, but nothing that need stop the deployment from happening.

What I'm wondering is how do other users of the CD method deal with notifications of new features and changes to areas of the company that are not development - and eventually on to customers in the world?

Thanks,

Francis


答:
I would say that depends upon exactly what you mean by "style preference".  If you mean that you want to use "++i" everywhere including loops like for(i=0; i<x; ++i), then that's fine.  If on the other hand you want to specifically use it in loops while elsewhere using i++ or i+=1 (or viceversa) then that's a terrible idea, you should be consistent through-out the program.

As long as you are consistent and aren't using it in a comparision expression or multiple times in a method call, this should not be a suprise to anyone.  In particular the for loop is

Assignment

Comparison

Body, if, true, and Finally

Increment

As long as you aren't doing your increment in either 1, 2 or 3, there should be no surpise.

On the other hand, if you sometime use post increment and sometimes pre increment, or do it in a non standard manner f(i++, ++i);, then you're going to give someone pause, and you're likely to make a mistake yourself or lead someone else into making a mistake.

Note that if you do choose ++i, I would recommend that you Never do this if(++i<x)...

Title: Using prefix incremented loops in C#


问:
Finding Database issue for iphone app
I know this is a dumb question and it might not be "conceptual" but, as a self-starter I really want to know how to get connected to some sort of "commercial database"?

I'm designing a local gas station utility app for iphone and ipad. I have absolutely no clue how to find a relevant database. For example, if I want to make an app for pizza ordering in the great Chicago area. How do I get info (price, menu, location, etc.) of those pizza stores scattered all over Chicago?

Can any one shed some light on this for me?

答:
Ok, Here is the secret Truth about It...

The Data in your app in worth more than the App it self!

The reason you can't find that data is because it has value, more value than any set of code accessing it, it would be cheaper to buy the Code base to seamless web  than to buy it's database of restaurant, menus and pricing.

You will just have to build your DB the old fashion way, sorry.

Ps : I am not Drunk as i write this..

PPS: Please pardon Typos, I am Drunk while typing this

PPPS: It's ok that i am Drunk, I am at home, on My Couch watching Big Bang Theory, not at work.

PPPS: Sorry forgiving away a well kept industry secret.

Title: Finding Database issue for iphone app


答:
I'd say that it depends on exactly what type of data you're trying to get access to. Using the example you provided (pizza), I'd say that using something like the Yelp APIs would prolly be up your alley, but I could be mistaken.

Long story short, consider the type of information you're considering, find well-established apps/companies that already dabble in that, and then search " APIs" or something similar.

Title: Finding Database issue for iphone app

Body:
I know this is a dumb question and it might not be "conceptual" but, as a self-starter I really want to know how to get connected to some sort of "commercial database"?

I'm designing a local gas station utility app for iphone and ipad. I have absolutely no clue how to find a relevant database. For example, if I want to make an app for pizza ordering in the great Chicago area. How do I get info (price, menu, location, etc.) of those pizza stores scattered all over Chicago?

Can any one shed some light on this for me?


问:
What are the fundamental differences between C and C++?
Many tend to write "C/C++", as if they were the same thing. Although they share many similarities, they are clearly not the same.

But what are really the fundamental differences between C and C++? Is C++ an enhanced version of C, or are there features in C which do not exist in C++?

答: Personally, I think that templates are the most significant feature that C++ adds to C. </p>