title: How to learn C in two days (if I already know C++)?

text: I've been programming in C++ for a few years, and I've done a school project or two in C (as well as several other languages). However, I don't know C very well at all. I have a programming interview in two days, and I just realized that this interview will be in C. How do I approach this? How do I learn C well enough to succeed in a programming interview? This job is not looking for a "C expert" or anything like that, so I think they'll be somewhat understanding if I explain that I have not programmed much in C. They just choose to host their interviews in C. Buying and reading a textbook is not feasible, so my resources will have to be on the internet.


title: Chrome extensions every programmer should know

text: I just switched from Firefox to Chrome, so what I wanna know: Are there any Chrome Extensions which are indispensable for a programmer?


title: Describing requirements in SRS - use cases?

text: I do not have the access to the IEEE standard and information on the net are contradictory. Can I capture user requirements in SRS using use cases? Or I should keep use cases separate as they are more like scenarios than separate requirements?


title: Summarize terms of service?

text: What's your opinion on summarizing the ToS?   Example:               [ToS here]     Basically, it means you won't sue me.     [I accept][I don't accept]      Is this good practice or will this just get you sued more?


title: How: Personal life of a Software Developer

text: have just graduated and am looking for job in the field of Software Development. Since, I like to go with application developments. Well, being a Software Engineer; Can able to survive personal family life. I am single :) Once I get married. Will I able to spend time with my wife and kids? I see, nowadays many Software Specialists are not returning to home at nights. due to the workload. That makes their wife to scary about in someways. How the understandings will go? How do you compromise your personal life?


title: Do you need to meet personally to collaborate effectively?

text: If you are starting up a web, mobile, or standalone application, how well must you know the rest of your collaboration team? Would it be a bad idea to ever work with someone unless I've met him personally? Is it okay to sometimes accept small public contributions such as code snippets and artwork without meeting the contributor? Should I ever actively collaborate with people online that I have not met, as long as the person has a detailed profile and a good reputation. If you do collaborate online, what tools do you to build teams and find contributors? If not, would you consider the idea if there was a safe medium? Any other input on the subject would be appreciated.


title: Re-gaining confidence of senior programmer

text: My boss found out I'm not as smart as he thought. An example from my experience: I'm a junior programmer, and I work in a team of two, my boss (senior programmer) and myself. I was tasked with developing an internal web-application for the company we work at. I wrote the back-end to the front-end (the database design was in already place and the server technology had been chosen). He would periodically check on my progress by observing the web-application in action and was happy with out it was coming along. When I finished the web-app he was pleased with how well the end-product turned out. A few days ago he became interested in the code so I told him what technologies I used (for the front-end), and this is where it went south. For the front-end of the web-app I used a Javascript framework (Backbone.js). When asked why I would do such a thing. My response was because that I felt that the framework fit into this app quite well, and would help me structure the code better than if I wrote it from scratch...."Well, that's dis-heartening" was his response. So given this example my question is: If your a senior programmer and have lost confidence in the ability of your junior programmer, what would you like to see from your junior to gain the confidence back? **EDIT** : Thank you everyone for the great answers and supportive feedback!


title: What is the C++ convention, if any, for naming to differentiate between structure types and other types?

text: In general, should I use some sort of convention for structure names which is distinct from other type name? I was thinking about this when my professor started talking about structures. I had the following discussion with myself, and since I do not want to come to any unreliable conclusions. How would you answer the question(s) and which answer(s) are untrustworthy? Q: Should I distinguish structure names and type names to make the code more clear? A: A structure is a type, so there doesn't need to be a distinction. RE: Q: So there is never a case when someone uses `typedef int SOMETYPE` to rename a built-in type to make the code more flexible? RE: A: There is no practical reason to rename built-in types. Actually, defining `int` types as `SOMETYPE` makes the code less readable because someone reading the code will not know the built-in type used for that type. Honestly I do not trust either answer. Looking at some of the base structure in a new Win32Project using Visual Studio, I see things like `typedef short HFILE;` which, I guess, makes it more clear to the programmer what the variable is used for. Perhaps that is too subjective however. As an aside, how does one usually determine what is going on when they come across variable declarations which use types you have never seen before. Do you just rely on the IDE to take you to or display the declaration?


title: Is making my own copyright licence safe?

text: I've seen various open source libraries (actually I've seen it for assets as well) having a home-baked license in the following manner : > SomeGuy's License:   > 1\. You can use this code freely in commercial projects and modify it as you > wish, but not sell it   > 2\. If you want to sell a modified version, drop me an email first, or give > credits to me Edit: The above example is ambiguous, so I am giving another one, I want to know if 3 lines of license will hold some ground: > SomeGuy's License:   > 1\. You can use this code in a commercial project as a 3rd party library   > 2\. You can't sell it as a derivative work I know that such license is not polished at all, for example the Creative Commons set of licenses seem to be short, but actually have some large legal stuff underneath it, but I wonder if at least some level of protection can be gained with a hobby license like that ? My question is, **could this hold any ground in the court** , or would the corporative lawyers of the company X tear it apart ?


title: Ruby isn't a PHP generator, right?

text: My boss was looking down on me about learning Ruby because "It's just a PHP generator" which I can't find anything about it being so. Is this the case? I understand that the Rails framework can be used to generate PHP code, but isn't Ruby in-and-of-itself its own programming language?


title: What is Script Binding, and How is it done?

text: I have heard such thing as Script Binding - binding Javascript or lua with API's from C++ or Objective-C. I want to know more about it- however Google has strangely proven unuseful for this. How is it done? - it OK if I get pointed to other sources, but, just how? I never knew a Scripts jitter could interact with compiled libraries.


title: Improve coding quality

text: I have been dealing with programming for several years now (I am still a student but with a lot of internships). Mostly working with C++, Python and MATLAB, I noticed that whenever I download an SDK or a library from Internet/GitHub and look inside, the code is much more complex than mine, using error catches everywhere and other things that would never come to my mind while writing my own code. My question is, how can I learn or practice this kind of things? From my experience, no programming course talked about coding style, when and how to use try/catch efficiently, how to debug faster etc... I am also not thinking about using mutex while accessing one variable from different functions at the same time because my code is simply working without them and I didn't face any problem until now. Currently I am working on a project using Python and Pycharm is helping me a lot keeping a correct coding style but it is limited to the syntax and naming conventions.


title: Which software licenses should I be aware of?

text: Licensing is something that I really haven't paid any attention to; I guess I felt there was no need. However I can't but help thinking that I should. So which are the most common licenses that I, as a programmer, should be aware of? Also, it would be helpful if you could include a brief description of each provided.


title: Are there any programming languages understood by all operating systems, if so what?

text: I'm curious if there's a programming language that you can write code for all operating systems in, and if so what language that might be? I'm guessing something very low-level like Binary could do this, but am not sure.


title: Should developers be worried about automation that make them redundant eventually?

text: Should developers be worried about possible automation happening in their projects that might make them redundant ? I never particularly worried about this myself but I have seen many developers worrying about it, even if they don't admit this openly. There is a fear that if you automate most of the aspects of a system that you are handling it might make you redundant eventually. I myself had an experience on this. 1 year back I had started working in a project were any requirement/change request that came, the only deliverable was a bunch of insert queries. That team had 2 developers and 1 tester working on it (all on shore). The only thing that the developer had to do would be to configure the insert queries based on the requirements. When I came to work on it, I immediately suggested to build a web application that would enable the business people to do it directly. Every thing would be configured in the web application including error reports in case anything went wrong. Needless to say my manager loved the idea but it never passed through with the higher management. The logic for that was until the client comes up with such a requirement it should never be done as it will involve future losses for the company and possibly loss of employment of the employees currently handling it. So should a developer be concerned about this ?I would certainly like to believe that > If you don't take care of your customer some one else will but experience tells me otherwise.


title: Handling invoices with timestamps

text: I'm currently going to write something to **automatically create invoices** with cronjobs by using PHP and timestamps. I have a, for me, **well-considered idea** of how to solve it, but I want to ask the community **if someone may see errors in reasoning** and **possible problems with my solution**. I'm trying to describe my idea as detailed as possible so everyone can follow my way of thinking: In General there are **4 types of invoices** :   1. Paid yearly   2. Paid semiyearly   3. Paid quarterly   4. Paid monthly **Purchased products are saved in a SQL database** with the billing cycle:   * ID of User   * Product ID   * Billing Cycle   * Last Due Date Now there is a cronjob that runs once a day to check if it should create a new invoice for each purchased product. In the row `Last Due Date` I save the timestamp of the first date to pay when it's created. A code I already wrote calculates the **time that has gone by** since the `Last Due Date` timestamp and outputs something like this:   * Timestamp is in past or in future   * Month gone by   * Days gone by Now my **rules for creating a new invoice** are:   1. **Paid yearly** if ( Timestamp is in past = true AND Month gone by = **11** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() )   2. **Paid semiyearly** if ( Timestamp is in past = true AND Month gone by = **5** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() )   3. **Paid quarterly** if ( Timestamp is in past = true AND Month gone by = **3** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() )   4. **Paid monthly** if ( Timestamp is in past = true AND Month gone by = **0** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() ) As you can see a new **invoice would be created ~10 days before date of payment** and the timestamp in `Last Due Date` is set to the current time, so when the cronjob checks back the next day no invoice will be created for this purchased product. My question is **if this is an appropriate way of solving** this and if you can **see any errors in reasoning or problems that may occur**?


title: Resources for C/C++ security (whitehat) hacking

text: I'm currently working as a C++ developer in a software security department, but not as a researcher or whitehat hacker. Security is an interest of mine, mainly in the areas where I can exploit code or reverse engineer executables/communication/protocols. I've done some work in reverse engineering but only as a hobby (ie. modifying a saved game file for a game). As a person that knows C, C++ and some assembly (MASM), what types of resources would you recommend that I read so that I may gain more knowledge about these fields? Books, blogs, and articles would probably be best. Currently I'm reading 24 Deadly Sins of Software Security: Programming Flaws and How to Fix Them.


title: What would be a good name of practices you don't (usually) learn at university?

text: I'm preparing a course dedicated to fresh graduated CS students. I have to name it. Is there an English word or sentence to define all the practices you don't learn at college/university? Here are a (partial) list of things are not teach to most students I interview or talk with:   * Unit Testing + mocking   * Design Patterns   * Agility (such as Scrum or Extreme Programming)   * DRY, YAGNI, SOLID, DIP, KISS, ...   * Source Control, DVCS, ... I once heard "Software Industrialization Practices" (literally translated from French), and while it sounded great in French, I'm not sure it does in English.


title: What should be "D" for a good unit test?

text: I'm trying to introduce what is unit testing, and how to write good unit test to a friend. I think it's better if I give him some principles for a good unit test, and suddenly I remember about "ACID" properties of transaction: **A** \- atomic: a unit test should test only one thing **C** \- consistent: a unit test, if passed, should pass thousand times, whenever you run it, so it should not depend on external things, such as network, database... **I** \- independent: a unit test, should be independent from others, therefore, you can run unit tests in every order, without changing the result. But i get a bit stuck with "D" - durable. Durable unit test? It makes no sense. Any suggestion about this D? Thank you.


title: Use of the word "glitch"

text: I find myself talking about computers with a lot of non-tech people, who often use the word "glitch" to describe an undesirable outcome of a program or operating system(of course, never Linux!). I have never heard another programmer use the word "glitch" and hearing it makes me think the user has no idea what they are talking about. SO my question: Do you use the word glitch in everyday, technical conversation, if not, does its use imply to you ignorance and lack understanding?


title: emacs - project explorer and auto complete features - is it available?

text: I know that Emacs is a very powerful editor out there. I try to use it occasionally and want to learn it better. But to learn it better i have to use it more frequently than I am using now. But one big obstacle is that I could not find the basic properties like a project auto completion. Maybe I am lazy but I dont want to write again and again the same long method names. Another one is go to definition stuff, I want to see the real declaration of any class or method or even a variable. Also I know that it can handle the make files but an actual representation of a project alongside the editor would be very good. So, what I am asking is, is there a way to provide these options in Emacs? Or is there an extended version of Emacs that supports these features?


title: How will closures in Java impact the Java Community?

text: It is one of the most talked about features planned for Java: Closures. Many of us have been longing for them. Some of us (including I) have grown a bit impatient and have turned to scripting languages to fill the void. But, once closures have finally arrived to Java: how will they effect the Java Community? Will the advancement of VM-targetted scripting languages slow to a crawl, stay the same, or acclerate? Will people flock to the new closure syntax, thus turning Java code-bases all-around into more functionally structured implementations? Will we only see closures sprinkled in Java throughout? What will be the effect on tool/IDE support? How about performance? And finally, what will it mean for Java's continued adoption, as a language, compared with other languages that are rising in popularity? To provide an example of one of the latest proposed Java Closure syntax specs:               public interface StringOperation {        String invoke(String s);     }          // ...          (new StringOperation() {        public invoke(String s) {            new StringBuilder(s).reverse().toString();            }     }).invoke("abcd");          would become ...               String reversed = {          String s =>          new StringBuilder(s).reverse().toString()       }.invoke("abcd");      [source: http://tronicek.blogspot.com/2007/12/closures-closure-is-form-of- anonymous_28.html]


title: Unit test SHA256 wrapper queries

text: I have the following SHA256 wrapper.                   public static string SHA256(string plainText)         {             StringBuilder sb = new StringBuilder();                  SHA256CryptoServiceProvider provider = new SHA256CryptoServiceProvider();             var hashedBytes = provider.ComputeHash(Encoding.UTF8.GetBytes(plainText));                  for (int i = 0; i < hashedBytes.Length; i++)             {                 sb.Append(hashedBytes[i].ToString("x2").ToLower());             }                  return sb.ToString();         }      Do I want to be testing it? If so, what do you recommend? My thought process is as follows:   1. What logic is there here.   2. The answer is my for loop and `ToString("x2"`) so from my understanding I want to be testing this part? I can assume `Encoding.UTF8.GetBytes(plainText`) works. Correct assumption? I can assume `SHA256CryptoServiceProvider.ComputeHash()` works. Correct assumption? I want to be only testing my logic. In this case is limited to the printing of hex encoded hash. Correct? Thanks. EDIT: Update method based on MainMa's excellent answer:                   /// <summary>         /// Returns a SHA256 hash of the plain text.         /// </summary>         /// <param name="plainText">The pain text.</param>         /// <returns>The hash.</returns>         public static string SHA256(string plainText)         {             if (string.IsNullOrWhiteSpace(plainText)) throw new ArgumentNullException("The plain text cannot be empty.");                  StringBuilder sb = new StringBuilder();                  Byte[] hashedBytes;             using (SHA256CryptoServiceProvider sha256Provider = new SHA256CryptoServiceProvider())             {                 hashedBytes = sha256Provider.ComputeHash(Encoding.UTF8.GetBytes(plainText));             }                  foreach(Byte b in hashedBytes)             {                 sb.Append(b.ToString("x2").ToLower(CultureInfo.InvariantCulture));             }                  return sb.ToString();         }


title: Acceptance tests for large multi-step online form

text: I have to extend/fix a large online form written by other developer. There is a lot of code, mixing PHP and JS. It's kind of write-only style of coding and I want to redo it completely, but currently I can't. It works like this:   * It is a wizard-style form with 12 steps - let's call them _phases_ to not confuse with steps of the tests.   * User has to fill at least ~100 fields to finish.   * Some fields are grouped by 3-5. Those groups can be dynamically added and removed with JS.   * Validation is done after submitting each phase. If some errors occured, user is notified immediately and cannot go further until he/she fixes all errors.   * Submitted data is temporarily stored in the session between phases. No permanent storage.   * User cannot skip phases, only sequentially go back and forth to already completed phases. It is ridiculous to test this thing manually, so I wrote a test using Behat with Mink and Selenium2. I have only 1 test now, which completes all 12 phases of the form. To go to specific point in the process of filling the form, I created a step definition wich just makes webdriver wait 1 hour (laugh at me). When I need to test some specific phase, I just add this step where I want Selenium to stop - this leaves browser window open so I can do whatever I want manually without having to fill all previous fields. It saves a ton of time, but feels stupid. I have reasons to do that:   * Has to be done ASAP.   * I cannot test each separate step in the form.   * I cannot reuse parts of the filling process without having to write quite a lot of PHP code. Now my test is just ~120 lines written in Gherkin language. Simplified version of my question is: **how should I test this?** I can think of several ways:   * Modify the code to allow skipping phases. This can be done safely by detecting environment parameters withing the application and deciding whether client (webdriver or user) can or cannot skip phases, so skipping is not allowed in a production environment.   * Just write more tests with a lot of copy-pasting and be a bigger monkey.   * Write step definitions to complete specific phases separately. So, I could just write               When I complete phase 1     And complete phase 2     And complete phase 3     ...      in the tests. So, the full version of my question is: **which way is preferable and what (dis)advantages each way has?** Maybe there are other ways, like designing an application in a completely different way so there are no such problems.


title: Is there ever a reasonable time to have test fixtures test MVC3 controller construction?

text: I've recently started with a new firm and I'm trying to understand the mechanics behind something, so I'll anonymize the code and present but a sample:               [Test(Description = "Retreives the New view for XXXX.")]     public void New()     {       "~/XXXX/New".ShouldMapTo<XXXXController>(x => x.New());       "~/XXXX/New".WithMethod(HttpVerbs.Post).ShouldMapTo<XXXXController>(x => x.New(null));     }      and again:               [Test(Description = "Test the model injection into the New view.")]     public void New()     {       var @new = WXYZController.New();       @new.AssertViewRendered();            Assert.IsInstanceOf<WXYZSettingsModel>(@new.ViewData.Model, "Expected the data model to be of type WXYZSettingsModel, but the model was another type.");       var model = @new.ViewData.Model as WXYZSettingsModel;       if (model == null)         Assert.Fail("Failed to cast data model to type WXYZSettingsModel.");              Assert.IsNotNull(model.YYYY, "Expected an instantiated service message, but a null message was returned.");         Assert.AreEqual(model.YYYY.Status, WXYZ.Success, "Expected a success status code, but another code was returned.");         Assert.IsNotNull(model.Categories, "");         Assert.AreEqual(model.ZZZZ.Status, ABCD.Success, "Expected a success status code, but another code was returned.");     }      It seems to me this violates the purpose of unit-testing, as you should never unit-test the framework, but rather, your own code, right? Did someone just get carried away? Or am I missing some fundamental component of this code that is just obvious to someone who is more familiar with unit testing. Note that there are entire files (one of each of the above per controller) that never test a single line of internal code, but are filled with these tests. Even to the point of this is fairly boilerplate now that I've anonymized it. If we were instead testing like this (pseudocode now)               [Test(Description = "thingy tester, duh")]     public void ThingTest(){       var mock = new MyDataMock();       var finalMock = new MyFinalMock();       var controller = new thingController();            var test = controller.Thing(mock);       assert.AreNotEqual(test,mock,"It didn't change it");       assert.AreEqual(test,finalMock,"It worked!");     }      I would expect that to be what the unit tests I should see should look like, no?


title: Which Ext JS license should be acquired (when developing a Spring MVC/Hibernate/Ext JS web application)?

text: I am inquiring about a web app which uses _Spring MVC_ and hibernate on the server and _ExtJS 4_ (Sencha JavaScript framework) for the client framework (widgets). The app is cloud-hosted - it is not "distributed" to users. It is required that users of the app shall need to purchase a license from the vendor in order to use it. I am completely new to software licensing and am not sure which ExtJS license is required/preferable, i.e the commercial license or the GNU GPL license? I have a few questions to hopefully help clarify:   1. Is it possible to use the GPL license or similar allowing only part of the app's source to be distributable, e.g. the Extjs components, but not allow users to see other components of the system? i.e. the _Spring MVC_ , hibernate server components? Is it possible to restrict access to the _ExtJS_ source if using a GPL license? In general is it possible to restrict distribution of some aspects of the source when using GPL?   2. If the GPL license is acquired, is the source available only to users of the system or is it open to the whole general public?


title: Identity Design ASP.NET

text: I am trying to design a system with the below features, and am currently trying to figure out best way to handle Identity :   1. There will be multiple decoupled parts of the system, with same customers accessing various parts    2. I would like users organized by organizations/companies, i.e. user1 & user2 belong to ORG1   3. I would like additional info to be stored within a user profile, info will originate from various systems, as well as global info such as address, etc   4. For roles I haven't yet decided whether or not they will be handled by individual apps or globally and specialized in certain apps  My conundrum is whether to use the new MVC Identity released in ASP.NET Beta currently out, or use WIF or Active Directory. I am assuming that a centralized application handling users & their associated admin tasks and then federating to other applications is best. If I understand correctly any of the 3 are able to do that. What I am wondering is which to use to be most flexible. Basically something that can be expanded later and doesn't have a huge learning curve, possibly to mobile & api use. I don't know enough about WIF or AD as I have never really used them, and ASP.NET Identity is still in beta and not really 100% documented. My experience with authentication systems is working with ones out of the box. I've never really had to deal with SSO or federation One thing I wanted to add is there is no need for outside registration. Registration will be handled purely by admins, not sure if this ties in at all, but thought it may be of importance


title: How to calculate throughput if there is network traffic

text: I came across this question in a textbook, but there are no solutions and I'm not sure how to solve this. The question is: Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has three links of rates R1=500Kb/s, R2=2Mb/s and R3=1Mb/s. Assuming that there is another busy flow that travels through the same set of links (say from Host C to Host D), what will be the throughput for this file transfer? I know that the throughput for no traffic would be the min(R1, R2, R3), so would the throughput with traffic be the max(R1, R2, R3)?


title: Random Cache Expiry

text: I've been experimenting with random cache expiry times to avoid situations where an individual request forces multiple things to update at once. For example, a web page might include five different components. If each is set to time out in 30 minutes, the user will have a long wait time every 30 minutes. So instead, you set them all to a random time between 15 and 45 minutes to make it likely at most only one component will reload for any given page load. I'm trying to find any research or guidelines on this topic, e.g. optimal variance parameters. I do recall seeing one article about how Google (?) uses this technique, but can't locate it, and there doesn't seem to be much written about the topic.


title: Difference between event loop and system calls/interrupts

text: When you create programs (like a socket server) that are designed to run on an operating system, such as Ubuntu, frameworks like Qt for C++ use something called a main event loop:               app = new QCoreApplication(argc, argv);     int rc = app->exec()      Now programming language like C or C++ enable a program to make system calls through built-in functions, like fork() or pthread_create() and use software interrupts to change kernel mode. For example, the program can request use of the kernel by means of a system call in order to perform privileged instructions, such as process creation or input/output operations. Other examples are open, read, write, close, wait, execve, fork, exit, and kill. All this can be achieved within C/C++ directly without an event loop. So what's the purpose of the event loop?


title: Merits of Namepsaces/Packages

text: Some programming languages (e.g. Java and C++) have language features called "packages" or "namespaces". How useful is it really to have namespaces? It is possible to mark functions and classes as belonging to some particular library without using such a language feature, like the SDL does (e.g. `SDL_BlitSurface()`). Are namespaces not helpful enough to be worth having? Are they useful in libraries but not in applications? Are they useful everywhere except for in small projects? Thoughts?


title: Javascript Form Validation

text: When validating a JavaScript form, would it be better to process each input field individually, or, where possible check collectively? e.g.               validate()     {          noblanks()          fieldOne()          fieldTwo()     }      or               validate()     {          fieldOne()          fieldTwo()


title: What is the use of Association, Aggregation and Composition (Encapsulation) in Classes

text: I have gone through lots of theories about what is encapsulation and the three techniques of implementing it, which are Association, Aggregation and Composition. What i found is, ## Encapsulation Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding. Encapsulation can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface. The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this feature Encapsulation gives maintainability, flexibility and extensibility to our code. ## Association Association is a relationship where all object have their own lifecycle and there is no owner. Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently. ## Aggregation Aggregation is a specialize form of Association where all object have their own lifecycle but there is ownership and child object can not belongs to another parent object. Let’s take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy. We can think about “has-a” relationship. ## Composition Composition is again specialize form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object dose not have their lifecycle and if parent object deletes all child object will also be deleted. Let’s take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete. **The question is:** Now these all are real world examples. I am looking for some description about how to use these techniques in actual class code. I mean _what is the point for using three different techniques for encapsulation_ , _How these techniques could be implemented_ and _How to choose which technique is applicable at time._


title: Before you develop a web app, how much of a spec do you need?

text: If you were to accept a role as a full time web app developer responsible for creating a new application from scratch, how much of a defined specification and design would need and/or expect to start development? What tools/software is even used for this (for web apps built with something like RoR)? I would expect a mockup/wireframe to be required, but what else is done in the design stage? What is the best method or process to convey the functionality of the application so that developers know what to translate into code. I'm interested to hear from web app developers who have thought: "If I only had <this>, I could develop this so much quicker/easier/cleaner", or "I have no idea what this customer wants unless they document it in <thing>." I'm not trying to start a philosophical debate, I am curious from the developers' perspective what is the "right" way to design web apps from scratch. There is probably a book somewhere that someone can tell me to RTFM, but I've only been able to find resources on learning actual coding and development, not the design phase.


title: Advantages of Hudson and Sonar over manual process or homegrown scripts

text: My coworker and I recently got into a debate over a proposed plan at our workplace. We've more or less finished transitioning our Java codebase into one managed and built with Maven. Now, I'd like for us to integrate with Hudson and Sonar or something similar. My reasons for this are that it'll provide a 'zero-click' build step to provide testers with new experimental builds, that it will let us deploy applications to a server more easily, that tools such as Sonar will provide us with well-needed metrics on code coverage, Javadoc, package dependencies and the like. He thinks that the overhead of getting up to speed with two new frameworks is unacceptable, and that we should simply double down on documentation and create our own scripts for deployment. Since we plan on some aggressive rewrites to pay down the technical debt previous developers incurred (gratuitous use of Java's Serializable interface as a file storage mechanism that has predictably bit us in the ass) he argues that we can document as we go, and that we'll end up changing a large swath of code in the process anyways. I contend that having accurate metrics that Sonar (or fill in your favorite similar tool) provide gives us a good place to start for any refactoring efforts, not to mention general maintenance -- after all, knowing which classes are the most poorly documented, even if it's just a starting point, is better than seat-of-the-pants guessing. Am I wrong, and trying to introduce more overhead than we really need? Some more background: an alumni of our company is working at a Navy research lab now and suggested these two tools in particular as one they've had great success with using. My coworker and I have also had our share of friendly disagreements before -- he's more of the "CLI for all, compiles Gentoo in his spare time and uses Git" and I'm more of a "Give me an intuitive GUI, plays with XNA and is fine with SVN" type, so there's definitely _some_ element of culture clash here.


title: Treating a 1D data structure as 2D grid

text: Hopefully this is a good question. I am working with a native class that represents a 2D image as a 1D array. If you want to change one pixel, for example, you need to now how to derive the index from the `x,y` coordinates. And I am trying to grok, in abstract terms, how to map a multidimensional object to its underlying unidimensional representation. So, let's say we have a 1D array `array1d` like this:               array1d = [ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y ]      In the context of our program, `array1d` represents a 2D grid:               a b c d e     f g h i j     k l m n o     p q r s t     u v w x y      And we want to perform operations on `array1d` such as:   * Get the value at `x,y` coordinates (in this example, `1,2` would give `l`)   * Get any sub-grid using `x,y,width,height` (`1,2,2,2` would give `[l, m, q, r]`)   * Set the value at any `x,y` coordinate (etc.) Is there a computer science-related or mathematical term for said operations, which map points/regions in 1D data to coordinates in 2D/3D/4D... objects? If so, what is it? Clearly all computers with displays solve this same issue, so what is this fundamental problem called and how is it conventionally solved?


title: For PL/SQL, do large companies prefer ANSI SQL joins or old Oracle joins?

text: I am interviewing for a PL/SQL position with a large corporation. I will have to write a multiple choice exam. I am wondering whether the exam will likely use old-style joins (joining happens in the 'WHERE' clause) or ANSI ones. My apologies if this is not the correct forum for this question.


title: Should I update this code or continue with current design

text: I am working with ASP.NET Application. The application is great and works fine but it a few flaws. To give you an example,   1. Every control uses an absolute position layout. This makes working with code very difficult in design mode. Absolute position has been used more than 700 times in the code.   2. There are different menus uses instead of one. And to stitch them together, again absolute position is used for each menu control   3. The application is role based. All the roles are implemented using Roles.IsUserInRole property. I would like to use proper permission for every role with page level permission.   4. There are a few security risk in the current code but that is easy fix in current program though.   5. There is no true admin. The top level role act as admin which is also a functional role, used by other members. Now that we are adding new functionality to this code and I mean adding some big functionality, what do you recommend. Should I rewrite this code or work in the existing. I would esp like to fix   1. The layout issues. Remove all fixed positions and make the code clean and easy to maintain.   2. Unfortunately to do so I have to rewrite the menu. Because I want to write one menu instead of 4 being used.   3. In order to achieve point 2 above, I have to crete new roles and provide proper security for the application. My question is **Should I work with the current code or rewrite the existing code keeping in mind that our company is growing and that it may take me 2-4 weeks to do rewrite up.** Would it be bad idea or a good one. I don't have a technical lead in my company.


title: Good design pattern for a c++ wrapper around a c object

text: I have written an extensible c++ wrapper around a very hard to use but also very useful c library. The goal is to have the convience of c++ for allocating the object, exposing its properties, deallocating the object, copy semantics etc... The problem is this: sometimes the c library wants the underlying object (a pointer to the object), and the class destructor should not destroy the underlying memory. While most of the time, the destructor should deallocate the underlying object. I have experimented with setting a `bool hasOwnership` flag in the class so that the destructor, assignment operator, etc... will know whether or not it should free the underlying memory or not. However, this is cumbersome for the user, and also, sometimes there is no way to know when another process will be using that memory. Currently, I have it setup where when the assignment comes from a pointer of the same type as the underlying type, then I set the hasOwnership flag. I do the same when the overloaded constructor is called using the pointer from the c library. Yet, this still does not handle the case when the user has created the object and passed it to one of my functions which calls the c_api and the library stores the pointer for later use. If they were to delete their object, then it would no doubt cause a segfault in the c library. Is there a design pattern that would simplify this process? Maybe some sort of reference counting?


title: Why would I use Control.Exception in Haskell?

text: I'm trying to really master Haskell error handling, and I've gotten to the point where I don't understand why I would use Control.Exception instead of Control.Monad.Error. The way I can see it, I can catch Control.Monad.Error exceptions in both pure and impure contexts. By contrast, exceptions defined in Control.Exception can be caught only in impure/IO contexts. Given that they provide two separate interfaces and semantics that I would need to memorize, under what circumstances would I need Control.Exception instead of Control.Monad.Error?


title: Offshoring: does it ever work?

text: I know there has been a fair amount of discussion on here about outsourcing/offshoring, and the general opinion seems to be that at best it is difficult, and at worst it fails. I have direct experience of offshoring myself; a previous company, where I was a development manager, wanted to send some development offshore, and we ran a pilot scheme to see how well it would work. Of course, it was a complete failure, although it is not completely clear to me whether this was down to the offshore developers being less talented, the process, or other factors (no doubt it was really a combination). I can see as a business how offshoring _looks_ attractive (much lower day rate), but as far as I can see, the only way it could _possibly_ work is if you do _exceptionally detailed_ design up front, with _incredibly detailed_ specifications; and by the time you have invested in producing that, you have probably spent as nearly as much as if you had written the actual code locally (which I think is an instance of No Silver Bullet). So, what I want to know is, does anyone here have any experience of offshoring actually working _ever_? Especially if there are any success stories of it working in a semi-agile way? I know there are developers here from all over the World; has anyone worked on an offshore project they consider successful?


title: How to work with new director with different ideals?

text: ### Background Over the past 2 years, we have built us a decent team of developers. The CEO of the company and myself have been working closing to make sure we are moving done a good path. As our department as grown, I've been telling the owner we need a manager/director over us that understands technology, but can lead the company on more of the business aspects of running an interactive development shop. He's gone out and done just that, I didn't get to meet the man before his first day, but quickly got his CV. He had owned a company in the late 90's that was bought out and has been working as a consultant since then. Most of his knowledge was in large corporate systems. We build web applications and sites for medium sized companies. And that is where the issues are starting to crop up. He's brought up on several occasions our need to switch to Flash, Oracle and J++ for the sites and applications we are building. Versus the LAMP stack we are using now for 90% of our development. The new guy is very smart when it comes to the business side of technical projects, but he is trying to lead the technical direction. And he and I aren't seeing eye-to-eye for a couple of upcoming projects. ### Question Now, I don't want to go into the issues with those comments. I want to ask how I, as the Senior Developer, can work with our new Director to ensure the success of our department within this company. While also keeping our developers happy, and working with the technologies that we enjoy, and are comfortable with.


title: Usage of Pirated software at a company

text: I started to work at a company as an engineer a couple of months ago. It's a small company and what they basically do is answering service on phones. Now they are switching from normal phones to IP phones so that computers take more important place in the work. However, all the computers used by workers are equipped with pirated software, including their operating systems. Moreover, they didn't even buy one license to make copies for other computers. In other words, they did not spend any money for the software in office. I am not saying copying a licensed one is legit, but the situation is too much. There is one guy who installed the pirated software. He does not feel any sense of guilt and even justified when I asked about it. He is not even a specialist. He just searched on the internet to install pirated software. Our boss does not have any knowledge of computers, so he took the cheaper way. What do you think about this? Since I am still new to the company, I am not doing maintenance on those cracked computers. But I have to use those software daily. And later on I will be doing support, help desk kind of stuff. I really don't want to take responsibility for operating pirated software. From an aspect of developer and engineer, pirated software is not able to get legal support and it may work unexpectedly. So, I am thinking about changing jobs. Am I thinking too much? Should I wait until I have more credibility with the boss and try to change his policy? So far, the boss does not take any words from me. Any opinions are welcome. Thank you


title: Should APIs be in en_US or en_GB or both?

text: Should I write APIs in US spelling or British spelling? Or should I provide with mapping both of them to a single one and internally using anyone which I like so that both of them works ? At present most of the APIs are with US spelling. What is the solution for it? edit: Is there a way to standardize this. May be support both?


title: What do you suggest for cross platform apps, including web

text: I have always preferred cross platform development over most other concepts as long as I can remember. Which is one of the reason I never got into .Net. Currently, I use php/javascript/python as my primary languages of choice for web development. Which I also have been using at work. But the need to learn c# has come up and one of the windows guys has been teaching me c#, so I am still very new. I have really liked the language. I have also been brainstorming on an app that I have been wanting to make for some time and have not determined the best way to build it. The main system will be online where users can log in and do everything. But I also want to make a desktop client that ties into and syncs the users content with the server (considering using couchdb for my particular use case for this app). They should be able to do everything the web app can. I would like to launch to linux, windows, and mac as well as make mobile versions. In learning c#, my co-worked recommended I look at Mono, so I can use .Net as a cross platform system and even possibly use asp.net for the main site. So I am hoping to get some insight on where I could go. It seems as if I used .net with mono, I could reuse a lot of code for web and mobile using monodroid/monotouch. But then how could this setup compare to using something like sencha touch for making a mobile version and node.js for the server side (am fairly proficient with JS and php already, I just need to learn c#/.net for work and would like to learn it more anyways). Or is there anything else I should consider? I'm not really asking which method is better, I just want to know what options I have, which I could then make a calculated decision based on my needs and further research. Such as what features would the .net/mono route have that I would not in sencha/node.js, and vice versa (node.js is awesome at real time uset to user interaction, for example) I am just looking for some insight and advice, and help woudl be greatly appreciated.


title: Inline functions in C++. What's the point?

text: According to what I read, the compiler is not obliged to substitute the function call of an inline function with its body, but will do so if it can. This got me thinking- why do we have the inline word if that is the case? Why not make all function inline functions by default and let the compiler figure out if it can substitute the calls with the function body or not?


title: What are the advantages and disadvantages of using Resharper Annotations?

text: A new colleague has mooted the idea of using **Resharper annotations** within our code base (we already are great fans and users of Resharper). My new colleague cites things like explicitly stating whether a parameter can be null or not null at coding time is a good thing so that consumers of that class can see warnings at coding time. My reservation is it adds noise to the code, is not runtime executed hence I favour Guard clauses. I am also concerned that like comments that they can go stale. I am also concerned about code readability and the overhead of writing them in the first place. Ultimately I am trying to keep development lean so don't want to add overhead for relatively little gain. Finally it feels wrong decorating code for one vendor's tooling support. What are your thoughts? Good/bad experiences?


title: What causes floating point rounding errors?

text: I am aware that floating point arithmetic has precision problems. I usually overcome them by switching to a fixed decimal representation of the number, or simply by neglecting the error. However, I do not know what are the causes of this inaccuracy. Why are there so many rounding issues with float numbers?


title: What's so bad about creative coding?

text: I was watching Bob Ross paint some "happy trees" tonight, and I've figured out what's been stressing me out about my code lately. The community of folks here and on Stack Overflow seem to reject any whiff of imperfection. My goal is to write respectable (and therefore maintainable and functioning) code, by improving my skills. Yet, I code creatively. Let me explain what I mean by "coding creatively":   * My first steps in a project are often to sit down and bash out some code. For bigger things, I plan a bit out here and there, but mostly I just dive in.   * I don't diagram any of my classes, unless I'm working with others who are creating other pieces in the project. Even then, it certainly isn't the first thing I do. I don't typically work on huge projects, and I don't find the visual very useful.   * The first round of code I write will get rewritten many, many times as I test, simplify, redo, and transform the original hack into something reusable, logical, and efficient. During this process, I am always cleaning. I remove unused code, and comment anything that isn't obvious. I test constantly. **My process seems to go against the grain of what is acceptable in the professional developer community, and I would like to understand why.** I know that most of the griping about bad code is that someone got stuck with a former employee's mess, and it cost a lot of time and money to fix. That I understand. What I don't understand is how my process is wrong, given that the end result is similar to what you would get with planning everything from the start. (Or at least, that's what I have found.) My anxiety over the issue has been so bad lately that I have stopped coding until I know everything there is about every method for solving the particular problem I am working on. In other words, I have mostly stopped coding altogether. I sincerely appreciate your input, no matter what your opinions are on the issue. **Edit:** Thank you all for your answers. I have learned something from each of them. You have all been most helpful.


title: best hosting structure to sell your app on a website

text: I'm considering trying to sell a small desktop application (I would be considered a one-man mISV, I guess?) at a price of about $20-$30 USD. I would distribute to customers by download only. I get the sense the best and most intuitive way to do this is provide a download link from the application's website. What are the best ways to go about this? Should I create a website with a standard web hosting provider (like, e.g. DreamHost) and use that to allow customers to download it (it's 18MB or so in size)? I want to allow for the possibility that many people may attempt to download it at once (if I were able to get a write-up on some very widely-read sites), and I would not want my provider to not be able to handle that, since that would be THE crucial sales period. I'd also like to keep costs of hosting/serving as low as possible, since I'm not sure I am going to make any money selling this at all. I'd also like to keep things relatively simple.


title: Removing occurrences of characters in a string

text: I am reading this book, programming Interviews exposed by John Wiley and sons and in chapter 6 they are discussing removing all instances of characters in a src string using a removal string... so `removeChars(string str, string remove)` In there writeup they sey the steps to accomplish this are to have a boolean lookup array with all values initially set to false, then loop through each character in `remove` setting the corresponding value in the lookup array to true (note: this could also be a hash if the possible character set where huge like Unicode-16 or something like that or if str and remove are both relatively small... < 100 characters I suppose). You then iterate through the str with a source and destination index, copying each character only if its corresponding value in the lookup array is false... Which makes sense... I don't understand the code that they use however... They have               for(src = 0; src < len; ++src){        flags[r[src]] == true;     }      which is turning the flag value at the remove string indexed at src to true... so if you start out with `PLEASE HELP` as your str and `LEA` as your remove you will be setting in your flag table at `0,1,2... t|t|t` but after that you will get an out of bounds exception because r doesn't have have anything greater than 2 in it... even using there example you get an out of bounds exception... Am is there code example unworkable? **Entire function**               string removeChars( string str, string remove ){        char[] s = str.toCharArray();        char[] r = remove.toCharArray();        bool[] flags = new bool[128]; // assumes ASCII!        int len = s.Length;        int src, dst;        // Set flags for characters to be removed        for( src = 0; src < len; ++src ){           flags[r[src]] = true;         }             src = 0;        dst = 0;        // Now loop through all the characters,        // copying only if they aren’t flagged        while( src < len ){            if( !flags[ (int)s[src] ] ){            s[dst++] = s[src];        }        ++src;        }        return new string( s, 0, dst );     }      as you can see, r comes from the remove string. So in my example the remove string has only a size of 3 while my str string has a size of 11. len is equal to the length of the str string. So it would be 11. How can I loop through the r string since it is only size 3? I haven't compiled the code so I can loop through it, but just looking at it I know it won't work. I am thinking they wanted to loop through the r string... in other words they got the length of the wrong string here.


title: What are the biggest bottlenecks when developing large projects?

text: Let's say that my company was to develop a replica of MS Word (just as an example). What would be the bottleneck to the development process, assuming that one has infinite cash available and an organization like Microsoft? In other words, what are the most usual hindrances from developing such software fast? Let's assume that all specifications are in place and the organization is working perfectly, so we just focus on the software development until the product is ready to be shipped. Some alternatives might be: \- Writing the code \- Writing tests \- Manually testing the end product \- Rewriting the code due to poor design in the first place \- Designing the code \- Code review done by experienced developers \- Designing GUI \- Redesigning GUI based on alpha/beta-user feedback \- Processing feedback from users \- Waiting for alpha/beta-user feedback Please use references in your answer or state your experience on the subject.


title: Is there a known algorithm for scheduling tournament matchups?

text: Just wondering if there is a tournament scheduling algorithm already out there that I could use or even adapt slightly. Here are my requirements:   * A variable number of opponents belonging to a variable number of teams/clubs each must be paired with an opponent   * Two opponents cannot be from the same club   * If there are an odd number of players, 1 of them randomly is selected to get a bye Any algorithms related to this sort of requirement set would be appreciated. **EDIT:** I only need to run this a maximum of one time, creating matchups for the first 'round' of the tournament.


title: Being a good mentee - a protégé

text: The complement of the Being a good mentor question. I work with many very senior people that have vast amounts of knowledge and wisdom in Software, Engineering and our business domain. What are some tips for gaining as much knowledge from them? I don't want to take up too much of their time, but also want to take full advantage of this since it really could help develop my skills. What are some good questions to get the conversation rolling in a sit down mentor/mentee session? Some of the people providing mentorship have little experience in this area, so it would help to be able to lead some of these discussions.


title: Right options for the Creative Commons license for the theme

text: First I am not so much expert with the license terms and system but have some basic knowledge. I have been developing theme for one of the Open Source PHP script since two versions. It has been package included with GPLv3 till now. Currently, I am working on new version and now ready to release alpha version. But before I release it, I just want to change the license to Creative Commons. This is just to prevent a bit the copyright/credits notes. I want to allow user to modify, alter the theme and they can redistribute. But they must contains the original copyright and credit notes and the license. I am not sure either I can release new version under CC license and if yes what will be the best option for it. Also will just a logo (not with entire description) will consider the same rights?


title: How to store satellite data in C data structutres

text: I've been reading through Introduction To Algorithms 3rd Ed, and am really enjoying the material; however, I am having difficulty in implementing some practical situations. It's not the theory, or implementing the internals of the data structures themselves, but rather how to design a good interface that makes the data structures useful for storing real data (as opposed to just the keys). Specifically, I'm told that C has a very "trust the programmer" type philosophy. I just don't know how much trust is too much trust .. As an example, many data structures can be implemented as linked structures with similar nodes having a key, satellite data, and pointers to other nodes in the ds, ex:               typedef struct {         int key;         void *data;         node_t *prev;         node_t *next;     } node_t;      Q1. To what extent should I be encapsulating my implementations? For most structures, you have both: (a) a data structure type, and (b) a type that can be inserted/deleted from the data structure. Should they both be hidden? Clearly if I expose a some `node_t` with the intention someone only alters `key` and `*data`.. theres the possibility `prev` or `next` is altered, thus destroying the data structure. A similar risk exists if I expose the data structure type and someone messes around with the root.. Q2. How should the keys be stored/accessed/compared? Presumably, the keys depend on the satellite data, but if you go the approach as above, you've decoupled the key from the data itself. What would happen if a user updates the data but forgets to update the key (or worse, they update the key, but don't remove/reinsert it into the ds)? For something like a binary tree which uses only comparisons, I could design the interface to accept comparators that accept pointers to the satellite data? This makes the structure more generalized, but all the defreferencing has to have an impact on speed. Alternatively, (and would be needed for structures like hashes which need a concrete key), I could accept a pointer to a `int toKey(void *data)`function.. I'm relatively new to C (and designing software) and am unclear on how good software should be designed for use in the real world..


title: Visually and audibly unambiguous subset of the Latin alphabet?

text: Imagine you give someone a card with the code "5SBDO0" on it. In some fonts, the letter "S" is difficult to visually distinguish from the number five, (as with number zero and letter "O"). Reading the code out loud, it might be difficult to distinguish "B" from "D", necessitating saying "B as in boy," "D as in dog," or using a "phonetic alphabet" instead. What's the biggest subset of letters and numbers that will, in most cases, both look unambiguous visually and sound unambiguous when read aloud? * * * Background: We want to generate a short string that can encode as many values as possible while still being easy to communicate. Imagine you have a 6-character string, "123456". In base 10 this can encode **10** ^6 values. In hex "1B23DF" you can encode **16** ^6 values in the same number of characters, but this can sound ambiguous when read aloud. ("B" vs. "D") Likewise for any string of N characters, you get (size of alphabet)^N values. The string is limited to a length of about six characters, due to wanting to fit easily within the capacity of human working memory capacity. Thus to find the max number of values we can encode, we need to find that largest unambiguous set of letters/numbers. There's no reason we can't consider the letters G-Z, and some common punctuation, but I don't want to have to go manually pairwise compare "does G sound like A?", "does G sound like B?", "does G sound like C" myself. As we know this would be O(n^2) linguistic work to do =)...


title: Declarative programming vs. Imperative programming

text: I feel very comfortable with Imperative programming. I never have trouble expressing algorithmically what I want the computer to do once I figured out what is it that I want it to do. But when it comes to languages like SQL or I often get stuck because my head is too used to Imperative programming. For example, suppose you have the relations band(bandName, bandCountry), venue(venueName, venueCountry), plays(bandName, venueName), and I want to write a query that says: all venueNames such that for every bandCountry there's a band from that country that plays in venue of that name. **EDIT (due to answers): in other words, I want all the venueNames in which bands from _all_ countries (bandCountry) played. Also, by "relation" I mean an SQL table.** In my mind I immediately go "for each venueName iterate over all the bandCountries and for each bandCountry get the list of bands that come from it. If none of them play in venueName, go to next venueName. Else, at the end of the bandCountries iteration add venueName to the set of good venueNames". ...but you can't talk like that in SQL and I actually need to think about how to formulate this, with the intuitive Imperative solution constantly nagging in the back of my head. Did anybody else had this problem? How did you overcome this? Did you figured out a paradigm shift? Made a map from Imperative concepts to SQL concepts to translate Imperative solutions into Declarative ones? Read a good book? PS I'm not looking for a solution to the above query, I did solve it.


title: Programmer aptitude test

text: I have many friends that see what I do, find it interesting and ask me the question               Do you think I could be a programmer?      My response is               ...   ummm  ...  do you like math?      I'd like to have a helpful response, so I didn't know if anyone knew of a fairly decent aptitude test for someone that would be starting from square one, but has critical thinking and problem solving skills?


title: Vulnerabilities and employability

text: I am a web developer. If I find a vulnerability in a prospective employer's website and notify them of it at the same as I send my (unsolicited) application, am I more likely to get the job? Less likely? Why?


title: Ways to find a tutor for 1st year University student

text: I tried searching here (and SO) without much luck. I also stared at the yellow box to the right and think this question is relatively on topic and can be answered. A co-worker asked me if I had any suggestions for how to find a tutor for his son. In this specific case, it was for Eclipse and Java, but it got me thinking about good general strategies one could use in situations like this. He preferred a local 1-to-1, but I suppose online might be a reasonable (or perhaps more likely) alternative. Any suggested strategies?


title: How to handle growing QA reporting requirements?

text: **Some Background:** Our company is growing very quickly - in 3 years we've tripled in size and there are no signs of stopping any time soon. Our marketing department has expanded and our IT requirements have as well. When I first arrived everything was managed in Dreamweaver and Excel spreadsheets and we've worked hard to implement bug tracking, version control, continuous integration, and multi- stage deployment. It's been a long hard road, and now we need to get more organized. **The Problem at Hand:** Management would like to track, per-developer, who is generating the most issues at the QA stage (post unit testing, regression, and post-production issues specifically). This becomes a fine balance because many issues can't be reported granularly (e.g. per-url or per-"page") but yet that's how Management would like reporting to be broken down. Further, severity has to be taken into account. We have drafted standards for each of these areas specific to our environment. Developers don't want to be nicked for 100+ instances of an issue if it was a problem with an include or inheritance... I had a suggestion to "score" bugs based on severity... but nobody likes that. We can't enter issues for every individual module affected by a global issue. **[UPDATED] The Actual Questions:** How do medium sized businesses and code shops handle bug tracking, reporting, and providing useful metrics to management? What kinds of KPIs are better metrics for employee performance? What is the most common way to provide per- developer reporting as far as time-to-close, reopens, etc.? Do large enterprises ignore the efforts of the individuals and rather focus on the team? Some other questions:   * Is this too granular of reporting?   * Is this considered 'blame culture'?   * If you were the developer working in this environment, what would _you_ define as a measureable goal for this year to track your progress, with the reward of achieving the goal a bonus?


title: Does it make sense to compute cyclomatic complexity/lines of code ratio?

text: In general, maintainability index relies on many factors. For example, in Visual Studio, it rely on cyclomatic complexity, depth of inheritance, class coupling and lines of code; those four values must be as low as possible. At the same time, I've never seen, neither in code metrics tools, nor in books, the comparison between only cyclomatic complexity (CC) and lines of code (LC). Does it make sense to compute such ratio? What information does it give about the code? In other words, is it better to decrease more the CC than the LC to have a lower ratio? What I notice is that for small projects, the ratio CC/LC is low (⅓ and lower). In other words, LC is high, and CC is low. In large projects, CC/LC is in most cases bigger than ½. Why?


title: How Do You Test Your Software?

text: I'm currently working on 2 software projects:   1. A Social Networking Web Site for an NGO   2. A Patient Management System for a hospital Although I've been programming for 5 years, I can't just say that I'm very good at testing or Test Driven Designing an application. How would you arrange your Software Testing before coding phase, during coding and after you finished the coding phase for   * a. providing stakeholders with information about the quality of the product or service under test.   * b. providing an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.  and how do you understand that your program/application/product   * c. meets the business and technical requirements that guided its design and development   * d. works as expected p.s. please feel free to edit the question since my english is not very powerful.


title: How do I improve my skills as a Qt GUI programmer?

text: I'm a python & Qt programmer and my day job is create small GUI programs to ship with hardware devices. However, my job is pretty basic: read/write data to the device through a serial port using pyserial, and display and edit data using PyQt and PyQwt. Because of how basic this job is, I'm not confident there's a lot of job security here. What can I do to improve my skills in this area?


title: What is the most secure way to "Grandfather In" existing users of a paid iOS app that will go free?

text: The title pretty much says it all, but I can elaborate. I have a paid iOS app that has plenty of existing customers. I think i want to convert to a free app now, and allow full upgrade via in-app-purchase. The problem is, I don't want to make my existing customers buy the app again to use it, nor do I want to make it easy for hackers to just flip a switch and get the pro version. What is the **most secure** way to "Grandfather In" existing users of a paid iOS app that will go free?


title: How to resolve methods with the same name and parameter types?

text: In many cases, I want to write methods that have the same functionality for different types of inputs. This is easily accomplished by method overloading if the parameter types are different. But what's the best (most robust) way to go about resolving the case when the parameter types are the same (i.e. two different representations of the data with the same type)? An example of this would be an integer matrix which can naturally be stored as an `int[][]`. But what if you want to write a method which accepts the transpose of the matrix as well? The transpose is also an `int[][]` but a clearly different representation altogether. I can see a couple ways of doing this:   * Giving the methods different names   * Adding a flag to the method   * Wrapping each representations in different classes I think the third method is the most clear way of doing this. Unfortunately I'm working on some high performance libraries where that's not a feasible solution.


title: Is it called an instance in Javascript?

text: Say I have a function.               function foo(){         //do stuff     }      And then I create an object of that function.               var fooObj = new foo();      What is `fooObj` called? An instance, An object instance, or something else entirely? Pardon the newbie question, but I am rather new to prototype based programming(and all programming really).


title: Best way to convincingly evangelize front end best practices to colleagues?

text: I've had experiences in the past working with (traditionally back-end) developers, whose occasionally cross into the front end realm. The resulting code would typically involve:   * global namespace pollution (many many global functions included inline without flexibility or re-use in mind)   * many one-off implementations of functionality which is already supported, or may be more easily implemented with the assistance of an already-included library (raw JS implementations of AJAX/DOM-related functionality)   * mass groupings of inline styles As a (relatively) seasoned front end professional, I've had some success conveying best practices to colleagues who were interested in learning. However, that success was largely based on trust and open-mindedness. What one's options are when it comes to responding to questions asking to why some accepted "best" practices are genuinely better in a way which gains said trust and interest?


title: Programming methodologies at stackoverflow

text: I am in the middle of starting up a software company where we would use ASP.NET MVC and ASP.NET WebAPI extensively at shop. We will be a group of 4 and no more than 10 will work on any particular project at any point in time(these are ground rules). I would like to know, what programming methodologies best suit a small(guerilla) team. Specifically, I would also like to know which ones are being used at famous ASP.NET MVC shops like Stackoverflow. The ones I know are:   1. Scrum and   2. Waterfall(I know its bad).  But what's the recommended way of development for smaller, group of 9-10 team. Also, will Test Driven Development help such a team in producing quality software? Are there any other techniques the team will have to know to be good at producing quality software?


title: what is exactly an enterprise app store

text: My idea of an enterprise app store is that there is a page on the company's website where all the apps that that company developed for its employees are listed so they can use them. And access to this apps is restriceted to the employees of the company. As far as I know you can download an Android App from any website and install it on an Andoid phone, you don't have to use Android Market. However installing an App that does not come from the Android Market is not that straightforward. For Apple, you can only install an app from the Appstore, so how can you have an enterprise app store? Please tell me what exactly is an enterprise app store. I think I got it wrong, also I read a lot on the internet for this keywords.


title: Implementing a ILogger interface to log data

text: I have a need to write data to file in one of my classes. Obviously I will pass an interface into my class to decouple it. I was thinking this interface will be used for testing and also in other projects. This is my interface:               //This could be used by filesystem, webservice     public interface ILogger     {        List<string> PreviousLogRecords {get;set;}        void Log(string Data);     }          public interface IFileLogger : ILogger     {       string FilePath;       bool ValidFileName;     }          public class MyClassUnderTest     {       public MyClassUnderTest(IFileLogger logger) {....}     }          [Test]     public void TestLogger()     {        var mock = new Mock<IFileLogger>();        mock.Setup(x => x.Log(Is.Any<string>).AddsDataToList()); //Is this possible??             var myClass = new MyClassUnderTest(mock.Object);             myClass.DoSomethingThatWillSplitThisAndLog3Times("1,2,3");             Assert.AreEqual(3,mock.PreviousLogRecords.Count);          }      This won't work I don't believe as nothing is storing the items so is this possible using Moq and also what do you think of the design of the interface?


title: How do I determine which language/framework is best for our web-based project?

text: I'm in the early stages of development for a web application that has three developers (myself included) working on it. The project is, at its core, a web-based database that will be used by around 5,000 people. Its primary purpose is to track information about game characters while enforcing a set of rules and security. Meanwhile, it's supposed to be as usable as possible. While the main presentation will be over a networked desktop web browser, we're also hoping that   * certain features of the application will be usable while disconnected from the network and   * that we can develop a version of the frontend for mobile devices. Here is some basic background for the developers; I think it's fairly relevant to the question.   * Developer A maintains the system we are redesigning. It was built in PHP but there is very little actual code that we can keep. He also has veto power, though he takes suggestions readily.   * Developer B is familiar only with VB and SQL, though he has been studying AJAX and HTML/CSS lately.   * Developer C (me) has a degree in Software Engineering with experience in multiple (non MS) languages as well as with some general web/database development, but has only developed code in Ruby since graduating (2009). Dev C has experience in an older version of PHP and helped work on one project in the latest version of Rails back in 2008. The main tools we're considering are Ruby on Rails 3 and PHP 5. Developer A seems fairly opposed to learning Rails, but my guess is that he is assuming it is more difficult to learn than it actually is. I don't know that for sure, though. Regardless of which we choose, I want to use a MVC architecture. **What are some other notable concerns we should address in order to determine which language would best suit us?** Are any of the concerns listed below trivial? The main issues/points/concerns I _think_ I need to consider/address are:   * The learning hurdle for Rails - for developer A, mostly, but also if it would be harder to learn a bit just to help for developer B than it would be for him to learn a bit of PHP.   * The possibility that there will be performance issues with Rails.    * The lack of forced structure with PHP - should I expect difficulties enforcing an MVC   * Ease of AJAX integration in PHP vs. Rails.


title: How likely is it for a programmer to become a good designer?

text: I'm a programmer, and I'm pretty good at programming. I can easily pick up most technical topics such as Linux, Systems Administration, Databases and of course, new programming languages. I even dabbled with 3d modelling and wasn't horrible at it. However, I am awful at Graphic Design. I have no skill there whatsoever, and even after quite a few Photoshop tutorials I can't design a website (or anything else really). I'm wondering if I pour a whole bunch of time into it, if I can become a _good_ graphic designer. So what I'm looking for is anyone else who has done this, or advice, thoughts, etc.


title: Is a try and catch that does not throw an exception more efficient than a conditional?

text: I came across this example recently: > If 999 times out of 1,000 an exception will not be thrown then the exception > is only generated once. On the other hand a conditional would have been > called needlessly 999 times, therefore in this case the exception is > superior. In this instance it's C#, but generally speaking is this true? I had previously assumed try/catch statements had their own overhead that would equal the time spent handling a conditional. Granted, just throwing try/catch blocks anyplace a conditional would normally go would be a terrible way to code, but resource-wise does this statement hold up?


title: Type inference in Golang/Haskell

text: I've read that Go doesn't actually have true type inference in the sense that functional languages such as ML or Haskell have, but I haven't been able to find a simple to understand comparison of the two versions. Could someone explain in basic terms how type inference in Go differs from type inference in Haskell, and the pros/cons of each?


title: How would you create a program where two objects randomly move throughout the screen BUT never collide?

text: they are free to move anywhere on the screen weather in straight lines or curved ones just as long as they don't be at the same place at any given time. btw I'm not asking how to write it in code, but rather the logic if you will? 1- how would you make an object move randomly? (disregarding predefined functions or classes..etc) 2-how do you ensure they never hit?


title: Best data structure for representing English verb forms

text: I need to come up with a data structure to keep information about English verb forms. In most cases a verb can be in one of 4 forms: base, present participle, past participle and past simple, for example:   * take   * taking   * taken   * took It's seemingly easy to define 4 types for each form and be over with it. However there are few exceptions that ruin this simple idea.   1. Present single third person form, which is in our example would be "takes".   2. Copular verb "to be" has multiple irregular forms in the present tense: "am", "is", "are" and "was" and "were" in the past tense   3. Verbs like "may" that don't inflect in the present single third person form: "she may". What data structure would be efficient, accurate yet unambiguous for representing such information (with exceptional cases) given the following requirements have to be met:   * for an arbitrary form answer the question what conjugations the form represents   * for an arbitrary conjugation and a form answer the question whether the form represents the given conjugation or not?


title: Common phrases to know which resources are no longer available

text: I'm working on an script for tracking urls on a web page. This script runs daily to identify resources that are no longer available. If a page returns a `status code` like `404` I know the resource is not available anymore, but sometimes the page returns a `200` with a message like: > This resource has been moved to ...... Or > This resource is not available anymore.... I would like to know which `keywords` are used to say a resource is not longer available regardless the `status code`.


title: Where to learn graph theory applications

text: I am completely new to designing algorithms with graphs. I am following CLRS and other video lectures in Youtube, notably from IIT/MIT. They are pretty good, and I currently have decent idea about graph data structures, search, spanning-tree, etc. However, I am completely clueless as to how to identify a coding problem (the likes of which you see in Topcoder/Codechef) that requires a graph-based approach. In which problem, shall I need to use a minimum spanning tree? Where do I need to use Prim's Algorithm? Is there ay book/resource which covers lots of problems on graphs, explaining (well, kind of spoon feeding) how to identify that this problem requires a graph-based solution, and finally how to do it?


title: Strategy for keeping secret info such as API keys out of source control?

text: I'm working on a website that will allow users to log in using OAuth credentials from the likes of Twitter, Google, etc. To do this, I have to register with these various providers and get a super-secret API key that I have to protect with pledges against various body parts. If my key gets ganked, the part gets yanked. The API key has to travel with my source, as it is used at runtime to perform authentication requests. In my case, the key must exist within the application in a configuration file or within the code itself. That isn't a problem when I build and publish from a single machine. However, when we throw source control into the mix, things get more complicated. As I'm a cheap bastard, I'd much prefer to use free source control services such as TFS in the cloud or GitHub. This leaves me with a slight conundrum: **How can I keep my body intact when my API keys are in my code, and my code is available in a public repository?** I can think of a number of ways to handle this, but none of them are that satisfying.   * I could remove all private info from code, and edit it back in after deployment. This would be a severe pain to implement (I won't detail the many ways), and isn't an option.   * I could encrypt it. But as I have to decrypt it, anyone with the source could figure out how to do so. Pointless.   * I could pay for private source control. LOL j/k spend money? Please.   * I could use language features to segregate sensitive info from the rest of my source and therefore keep it from source control. This is what I'm doing now, but it could easily be screwed up by mistakenly checking in the secret file. I'm really looking for a guaranteed way to ensure I don't share my privates with the world (except on snapchat) that will work smoothly through development, debugging and deployment and be foolproof as well. This is completely unrealistic. **So what realistically can I do?** Technical details: VS2012, C# 4.5, source control is either going to be TF service or GitHub. Currently using a partial class to split the sensitive keys off in a separate .cs file that won't be added to source control. I think GitHub may have the advantage as .gitignore could be used to ensure that partial class file isn't checked in, but I've screwed that up before. Am hoping for a "oh, common issue, this is how you do it" but I may have to settle for "that doesn't suck as much as it could have", :/


title: Having a Starting Place for Coding a Site

text: This is more of preference question that I wanted to toss out to other developers to learn a bit more about others process when developing a site. Every time I start a site I feel I could save a lot of time if I had a better starting point to work from. I have a 'starter' folder that has a CSS folder, a JS folder, an index.html file, etc. that I use as a guide, but I make tweaks every time I build a site, so I feel like I end up working from the last site I built instead of the starter folder most of the time. I figured there has to be a better way to setup a starting place that gets you up and running programming a site more efficiently. What do you use handle this in your workflow? Where/how do you save code snippets to reuse from site to site, etc.?


title: I've learned so much about OO programming I have no idea how to write procedural code. What's a good way to learn?

text: When I learned to program, I learned Object Oriented Programming very early on. For a while, I blundered around with my beautiful hammer, trying to use it for _everything,_ partially because I had no idea how to solve problems any other way. As I read more, I began to realize you need to use the right tool for the right job, and I quickly realized I had no other tools because I'd never learned any other style! I'm working on functional programming, and there are plenty of good books and articles about it. But what's a good way to learn procedural programming **the right way?** I have a basic idea of how to make global variables and pass state to functions, but I want to delve deeper into procedural code. I know most of the time people have to learn the other way, and procedural code is often bashed around for being unmaintainable, but I want to learn it anyway so I have more ways of approaching a problem. OOP may often be a 'better' choice, but right know its the only thing I know, and I want to branch out. I know procedural code was virtually the only style available for programming for many years, so most books don't say "we're going to teach you procedural programming!" and instead just say they'll teach you how to program, and the procedural is assumed. Those people can just find books that have OOP in size 72 font on the cover and know that's what it teaches. But I'm trying to go the other direction and feel a little lost... How did you learn procedural programming? Which books/languages do you recommend? Are there any important tips to learning the **right** way to write procedural code so its as maintainable and beautiful as possible? What tips would you give an OO junky as to how to write awesome procedural code?


title: Programming A Function in Python

text: I am quite new to programming, and was wondering if someone might be able to help me get the following working in python: Define ![$\\Phi_mx\(mn+r\)=mx\(n\)+\\frac{r}{m}\(x\(n+1\)-x\(n\)\)$](http://i.imgur.com/ZQeqIvx.gif), where we consider x(0)=0, r is always positive and less than m, and all values of n are positive integers. ![$\\Phi_m$](http://i.imgur.com/JAncAHQ.gif) takes in a string of numbers and outputs another string. How might I program this?


title: Mentoring Millennials

text: I'm in the process of revamping our company's software development internship program and the area I'm most passionate on is implementing an enjoyable and effective student/intern mentoring program. We have quite a demographic variance among our software development groups, however, the vast majority would be considered Generation-Xers. **Over the years I've seen our younger Millennial-Generation students/interns/employees struggle when working with older developers.** Software architecture, Agile principles, the importance of TDD, design patterns, all of these are important and I'm looking for insight on communicating these things to interns/students/younger professionals. I would love to hear of any good tips regarding mentoring today's incoming Millennial-Generation software developers, especially students/interns. What's worked well for you, what hasn't? What observations have you made that taught you something about a younger software developer, how they think, what they value, etc. How can we make this an experience and industry that they're excited to be a part of? Thank you very much for any and all comments.


title: Entity framework separating entities for product and customer specific implementation

text: I am designing an application with intention into making it a product line. I would like to extend the functionality across all layers and first struggle is with domain models.   For example, core functionality would have entity named Invoice with few standard fields and then customer requirements will add some new fields to it, but I don't want to add to core Invoice class. For every customer I could use customer specific DbContext and injected correct context with dependency injection.   Also every customer will get they own deployment               public class Product.Domain.Invoice      {         public int InvoiceId { get; set; }         // Other fields     }      How to approach this problem? Solution 1 does not work since Entity Framework does not allow same simple name classes.               public class CustomerA.Domain.Invoice : Product.Domain.Invoice     {         public User ReviewedBy { get; set; }         public DateTime? ReviewedOn { get; set; }     }      Solution 2 Create separate table and link it to core domain table. Reusing services and controllers could be harder.               public class CustomerA.Domain.CustomerAInvoice      {         public Product.Domain.Invoice Invoice { get; set; }              public User ReviewedBy { get; set; }         public DateTime? ReviewedOn { get; set; }     }


title: Programming languages, positional languages and natural languages

text: Some programming languages are modeled on machine code, like assembly languages. Other languages are modeled on a natural language, the English language. Others are not modeled on either machine code or natural language. Languages such as PROLOG, for example, don't follow either model. I came across this Perl module Lingua::Romana::Perligata, that allows to write programs using a syntax that is very similar to Latin. Are there programming languages that have less positional syntax? Are there other languages or modules that allow you to write in syntaxes inspired by other natural languages, like French, Hebrew or Farsi? There is a very long list on Wikipedia, but most of those projects are dead. There is a related question on StackOverflow. The answer that was accepted is "Use Google".


title: Where to put profile test?

text: I have an application with multiple threads that may be run on different hardware. To assist with tuning on different hardware I would like to create a "profiler" that can automatically run a fixed amount of data through using different numbers of threads. I've thought of several ways of implementing this:   1. It's a test, so put it in with the unit tests   2. It's also a part of the app, so make it part of the top level class running the app   3. It's a helper, so create entirely new class `Profiler` I'm leaning toward option 2, because I think it is simplest to implement and seems to fit in well. Anyone have any other ideas or comments?


title: Why GRASP patterns are less known than GOF ones?

text: Design patterns help developers to improve the quality of their design, but only GOF patterns are very known, and paterns like GRASP that gives a good concepts like Information Expert,low coupling and high cohesion are less known. I think that GRASP patterns could be a good introduction to patterns for students and developers, they will master GOF patterns better if they knew GRASP patterns.


title: Understanding exceptional cases

text: I've been studying the use of exceptions in various php projects (such as Doctrine and Zend Framework). Exceptions seem to be thrown when unordinary input/state occurs. A perfect example is Doctrine throwing an exception when you try to use a invalid query string. I think the creators of the doctrine api understood that first, you can't query data by using an invalid DQL statement, and a developer should immediately be warned that an error has occurred, rather then letting execution continue with the possibility of an error code going un-checked. I also bet that this simplifies reading the code. I can't think of a situation where you would want to use an invalid DQL statement, except unit testing. Since this is true, it's better to avoid plaguing a bunch of code with null/error checks and use exceptions. I've read in books that exceptions shouldn't be thrown when validating dating user input. I've seen examples where of where the guideline is broken. One example is the Zend framework. If supplying an invalid controller or action name, an exception is thrown. Unlike doctrine, the user has more direct control over this sort of input. I know you can configure an error controller and set up a 404 message or what have you, but I'm curious why they have used an exception in this scenario? I guess you can argue the Zend Framework does not know how to continue processing the request. One last example Is I wrote a function to return some html based on a given resource type. This resource type is hard-coded and sent when a user interacts with a web site (such as clicking a button to display the form to input data). I don't _expect_ users to be mucking around with the request type. Under normal operating conditions, the resource type should be valid. To clean up some logic, I was going to throw an exception if a particular form wasn't found. This is mainly to find the correct form associated with a resource type so proper validation can occur. Does this sound like a valid use case for an exception? Right now it's pretty trivial, but I do plan to implement a restful consumer and re-using a function to map resources to their validation services would be very useful. I can then catch the exception and based on the consumer, return an error message suitable for the request type...


title: Is a tree with nodes that have reference to parent still a tree?

text: If we make reference to the parent for each node in a tree, do we still have a tree (by definition) anymore? Wikipedia definition is: > In computer science, a tree is a widely used abstract data type (ADT) or > data structure implementing this ADT that simulates a hierarchical tree > structure, with a root value and subtrees of children, represented as a set > of linked nodes. ![enter image description here](http://i.stack.imgur.com/SXgBW.png)