title: In a team practicing Domain Driven Design, should the whole team participate in Stakeholder meetings?

text: In my experience, a Software Development Team that comprises:   * 1 Project Manager   * 1 Tech Lead   * 1 - 2 Senior Dev   * 2 - 3 Junior Dev (Fresh grad) Only the **Tech Lead & PM (and/or Senor Dev/s)** will participate in a meeting with **Clients, Domain Experts, Client's technical resource**. I can think of the ff potential pitfalls:   * Important info gets lost      1. Human error (TL/PM might forgot to disseminate info due to pressure or plain human error)     2. Non-verbal info (maybe a presentation using a diagram presented by Domain Expert)   * Maintaining Ubiquitous language is harder to build since not all team members get to hear the non-dev persons   * Potential of creative minds are not fully realized (Personally, I am more motivated to think/explore when I am involved with these important meetings) Advantages of this approach:   * Only one point of contact   * Less time spent on meetings? Honestly, I am biased & against this approach. I would like to hear your opinions. Is this how you do it in your team?


title: Binary Search Programming implementation

text: Binary Search, as we all know requires the elements to be sorted. But we have to take care of unsorted elements too, in the worst case. If the input size is very large, is it a good idea to sort the elements everytime? Can we not just check the elements that they are not sorted or not and proceed to sorting and proceed to sorting only if they are unsorted?


title: Estimation Techniques for Linux Kernel Development

text: I am working in Linux Kernel area and my work includes: code study / Understanding Porting (say from one kernel version to another kernel version) Implementation of new kernel module / Device driver How to do estimation in such Linux Kernel assignments? Is there any technique? How the community is doing?


title: Is Ubuntu workable as a laptop for an IT consultant?

text: I work as a consultant programmer, typically in large businesses. I use a Windows Laptop, and many of my colleagues use a Mac. My personal preference would be to run Ubuntu if I could have complete control over my development environment. But I will have occasional need for Microsoft specific products, especially IE. My colleagues that use a Mac often run Windows on a virtual machine for these situations. My question is: Is Ubuntu a workable solution for the laptop of an enterprise programmer? For example, is it as easy to run Windows on a VM on Ubuntu as it is on a Mac? Has anyone out there tried this? Is there any particular reason why Ubuntu would not serve as well as a Mac for development in this environment? Note that I am not doing .NET development, so I am typically dealing with Java that is going to be run on an Apache server and used by clients running Windows.


title: What language does Introduction to Algorithms by Cormen use?

text: ![enter image description here](http://i.stack.imgur.com/3ZXno.jpg) What language, if any, is used in this book? My school is currently using a terrible book for the algorithms course that I have to take next year and I'd like to convince the department head that Introduction to Algorithms by Cormen is a much, much better book.


title: Is it legal to imitate how an API looks?

text: I want to make an open-source graph thing which looks and behaves very similarly to Google Visualization API, but it would be based on Flot. Is this legal, or must I not imitate Google Visualization API?


title: What does a company typically expect from a Perl developer?

text: Are there any **common expectations** from perspective employers when they hire a Perl developer? For a student who likes Perl and Linux and would like to get a job as Perl developer, what would you recommend to learn? **I am looking for things that are generic and applicable to most/all Perl positions** , as opposed to specific details of a given company's requirements. In other words, what are the things I should be able to to/know to become more attractive to ANY company looking for a Perl developer.


title: How Does Download Size Affect Potential Users of Your Product

text: Does anyone know (or, I guess, I have gut feeling about) how the download size of a software product affects potential users, bandwidth not withstanding? For example: Does a bigger download make them believe that is it more full- featured than it is (like huge .NET Runtimes if deployed with your package)? Reason is, I'm developing a VSTO add-in where there is my add-in (small MB), the VSTO run-time, .NET runtime, and Primary Interops. This could make it more than 70 MB in total size, just for an add-in that does a couple of things well. _But that's all they are - just a couple of things._ With VSTO deployments, I know I could deploy a smaller package size by assuming they've got the .NET runtime (and when they don't, initialize the download/install of that, but it seems like a clunky way to make just an ass out of me). What I really want is for people to just download the app (the trial version) to see if they like it. Is there some kind of magic happy threshold - like users of non-big name apps are more likely to download something that is under 20 MB than 50 MB?


title: How to get GPS enabled device angle

text: I am planning to buy a GPS enabled android phone and develop an Augmented Reality application (which will point the locations in front of camera). All i found about GPS is that it just tells the location of the device, how do i get the direction where camera is pointing, and height of device? how to make compass (2D, 3D) with GPS enabled phone? Is responsibility of phone to tell the direction? **(please correct, if i asked this question at wrong place)**


title: Stack and heap - dynamic allocation question

text: Sources usually mention that dynamically created variables are allocated on the heap, while functions' variables on the stack. Also the ones on the stack cease to exist automatically when e.g. the function which contains the variable exits. If I understand correctly, data fields of class are on the heap. I do not understand, what is meant by 'dynamic'? As I see it, when the code is running, anything being created is created dynamically on the fly, be it function variables or objects with variables inside them. I would be glad for simple explanation. Thanks


title: A module which is used by most other modules

text: I am pursuing object oriented design. So we don't want to use globals but yet sometime we have a module that most other modules use. This means we have to just pass it to all other modules and this can be literally all modules!               class Logger     {     public:         Logger(void);         ~Logger(void);     };               class Calculator     {     public:         Calculator(Logger *logger);         ~Calculator(void);     };               class Taxation     {     public:         Taxation(Logger *logger);         ~Taxation(void);     };      So the idea is that the `Calculator` and `Taxation` modules use the `Logger` module to log everything. Similarly most other modules will use it too, and logging is required everywhere. Is this method okay or should `Logger` be global instead?


title: What Is The Process of Creating A Bug Bar?

text: In my company, we're working on adopting the Microsoft Secure Development Lifecycle, and part of the MSDL process involves establishing security and privacy bug bars at the onset of a project. I've heard the concept of a bug bar prior to MSDL, and I understand that it's essentially a definition of what level/amount of bugs you're willing to accept in a final product, but I've never understood how to creating a bug bar for a project. Are there any well documented processes for establishing bug bars that I can learn from? I've tried doing some Googling for examples or real world scenarios of projects defining bug bars at the onset of a project, but I can't seem to get any good results or tips on the process of establishing a bug bar. There are MSDL examples of what appear to be completed bug bars, but I'm interested in learning about the process of defining something like this. For example, for those that have done something like this before, have you defined bugs bars in a very specific way (e.g. saying "There shall be no unauthorized file system access: reading from the file system"), or have you taken a deferred approach of saying when we find bugs we'll rate them on a 1 to 5 scale (5 being the most severe), establish now that no bugs above a 3 shall be shipped, and leave your ranking of bugs until they're discovered? I feel like the trying to do the former is a foolish and impossible activity, but the later is prone to bias towards leniency when a project is coming down to the wire. Again, to wrap all of that up into a succinct question, can anyone provide me with a well documented approach for defining/creating bug bars?


title: How to completely avoid business logic in DAL?

text: In our ASP.NET MVC application, we try really hard to separate concerns to each layer (we use DDD). Nevertheless, it seems that we can't avoid having at least some business logic in DAL. For instance, there are named objects, where business requirement is that each name must be unique (but the name isn't a key). If there is a request to create new named object, the service checks whether some object with that name exists in repository, if it doesn't, factory creates new object and repository persists it (we use EF for repositories and stored procedures for query objects). The problem is with race conditions - if two requests come concurrently (it's unlikely, but possible), both requests want to create new object under the same name, in this case both checks come out negative and two objects with the same name would be created. So far, we handle that with constrains in SQL database, so if something like this happens, an exception is thrown in repository - but this approach is simply wrong, since such requirement is strictly business requirement and it shouldn't bubble to persistence layer; if we change such requirement, e.g. that names become case sensitive, such constrain would also have to be changed, etc.). How to implement such scenario correctly? Thanks.


title: What is the best way to validate the following data?

text: Lets say I receive an xml request that is sent to my web service and this request contains some data in it such as Hotel Room/Rate pairs (Room = Double Queen, Rate = 10%). The database has all of these Room/Rate pairs stored, so when the xml request comes in, I have to validate them to see if the request contains both the room and the rate in the database. If I receive one room/rate pair and it is not in the database, I fail the message and send back an error response, but if I receive 3 room/rate pairs for example, and 2 are found in the database, but one is not, I would process the succussfull ones and send back warnings for the ones that were not found. The other scenario is if I receive 3 room/rate pair and they all are not found in the database, then I want to send back an error message. What is the best way to approach these scenarios?


title: Progress bar for unknown number of items

text: I am working on a survey-based feature in our application and the survey has branching points at any given question depending on the answer given. Each path that a branch can take may not have the same number of questions. So if we evaluated each possible path that can be taken, you may end up with a different number of total questions answered each time. I've been told a progress bar is required for the survey, however I can't imagine how a progress bar could provide meaningful data in this context. We do not know how many questions must be answered until the survey ends without hindsight. Can anyone recommend a good logical solution to implementing a progress bar for such a feature? I don't need specifics. The UI system I'm using, the language I'm using, all of that is irrelevant. I want a strictly mathematical solution to this problem, should one exist. If not, then using things like estimations, averaging, or other "guesstimates" are also good but last resorts. Thanks in advance.


title: How can I cancel all running mysql queries in a web application?

text: I am running a web application which has to scan (mysql query on a particular column) a huge MySQL table, which has over 100,000 records. The problem I find that when a user requests another page from the same web application while the results are being fetched from the scan, the browser takes a long time to display the page. How can I cancel the scan (or the mysql query) while the new page is being requested?


title: Using natural language grammar in fluent API

text: I'm tinkering with a query abstraction over WebSQL/Phonegap Database API, and I find myself both drawn to, and doubtful of, defining a fluent API that mimics the use of natural English language grammar. It might be easiest to explain this via examples. The following are all valid queries in my grammar, and comments explain the intended semantic:               //find user where name equals "foo" or email starts with "foo@"     find("user").where("name").equals("foo").and("email").startsWith("foo@")          //find user where name equals "foo" or "bar"     find("user").where("name").equals("foo").or("bar");          //find user where name equals "foo" or ends with "bar"     find("user").where("name").equals("foo").or().endsWith("bar");          //find user where name equals or ends with "foo"     find("user").where("name").equals().or().endsWith("foo");          //find user where name equals "foo" and email is not like "%contoso.com"     find("user").where("name").equals("foo").and("email").is().not().like("%contoso.com");          //where name is not null     find("user").where("name").is().not().null();          //find post where author is "foo" and id is in (1,2,3)     find("post").where("author").is("foo").and("id").is().in(1, 2, 3);          //find post where id is between 1 and 100     find("post").where("id").is().between(1).and(100);      * * * **Edit based on Quentin Pradet's feedback** : In addition it seems, the API would have to support both plural and singular verb forms, so:               //a equals b     find("post").where("foo").equals(1);          //a and b (both) equal c     find("post").where("foo").and("bar").equal(2);      For the sake of question, let's presume that I haven't exhausted all possible constructs here. Let's also presume that I can cover _most_ correct English sentences - after all, the grammar itself is limited to the verbs and conjuctions defined by SQL. * * * **Edit regarding grouping** : One "sentence" is one group, and the precedence is as defined in SQL: left to right. Multiple groupings could be expressed with multiple `where` statements:               //the conjunctive "and()" between where statements is optional     find("post")       .where("foo").and("bar").equal(2).and()       .where("baz").isLessThan(5);      * * * As you can see, the definition of each method is dependent on the grammatical context it is in. For example the argument to "conjunction methods" `or()` and `and()` can either be left out, **or** refer to a field name **or** expected value. To me this feels very intuitive, but I would like you hear your feedback: is this a good, useful API, or should I backpedal to more straighforward implementation? For the record: this library will also provide a more conventional, non-fluent API based on configuration objects.


title: What is the preferred way of communicating between applications on the same system?

text: I'm designing a system that is built on several small applications written in python, some of these will be services and others will be programs that only run during special situations. What I need to achieve is to let the server communicate to a service when a certain event occurs with some small amount of data. So that the service knows about the new situation and can take the appropriate action, sometimes immediately and sometimes in the future. I've been looking at memcached, but it seems like an overkill solution for my system (which is just a few separate applications running on a raspberry pi), or writing to files and using something like pyinotify but I don't think that is very elegant and finally I've been thinking about storing state in a database which I also don't like very much. Are there any preferred ways to handle this sort of communication between processes that I haven't thought of(I'm sure there is) or which of the above mentioned ones would be the smartest to go with?


title: How do cloud platforms-as-a-service measure CPU time?

text: I'm currently assessing Google App Engine, and one of the answers from Hidden limitations of Google App Engine? stated: > Performance will surprise you. GAE is optimized for many tiny queries and > you get warned if a query takes any CPU time at all. You get 6.5 (at last > check) free hours per day, but it's a mystical number and you should test. > > You'll find that time as you measure it doesn't relate to the CPU or > datastore CPU time, because (for example) under the covers there might be > multiple machines updating indexes during deletes/updates. Some users have > found huge CPU usage when uploading bulk data - many hours of usage for e.g. > 20 min of real time. > > Your Java instance might need to be powered-up if it hasn't been hit in (I > think) 20 minutes. The benefit is that they can pass their smart management > on to you as cheaper costs, but it does mean you'll experience a short > delay, and see a high CPU warning on the first request in a while. > > For many cases, Python datastore access is faster than Java JDO. You'll > likely find that using the low-level API for Java faster. > > Some developers seem to have experienced more datastore errors thank you > would expect (around 0.4-1% maybe?). I haven't yet. I'm wondering what factors go into determining a PaaS's CPU time (like, in this case, the 6.5 hours free that you get with GAE). For example, does it include the total time it takes for the database to transfer data over to the client? Do the costs under this model increase dramatically as you get more users?


title: SMTP traffic forward/relay?

text: We have three different networks. Regular, Trusted, Secure. Regular has access to the internet and trusted. Trusted has access to regular, internet and Secure. Secure has access to Trusted. We used to have a local SMTP server but the powers that be decided to move it, externally. Now the secure network does not have access to it. For my own home grown code that runs in secure I have written a .Net Web service to send email. This works great. The problem is that we cannot modify canned applications the best we can do is change the server address and the port of the SMTP server. I set out to write my own SMTP server that basically forwards the message to the external SMTP server. Probably easy enough but it will take some time. I am hoping someone out there knows of a solution that we can purchase or another way of doing what we need.


title: Will a program ever crash if the main loop is put in a try/catch block

text: If we have a class main and the constructor of main constructs our setupclass and we put this class in a try catch in main. Theoratically Will all errors go into catch? If they will how will it effect the performance and mantainability? Will the application be crash free?


title: Does your team develop their supporting tools or this should be outsourced out of it?

text: By supporting tools, I mean:   * **reference data manager** , like virus definition for anti-virus software   * **test data generator**   * **level builders** for games   * **simulators** or advanced mocking systems > Does the team building the `core product` (in the case above, the game or > the anti-virus) should be part of the development of the `supporting tools` > significantly, or this is a task you would outsourced out of the team to > help it focus on the product? I don't have enough experience to evaluate the pros & cons of each, so I'm hopping you would come up with personal experiences to share, or even studies or papers you read on the subject.


title: ASP.NET MVC SoC when dealing with back end objects (design decision)

text: I had a discussion with some peers and even some technical leads in the team around this and Im all for the purist MVC approach. Especially when the project is in its infant stages (its easy to implement a pattern going forward). Im a firm believer that anything to do with the back end should be kept separate from the Views, Models and also the View-Models. A final decision was made to go with using the objects deemed pass-through because they are used everywhere, from the UI all the way back to the back end platform which handles the actual request. Here is a sample illustration of what is going to be implemented: MVC stack <-> Back end platform <-> Can either talk to a database or another 3rd party service And in the above example, a back end request object can be made in the controller level and passed through the the back end platform and there it can get adapted to suit either a database or another service. And when the database/3rd party service responds, its response is taken and adapted to one of our own types. This type will then be returned to the MVC stack. The Views and the ViewModels just use these back end platform types. What Id like to see done: Id like for the controller to pass on the responsibility to an adaptor or indeed a service layer which is responsible for taking in POCOs and creating back end platform objects. Create the request, send it off to the Back end platform. And when it responds, adapt the response into a View or a ViewModel and send it back to the controller. Objects are injected into the controller so its simply a matter of passing the POCOs to another layer to take responsibility of creating requests, sending it off and then returning a response which consists of a View or a ViewModel. Pros and cons. With the current implementation, its convenient and given that we (my company) owns the code that goes from front-end to the back end that gets used. It saves time. Which we don't have much of to get the job done. I don't see the separation of layers here. With the implementation that Id like to see done, I believe it approaches the SoC a bit more and adds down on another layer of adaptation. This is a bit more work. And, from a pure MVC point of view, its using the back end platform objects which are being used in the back end (although it was assumed that these objects will also be used in the front end). I realise this is long and doest have pretty pictures. Apologies. Id like to know what you out there would have done. Cheers.


title: Test Data in a Distributed System

text: A question that has been vexing me lately has been about how to effectively test (end-to-end) features in a distributed system. Particuarly, how to effectively manage (through time) test data for feature testing. The system in question is a typical SOA setup. The composition is done in JavaScript when call to several REST APIs. Each service is built as an independent block. Each service has some kind of persistent storage (SQL Server in most cases). The main issue at the moment is how to approach test data when testing end-to- end features. Functional end-to-end testing occurs through the UI, and it is therefore necessary for test data to be set up before the test run (this could be manual or automated testing). As is typical in a distributed system, identifiers from one service are used as a link in another service. So, some level of synchronization needs to be present in the data to effectively test. What is the best way to manage and set up this data after a successful deployment to a test environment? For example, is it better to manage this test data inside each service? Or package it together with the testing suite? Does that testing suite exist as a separate project? I'm interested in design guidance about how to store and manage this test data as the application features evolve.


title: NodeJS as an avenue towards learning JavaScript

text: I'm a backend programmer who works mainly in Python. I'll probably never want to be a full time front end developer, but with the goal of growing my skill set, I would like to become at least passably proficient in JavaScript. It seems like a language that is wearing a lot of hats nowadays, and if nothing else, I'd like to a little more knowledgable about 'their world' when I'm working with front end guys. We're using NodeJS for some server side work at my company, and I was curious about it. I've found a few good tutorials and it seems interesting. It seems like it might be a good way to familiarize myself with JavaScript, since it comes at it from an angle that I understand -- server side programming. But I am also a little worried that if I learn both at once, I won't be able to keep track of what's 'Stock JavaScript' vs features that are particular to NodeJS. What do you guys think? Is bootstrapping myself into JavaScript familiarity by learning NodeJS a good idea? Or will I just confuse myself if I jump into Node without a solid understanding of the fundamentals of JavaScript?


title: I can't program because the code I am using uses old coding styles. Is this normal to programmers?

text: I have my first real job as programmer, but I can't solve any problems because of the coding style used. The code here:   * Does not have comments   * Does not have functions (50, 100, 200, 300 or more lines executed in sequence)   * Uses a lot of `if` statements with a lot of paths   * Has variables that make no sense (eg.: `cf_cfop`, `CF_Natop`, `lnom`, `r_procod`)   * Uses an old language (Visual FoxPro 8 from 2002), but there are new releases from 2007. I feel like I have gone back to 1970. Is it normal for a programmer familiar with OOP, clean-code, design patterns, etc. to have trouble with coding in this old-fashion way? **EDIT** : All the answers are very good. For my (un)hope, appears that there are a lot of this kind of code base around the world. A point mentioned to all answers is refactor the code. Yeah, I really like to do it. In my personal project, I always do this, but... I can't refactor the code. Programmers are only allowed to change the files in the task that they are designed for. Every change in old code must be keep commented in the code (even with Subversion as version control), plus meta information (date, programmer, task) related to that change (this became a mess, there is code with 3 used lines and 50 old lines commented). I'm thinking that is not only a code problem, but a management of software development problem.


title: Developing scalable applications using Agile methods

text: Maybe someone can share from his experience about developing an application that is meant to scale big time where just throwing more money at better hardware isn't a realistic option using development methodologies such as SCRUM and XP.   1. Did you need to rewrite substantial parts of your app because of current framework couldn't scale enough to fit current sprint's stories? how do you avoid that?    2. When do you do stress (or load) testing?    3. In what stage did you make your SMART(TM) design concerning bleeding edge requirements?    4. Did you add more stages to the dev-cycle of write-a-test, code-to-pass-test, refactor?    5. Did you just refactor everything in the end to meet demands?


title: Does design by contract imply correct output?

text: Design by Contract says, in terms of the function talking: "you give me all the right parameters and I'll give you exactly this kind of data" ...in essence. So, given that, should I use up resources checking the output? I should check for properties that the function does not guarantee its output possesses, but the properties the function guarantees need not be checked, right? Here's an example:               class Transition_Manager {         string str = generate_non_null_string();         process_using_a_function_that_can't_handle_null_strings( str );     }


title: Are there flavours of OOP where some or all of the SOLID principles are antithetical to clean code?

text: I recently had a discussion with a friend of mine about OOP in video game development. I was explaining the architecture of one of my games which, to my friend's surprise, contained many small classes and several abstraction layers. I argued that this was the result of me focusing on giving everything a Single Responsibility and also to loosen the coupling between components. His concern was that the large number of classes would translate to a maintenance nightmare. My view was that it would have the exact opposite effect. We proceeded to discuss this for what seemed like centuries, eventually agreeing to disagree, saying that perhaps there were cases where SOLID principles and proper OOP didn't actually mix well. Even the Wikipedia entry on SOLID principles states that they're _guidelines_ that help to writing maintainable code and that they are part of an overall strategy of agile and adaptive programming. So, my question is: **Are there cases in OOP where some or all of the SOLID principles do not lend themselves to clean code?** I can imagine right away that the Liskov Substitution Principle could possibly conflict with another flavour of safe inheritance. That is to say, if someone devised another useful pattern implemented through inheritance, it is quite possible the LSP might be in direct conflict with it. Are there others? Perhaps certain types of projects or certain target platforms work better with a less SOLID approach? **Edit:** I'd just like to specify that I'm not asking how to improve my code ;) The only reason I mentioned a project in this question was to give a little context. My question is about OOP and design principles in _general_. _If you're curious about my project, seethis._ **Edit 2:** I imagined this question would be answered in one of 3 ways:   1. Yes, there exist OOP design principles which partially conflict with SOLID   2. Yes, there exist OOP design principles which completely conflict with SOLID   3. No, SOLID is the bee's knees and OOP will forever be better with it. But, as with everything, it's not a panacea. Drink responsibly. Options 1 and 2 would have likely generated long and interesting answers. Option 3, on the other hand, would be a short, uninteresting, but overall reassuring, answer. We seem to be converging onto option 3.


title: Can a Java interface declaration enforce parameter properties?

text: As far as I know, declaring an interface is like so:               public interface Roots_Squares {         public double square_root( double value );     }      Now... how do you enforce value to have non-negative values? Such a function should avoid negative values right? If someone creates a class that implements this, and that implementation does not handle negative values, and then I use their class with a negative value... well, things break. It then becomes my responsibility to check for negatives when I'm pretty sure the implementor should do the checking.


title: Web programming most effort?

text: To create a website   * I create Psd Files for the design (Phase 1)   * I Convert these Psd's to html/css static webpages (Phase 2)   * I add some javascript to these webpages (Phase 3)   * I start the IDE "visual web developper" to start developping (Phase 4) I have studied computer programming for the past five years and now I noticed that the corresponding phase (phase 4) of creating a website takes the least amount time and effort in entire process. All the hard work and effort seems to be focused on the graphical design and especially on converting this design to html/css. My question is, is this a common case? Do I do something wrong in my development steps ?


title: How to handle divide by zero in a language that doesn't support exceptions?

text: I'm in the middle of developing a new programming language to solve some business requirements, and this language is targeted at novice users. So there is no support for exception handling in the language, and I wouldn't expect them to use it even if I added it. I've reached the point where I have to implement the divide operator, and I'm wondering how to best handle a divide by zero error? I seem to have only three possible ways to handle this case.   1. Ignore the error and produce `0` as the result. Logging a warning if possible.   2. Add `NaN` as a possible value for numbers, but that raises questions about how to handle `NaN` values in other areas of the language.   3. Terminate the execution of the program and report to the user a severe error occurred. Option #1 seems the only reasonable solution. Option #3 is not practical as this language will be used to run logic as a nightly cron. What are my alternatives to handling a divide by zero error, and what are the risks with going with option #1.


title: How does Branch Target Prediction differ from Branch Prediction?

text: I do not understand how BTP differs from BP? Yes I understand BP evaluates whether a conditional is true/false, but surely implicitly this also determines the "target" instruction? If I predict the first branch of an IF to be true, then surely I have just determined the branch target too (the code within the predicted IF branch)??


title: Am I allowed to use text(snippets) from the iOS Developer Lib for my documentation?

text: At the moment, I create a Java-Wrapper for Apples *.pkpass-Files (Passbook). Since I need to parse a JSon-File, I planned to add java doc to every field, so one know what exactly this field is in the pkpass and how it should be displayed. (There are some other meta data which are interesting). At https://developer.apple.com/library/ios/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/TopLevel.html#//apple_ref/doc/uid/TP40012026-CH2-SW1 you can see a description of this file format. So, my question is: am I allowed to use text snippets (or the whole text) from the description column when I add also the link to the page into the java doc?


title: Memento with optional state?

text: **EDIT:** As pointed out by Steve Evers and pdr, I am not correctly implementing the Memento pattern, my design is actually State pattern. ## Menu Program I built a **console** -based menu program with multiple levels that selects a particular test to run. Each level more precisely describes the operation. At any level you can type back to go back one level ( **memento** ).               Level 1: Server Type?                  [1] Server A [2] Server B      Level 2: Server environment?               [1] test [2] production     Level 3: Test type?               [1] load [2] unit     Level 4: Data Collection?               [1] Legal docs [2] Corporate docs     Level 4.5 (optional): Load Test Type               [2] Multi TIF [2] Single PDF     Level 5: Command Type?               [1] Move [2] Copy [3] Remove [4] Custom     Level 6: Enter a keyword               [setup, cleanup, run]      ## Design ![Design](http://i.stack.imgur.com/BnufH.png) ## States ![States](http://i.stack.imgur.com/OFIvU.png) ## PROBLEM: **Right now the STATES enum is the determining factor as to what state is BACK and what state is NEXT yet it knows nothing about what the current memento state is.** Has anyone experienced a similar issue and found an effective way to handle mementos with optional state?               static enum STATES {         SERVER, ENVIRONMENT, TEST_TYPE, COLLECTION, COMMAND_TYPE, KEYWORD, FINISHED     }      ## Possible Solution (Not-flexible) In reference to my code below, every case statement in the Menu class could check the state of currentMemo and then set the STATE (enum) accordingly to pass to the Builder. However, this doesn't seem flexible very flexible to change and I'm struggling to see an effective way refactor the design.               class Menu extends StateConscious {         private State state;         private Scanner reader;         private ServerUtils utility;              Menu() {             state = new State();             reader = new Scanner(System.in);             utility = new ServerUtils();         }              // Recurring menu logic         public void startPromptingLoop() {                  List<State> states = new ArrayList<>();             states.add(new State());                  boolean redoInput = false;             boolean userIsDone = false;                  while (true) {                 // get Memento from last loop                 Memento currentMemento = states.get(states.size() - 1)                         .saveMemento();                 if (currentMemento == null)                     currentMemento = new Memento.Builder(0).build();                      if (!redoInput)                     System.out.println(currentMemento.prompt);                 redoInput = false;                      // prepare Memento for next loop                 Memento nextMemento = null;                 STATES state = STATES.values()[states.size() - 1];                      // get user input                 String selection = reader.nextLine();                      switch (selection) {                      case "exit":                     reader.close();                     return; // only escape                      case "quit":                     nextMemento = new Memento.Builder(first(), currentMemento,                             selection).build();                     states.clear();                     break;                      case "back":                     nextMemento = new Memento.Builder(previous(state),                             currentMemento, selection).build();                     if (states.size() <= 1) {                         states.remove(0);                     } else {                         states.remove(states.size() - 1);                         states.remove(states.size() - 1);                     }                     break;                      case "1":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      case "2":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      case "3":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      case "4":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      default:                     if (state.equals(STATES.CATEGORY)) {                         String command = selection;                         System.out.println("Executing " + command + " command on: "                                 + currentMemento.type + " "                                 + currentMemento.environment);                         utility.executeCommand(currentMemento.nickname, command);                         userIsDone = true;                         states.clear();                         nextMemento = new Memento.Builder(first(), currentMemento,                                 selection).build();                     } else if (state.equals(STATES.KEYWORD)) {                         nextMemento = new Memento.Builder(next(state),                                 currentMemento, selection).build();                         states.clear();                         nextMemento = new Memento.Builder(first(), currentMemento,                                 selection).build();                     } else {                              redoInput = true;                         System.out.println("give it another try");                         continue;                     }                     break;                 }                      if (userIsDone) {                          // start the recurring menu over from the beginning                          for (int i = 0; i < states.size(); i++) {                         if (i != 0) {                             states.remove(i); // remove all except first                         }                     }                     reader = new Scanner(System.in);                     this.state = new State();                     userIsDone = false;                 }                      if (!redoInput) {                     this.state.restoreMemento(nextMemento);                     states.add(this.state);                 }             }         }     }


title: Two contradicting definitions of Interface Segregation Principle – which one is correct?

text: When reading articles on ISP, there seem to be two contradicting definitions of ISP: According to first definition ( see 1, 2, 3), ISP states that classes implementing the interface shouldn't be forced to implement functionalities which they don't need. Thus, fat interface `IFat`               interface IFat     {          void A();          void B();          void C();          void D();     }          class MyClass: IFat     { ... }      should be split into smaller interfaces `ISmall_1` and `ISmall_2`               interface ISmall_1     {          void A();          void B();     }          interface ISmall_2     {          void C();          void D();     }          class MyClass:ISmall_2     { ... }      since this way my `MyClass` is able to implement only the methods it needs ( `D()` and `C()` ), without being forced to also provide dummy implementations for `A()`, `B()` and `C()`: But according to the second definition ( see 1 , 2, answer by Nazar Merza), ISP states that `MyClient` calling methods on `MyService` shouldn't be aware of methods on `MyService` that it doesn't need. In other words, if `MyClient` only needs the functionality of `C()` and `D()`, then instead of               class MyService      {         public void A();         public void B();         public void C();         public void D();     }          /*client code*/           MyService service = ...;     service.C();      service.D();      we should segregate `MyService's` methods into _client-specific_ interfaces:               public interface ISmall_1     {          void A();          void B();     }          public interface ISmall_2     {          void C();          void D();     }          class MyService:ISmall_1, ISmall_2      { ... }          /*client code*/     ISmall_2 service = ...;     service.C();      service.D();      Thus with the former definition, the goal of ISP is to " _make the life of classes implementing IFat interface easier_ ", while with the latter the goal of ISP is to " _make the life of clients calling methods of MyService easier_ ". Which of the two different definitions of ISP is actually correct? **@MARJAN VENEMA** **1.** > So when you are going to split IFat into smaller interface, which methods > end up in which ISmallinterface should be decided based on how cohesive the > members are. While it makes sense to put cohesive methods within the same interface, I thought with ISP pattern the needs of the client take precedence over the "cohesiveness" of an interface. In other words, I thought with ISP we should lump within the same interface those methods needed by particular clients, even if that means leaving out of that interface those methods that should, for the sake of cohesiveness, also be put inside that same interface? Thus, if there were lots of clients that will only ever needed to call `CutGreens`, but not also `GrillMeat`, then to adhere to ISP pattern we should only put `CutGreens` inside `ICook`, but not also `GrillMeat`, even though the two methods are highly cohesive?! **2.** > I think that your confusion stems from the a hidden assumption in the first > definition: that the implementing classes are already following the single > responsibility principle. By "implementing classes not following SRP" are you referring to those classes that implement `IFat` or to classes that implement `ISmall_1` / `ISmall_2`? I assume you're referring to classes that implement `IFat`? If so, why do you assume they don't already follow SRP? thanks


title: How long for a java developer to be able to start programming in C#?

text: I am working on a project that will be acquiring four new Java developers (mid-to-senior level). They will be responsible for writing code for web services and an event-driven UI. This is a .NET project using C# and WPF. We have ten weeks to create a substantial amount of new functionality. Project management has called our time line "aggressive but achievable." The new developers have limited to no experience in .NET. Assuming the new developers are very-talented, how many weeks before they can begin contributing to the project? Or are we doomed? I realize I'm giving very few details, but I would welcome even the roughest of estimates.


title: How do you phrase “it's open source, submit a patch” so that it's friendly?

text: In the answers of _What's the canonical retort to "it's open source, submit a patch"?_, many people voiced the opinion that simply asking people to submit a patch is arrogant and rude. But it seems to me that as a developer on any open source project, you will see many more feature requests on the mailing list than you could possibly implement. So when a user says, "I would like to see feature X", the truth of the matter is usually that the chances of it getting implemented are pretty slim unless they submit a patch themselves. Also, sometimes a little encouragement might be all that's needed to turn a user into a contributor. On the other hand, you don't want to scare (potential) contributors away by coming off as rude. So how would you say "please submit patches instead of asking for features" in a friendly manner? **Update:** Thanks for all the suggestions! I see most of them require pretty lengthy explanations. But since I'd rather avoid either (a) explaining the same thing every other day (it just takes too much time), or (b) using snippets that I paste into email (it gets impersonal real quick), I wonder: Has anyone written this up in a document that I can link to? (Project-specific things like how to write tests, compile the code, and submit the patch still need to be documented of course, but I think those technical issues should go into CONTRIBUTING.txt anyway.)


title: Need help with algorithm for sorting list

text: The answer is probably obvious but not to me at this moment, so I was wondering if somebody who is better with sorting algorithms can help lead me in the right direction. This is not homework, I am legitimately trying to work within an existing design for something work related. Essentially I start with an unordered list of data objects that represent something similar to forum comments. These objects MAY explicitly have one and only one direct parent. In other words > Parent (1...*) ----------- (1...1) Child A child has a reference to its parent, however a parent cannot see its children (explicitly). Typically when sorting a list one would pass a comparator which given any two data objects in the collection should return an integer number that represents the distance between the two objects in a graph. The distance between two completely unrelated comments will be based on the Timestamp value of the data object. The issue is that any two data objects can and should only be compared by timestamp with other data objects from the same parent branch. Here is an example: > DO1 - Time(1000ms) > > |___DO3 - Time(5000ms) > > DO2 - Time(2000ms) DO1 and DO2 compared will result in a negative number so those two are sorted correctly relative to each other. DO3 to DO1 is likewise correct because I can assume that any branch above a comment must be less than. The problem comes with comparing DO3 to DO2. I thought that I should compare the highest order parent to DO2 in this case and that works until there are DO children under DO3. I am trying to figure out if the current object graph is even enough information for a comparator to correctly return an appropriate number for any two comparisons. Perhaps the comparator needs to be initialized with the unordered list first so that it can build a tree structure where I can see a list of children from any given parent explicitly? Or perhaps I need to refactor? At this stage I am not concerned about performance. Thank you.


title: Should a programmer worry about the technology stack of the shop?

text: This question might only be applicable to entry/junior level positions. Question:   * Let's say you're a Java/Open Source developer. Should you consider positions where the technology stack of the shop is C++/.NET?   * Lets assume that the shop is interested in hiring you because they are impressed by your strong algorithmic skills. And the fact that you are a Java programmer does not matter to them at all. The question is - Should this be an issue that should bother an entry/junior level developer? Should the applicant then make an acceptance decision based on other criteria such as the domain that one would be working on? Perks? Salary? Career growth? etc.?


title: Alternative IDEs

text: After seeing http://www.kickstarter.com/projects/ibdknox/light-table I'm wondering if anyone has come across other alternative methods of developing. When working on embedded things Notepad++ was ample, which isn't necessarily an IDE but it is a different way of handling things from using Xcode, Visual Studio, or Eclipse. And even JDeveloper follows the same design as those. As OS X and other OSes change, along with website methodologies, app structures, frameworks, can we start changing how we develop? I've also seen quite a few "code on your iPad" apps. Will we eventually move away from coding as we know it? Will there be a split? Can something like Light Table bring even low level C++ coding into the next generation of enterprise or embedded level development? Especially since I feel like a small minority who even takes advantage of some non-default IDE settings such as custom syntax coloring (once you go Zenburn you don't go back)


title: How to determine the priority and severity of a "code improvement"?

text: We have "priority" and "severity" fields in our bug tracking system. We define severity as "how it impacts the user" and priority as "how it impacts the product". My question is about how to categorize a "code improvement" task in severity and priority. Suppose the improvement does not change any behavior but makes it a "better code". We anticipate a long term maintenance improvement overall but it's hard to quantify. When we use our definitions for priority and severity, a code improvement gets the lowest values for both unless you introduce some hard to predict long term benefits into the picture. Therefore it implies that code improvement is a frivilous task and should never be attempted. However I believe it's cruical to constantly improve and refactor the code, because:   * Software development is itself a continuous learning process and without improving the code you can't get better at it.   * A team should be proud of their code.   * Future maintenance will take less time and over the long run savings will be significant. Or do you think such tasks should never be created and such improvements performed only "on demand", "when associated with a bug"? Even if it's associated with a bug, wouldn't that be a discussion point on a code review, e.g. "why did you do this drastic change in structure?".


title: Why is it unrealistic to expect all browsers to support the same standards?

text: Ideally, we would have different browsers supporting the same standards and same code producing the same result on all browsers. That hasn't happened yet. What are the reasons why?


title: Which spoken languages should I try to support in my android application?

text: I'm developing a small android app, which is regional independent. I'm curious, which language should I try to support? At the moment I'm only sure to support the languages I speak fluently. This is German and English. But what about French, Spanish or Japanese...? Are there any statistics out there to help determine which to support? P.S.: Should I use maybe crappy automatic translation, if I don't know a native speaker, or should I forget about it otherwise?


title: How to deal with necessary workarounds in software?

text: Even with detailed specifications for exchanging data between computer programs, chances are that data generated by older versions of programs do not conform 100% to the specification, or that they use old obscure features which few people know how to implement them. As a result, companies have to keep a library of "odd specimens" for testing their software. In good software design, these quirks can be confined into a small layer of libraries called "Abstraction Layer". However, most abstraction layers cut off too many functionalities (in order to prevent the higher level software from touching the unstable parts of the lower level software). Sometimes it is not possible to completely hide away the unstable parts. What are the strategies for coping with such necessary workarounds? _((Please pardon my poor language skills.)_


title: Is converting/casting a boolean to int a good idea?

text: **Note:** Even though this contains Python, it's not specifically about Python. It's more generally about expecting a certain behaviour from a language which is not necessarily the same across compilers/interpreters. * * * So I came across this question: > How do I convert a boolean to int in Python? Can I just do `int(mybool)`? My response was to write:               1 if mybool else 0      My reasoning was that blindly "casting" to `int` would rely on the internal implementation of the compiler/interpreter. And who knows, if running through a different interpreter `int(mybool)` might return something else. Explicitly stating the value for a "truthy" value and for a "falsey" value will always yield the expected behaviour. This is surely something which one can consider for most languages. Am I too picky about this? I know that I have written `int(mybool)` myself in the past. And that question made me think: Was that okay? Given that this is a very common case, are the compilers/interpreters smart enough to to "the right thing" for bool -> int conversions? Now, for the special case for duck-typing languages like Python, `int(mybool)` might certainly be a really bad idea, but other languages are a bit clearer on their typing.


title: Is there a good way to communicate the intent that a class only contains referentially transparent methods?

text: My workplace mostly uses C# for writing code. I'm trying to figure out a good way to indicate that a class with referentially transparent methods is intended to be referentially transparent (i.e., given the same set of arguments, you will always get the same return value) for future maintainers. I've considered just using static classes for classes that are intended to only contain referentially transparent methods but received pushback from my colleagues as they prefer an approach to unit testing where all classes depending on are stubbed out which they use constructor DI to accomplish. I don't see a disadvantage to not stubbing out referentially transparent functions for unit testing since they are almost always in-memory anyway but I've been unable to convince my colleagues of that. Our class names use typical OO pattern names like DTO or Factory or Controllers and Models for namespaces. I'm not aware of any pattern names in OO that would indicate the sort of intent I am going for (i.e., to not introduce side-effecting operations or depending on things that read out of the db or filesystem).


title: Syncing objects to a remote server, and caching on local storage

text: What's the best method of sycing objects (as JSON) to a remote server, with local caching? I have some objects that will pretty much just be plain-text with some extra meta-data. I was thinking of perhaps including a "last modified date" for both Local storage and Remote storage. This could then be used to determine which object is the most recent. For example, even though objects will be saved to both local and remote when they are saved, sometimes the user may not have internet access, or the server may be down, or any other number of things. In this case, the last modified date for remote storage would be reverted to its previous date. Local storage would remain as it is. At this point, the user could exit the application, and when they reload the application would then look at the last modified dates of the local and remote storages, and decide. Is there anything I'm missing with this? Is there a better method that I could use?


title: How important is using the same language for client and server?

text: I have been evaluating architecture solutions for a mobile project that will have a web-service/app in addition to native apps and have been looking at various libraries, frameworks, and stacks like Meteor, this being a sort of "open stack package framework", is tightly bound with Node.js. There is a lot of talk about the benefits of using the same language both client and server side, and I'm not getting it. I could understand if you want to mirror the entire state of a web application on both client and server but struggling to find other wins... Workflow efficiency? I'm trying to understand why client/server language parity is considered to be a holy grail. Why does client/server language parity matter in software development?


title: Contradiction of layered design and global data access for analytics reporting

text: While developing an application (mobile app for Android), our team always strives to use best development practices such as interfaces, layering and separation of concerns. When it comes to reporting analytics events from our app, the requirements sometimes force us to send events with data that is stored and managed by multiple different app "components". Some of this data is not directly available at the component/layer that does the reporting, **nor at any central location** in the application. To me, this seems like it contradicts all the efforts of architecture and design that were made during the development of the application. **My question is** : What is the correct way to deal with this issue? Is the problem in the requirements we received, or is it a common issue that a layered/modular application sometimes needs to make things "global" ? if so, what is the way to solve this issue while still reaping the benefits of development best practices?


title: How to deal with or survive with the information overload

text: I will better explain my question. I have been struggling with this for long time Everytime i want to read something for e,g book on java , then i find so much stuff like many tutorials , many ebooks that i am not able to decide which one to choose. I spend some time reading one , then 2 and so on and in the end i leave and gain nothing. I like the old days when we had only few resources like one hard book and at least i finish that from start to finish and gained much but now days there is so much information that mind jumps from one source to other and gain nothing what should i do


title: Why multiple calls to same classes' Constructor from within a Constructor wouldn't work?

text: Please have a look at following snippet:               public class Foo {     int digit;     String name;          Foo (int d, String n) {         this(d);         // cannot do following.         //compile-time error: Constructor call must be first statement in a Constructor          //this(n);     }          Foo (int p) {         digit = p;     }          Foo (String q) {         name = q;     }      What would be the reason of this restriction? I understand why call to Constructor (both in a Constructor or in a method) has to be first statement - the object should be initialized properly before it is used. What I don't get is compiler not allowing calling multiple constructors of the same class from within a constructor. I don't see any problem with this construct - both regarding initialization and invarients. It'd be great if someone can shed some light on what I am missing here... Thanks!


1. How to explain DependencyProperty using real world analogy?   2. Why is it needed?


title: When creating an library published on CodePlex, how "bad" would it be for the unit-test projects to rely on commercial products?

text: I have started a project on CodePlex for a WebDAV server implementation for .NET, so that I can host a WebDAV server in my own programs. This is both a learning/research project (WebDAV + server portion) as well as a project I think I can have much fun with, both in terms of making it and using it. However, I see a need to do mocking of types here in order to unit-testing properly. For instance, I will be relying on HttpListener for the web server portion of the WebDAV server, and since this type has no interface, and is sealed, I cannot easily make mocks or stubs out of it. Unless I use something like TypeMock. So if I used TypeMock in the unit-test projects on this library, how bad would this be for potential users? The projects are made in C# 3.5 for .NET 3.5 and 4.0, and the project files was created with Visual Studio 2010 Professional. The actual class libraries you would end up referencing in your software would of course not be encumbered with anything remotely like this, only the unit- test libraries. What's your thoughts on this? As an example, I have in my old code-base, which is private, the ability to just initiate a WebDAV server with just this:               var server = new WebDAVServer();      This constructs, and owns, a HttpListener instance internally, and I would like to verify through unit-tests that if I dispose of this server object, the internal listener is disposed of. If, on the other hand, I use the overload where I hand it a listener object, this object should not be disposed of. Short of exposing the internal listener object to the outside world, something I'm a bit loath to do, how can I in a good way ensure that the object was disposed of? With TypeMock I can mock away parts of this object even though it isn't accessed through interfaces. The alternative would be for me to wrap everything in wrapper classes, where I have complete control.


title: Cloning of website

text: I'm a freelancer in a freelance job site and I started the work with a client in a project with a contract on this freelance job site. Until now all is OK.Firstly I started but developpement of some issues and I guessed he want relooking a site already exist on line,today in the next task of job I found that the client wants to clone the site from another one not relooking and he is not the admin of the site to clone. He will provide me a different template (not the same logo and color) but with the content about the same. My questions are:   * If this method of cloning is illegal, will it be his responsibility to deal with the legal issues? Maybe I'll create for him just the server side code. Will that mean I'll have any responsibility if the admin of the other site asks him about the copyright violation?   * Can I do this in a painless way? I'll make him the code, and when the contract is done, will it be OK for him to launch the site by his own name and domain? Please I make some modifications,can I have a serious answer and please reply just if you are sure and maybe you had the same issue...


title: Should I refactor large functions that mostly consist of one regex?

text: I just wrote a function that spans approximately 100 lines. Hearing that, you are probably tempted to tell me about single responsibilities and urge me to refactor. This is my gut instinct as well, but here is the issue: The function _does_ one thing. It performs a complex string manipulation, and the function body consists mostly of one verbose regex, broken up into many lines that are documented. If I broke up the regex into multiple functions, I feel like I would actually _lose_ readability, since I am effectively switching languages, and won't be able to take advantage of some features regexes offer. Here now is my question: **When it comes to string manipulation with regular expressions, are large function bodies still an anti-pattern?** It seems like named capture groups serve a very similar purpose to functions. By the way, I have tests for every flow through the regex.


title: What's the best way to hold features in a database?

text: taking for example an application that holds **Companies** and as we move along time, more and more features are needed. I do tend to hold everything in the `Companies` table, but I rather get some input as I'm starting a new project and was wondering if I should keep those in a `CompanyFeatures` table: ![enter image description here](http://i.stack.imgur.com/4qCrV.png) Should I have 2 tables, or this flow is enough? I have the same for users, each user has it's own on/off feature (when a feature can be user specific), should I continue to keep them there, or should also create a `UserFeatures` table to hold such information? Every time I get a company, all of their associated features information needs to be "glued", but it's an easy join and the query will be cached for the next request... Querying the DB should never be a problem, my question is more about design patterns and if such information should have it's place.


title: Is it possible to build a single game to run in Facebook & Google+?

text: I was asked by my customer to build a Facebook game. The game would be something similar to Mafiawars.com where the game is hosted on a server and run through a frame on Facebook. The thing is after several days of negotiations with the customer and near the finalization of the requirements he mentioned something strange. He said that if the game was successful on Facebook then we may add it to Google+ too. I thought he meant that we'll develop a new version for Google+, but he refused as he argued that the game should be able to support both sites and he won't pay for the same game twice. Now I haven't developed neither Facebook nor Google+ games before, so I don't know if it is possible to build a single Facebook/Google+ game.   How would you react to such requirement? How would you design such an application? **Notes**   1. I confirmed with the customer that he wasn't talking about using Open ID he wanted full integration (sharing post, friend requests,..etc.)   2. I really don't want to lose that customer for numerous reasons (He even agreed to extend the project time to compensate for the time I need to learn Facebook/Google+ APIs)


title: When to use Interface variable = new class variable OOP

text: I saw often people use this code like               interface IAnimal      {         void die();     }          class Cat : IAnimal      {         void die() { ... }         void meow() { ... }     }          IAnimal anAnimal = new Cat();     Cat aCat= new Cat();      C# knows for sure anAnimal.die() works, because die() is defined in IAnimal. But it won't let you do anAnimal.meow() even though it's a Cat, whereas aCat can invoke both methods. Why and when we should write this kind of code:               IAnimal anAnimal = new Cat();      What is the advantage?


title: Using a GPLv3 Python module, will my entire project have to be GPLv3 licensed?

text: I'm working on a small project right now that I plan on releasing under an open-source license (haven't decided which yet). The question I have is that one of the Python modules I use is licensed under GPLv3. Since I'm not making any modifications to the library (using it as-is), can I still license my project under a license of my choosing or will I be forced to also make it GPLv3?


title: How to measure the success of a small software project?

text: I'm part of a 7 person software development team which supports a company with a few thousand staff. Our team is putting together a quick review process for measuring the success of a software project. Projects are mostly internal, which means our "customers" are more often than not other staff. Projects are reasonably small (generally 100 to 1000 hours). Our review process will need to have a few aspects to it, probably including:   * A questionnaire sent to the customers (filled in by people in a variety of roles if possible, such as managers who may not be users of the software, and users), looking at the ease of use, quality of documentation, incident response, value for money, reliability.   * Cost compared with the budget. Estimated development time compared with actual time would be looked at here too.   * Security, if applicable.   * Maintainability, such as how easy it is to log in as a particular user to replicate problems, and how easy the code is to follow.   * Technical documentation, such as instructions on setting up development environments and test data. Is there anything glaring I've missed, or anything that should have a particularly strong (or weak) focus?


title: Why do Core Data sqlite table columns start with 'Z'?

text: I was looking at the sqlite table that Core Data generates and noticed that all table columns start with 'Z'. I realize this is an implementation detail, but I was curious as to why that's the case and if there was a design decision involved in this. Anyone happen to know or guess why? Here's a sample schema output of Core Data sqlite database:               sqlite> .schema     CREATE TABLE ZPOST ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZPOSTID INTEGER, ZUSER INTEGER, ZCREATEDAT TIMESTAMP, ZTEXT VARCHAR );     CREATE TABLE ZUSER ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZUSERID INTEGER, ZAVATARIMAGEURLSTRING VARCHAR, ZUSERNAME VARCHAR );     CREATE TABLE Z_METADATA (Z_VERSION INTEGER PRIMARY KEY, Z_UUID VARCHAR(255), Z_PLIST BLOB);     CREATE TABLE Z_PRIMARYKEY (Z_ENT INTEGER PRIMARY KEY, Z_NAME VARCHAR, Z_SUPER INTEGER, Z_MAX INTEGER);


title: Which Web API routing attribute style is preferred?

text: You can do it this way:               [Route("api/DeliveryItems/{ID:int}/{CountToFetch:int}")]      ...calling it like so:               http://localhost:28642/api/deliveryitems/N/N      ...which has the benefit of the routing attribute documenting exactly which args the methods needs. Or you can do it this way:               [Route("api/DeliveryItems")]      ...calling it like so:               http://localhost:28642/api/deliveryitems?ID=N&CountToFetch=N      ...which has the benefit of having a clear "separation of concerns" (or perhaps "separation of context" or "separation of intent"), so that path info is one thing, args are another, and never do the twain meet (in the routing attribute string, at any rate). Any powerful reasons to opt for one style over the other?


title: Does the GPL allow anyone to obtain GPL software without paying for it?

text: I've spotted a nice WordPress (GPL) theme for sale. I know somebody who bought it. I have 2 questions:   1. Has the company selling it the obligation to send the source code to whoever (customers or not) ask it?   2. Can the person who bought it give me a copy for free which I could use in production?


title: Ways of Gathering Event Information From the Internet

text: What are the best ways of gathering information on events (any type) from the internet ? Keeping in mind that different websites will present information in different ways. I was thinking 'smart' web crawlers, but that can turn out to be extremely challenging, simply because of the hugely varied ways that different sites present their information. Then I was thinking of sifting through the official twitter feeds of organisations, people with knowledge of events .. etc and look for the event hash tag, grab the tweet and dissect it to grab the relevant information about the event. Information I am interested in gathering is: **Date** and **Time** of Event, **Address** where Event is being held, and any **Celebrities (or any famous people) attending** the event (if any). The reason to ask here is my hope that experienced folk will open my eyes to things I've missed, which I am sure I have.


title: Is there a limit on the number of threads that can be spawned simultaneously?

text: Yesterday I came across this question: How can i call robocopy within a python script to bulk copy multiple folders?, and I though it might be a good exercise for multithreading. I though of spawning as many threads as files needed to be copied, each routine having an exception handling system to prevent the whole copying process from crashing (and log -using mutex on the log file - if there was an error). My question: **Is there a limit on the number of thread you can spawn almost simultaneously? If yes, what is the limiting factor?** My question is focused on PC desktop, but I welcome any answer on different hardware (embedded systems, calculus clusters, etc.).


title: What is the order analysis of the following (using a list of primes)

text: I have the following program: Iterate `x` from 1 to `N`. Check to see if `x` is prime. If it is, add it to a list of primes. The way I check to see if it is prime is iterating through the current list of primes, and seeing if they can divide `x` evenly. What is the order analysis of this program? I don't think it is `O(n^2)`, because the growing list of primes certainly doesn't increase at the rate of `n`. I don't it is `O(nlog(n))`, either. How would I perform order analysis of the function?


title: What is the difference between functional relational programming and functional programming?

text: After reading both this thread and the linked paper, I don't understand how FRP (functional relational programming) is different from (FP) functional programming. Does FRP augment or replace FP? Can FRP be implemented as a library in an FP language?


title: Is comparing an OO compiler to a SQL compiler/optimizer valid?

text: I'm now doing a lot of SQL development at my new job where as before I was doing Object Oriented desktop app stuff. I keep running across very large scripts (thousands of lines) and wanting to refactor in some way. I am seeing that SQL is a different sort of beast and it's probably fine to have these big scripts for the most part but while explaining this to me people are also insisting that the whole _idea_ of refactoring is bad. That stuff like the .NET compiler are actually burdened by refactored code and that a big wall of code is more efficient and better design than code designed for reuse, readability and scalability. The other argument is that OO compilers are almost dangerously inefficient and don't have efficient memory management or runs too many CPU instructions compared to older "simpler" compilers and compared to SQL. Are these valid complaints? Even _if_ some compiler like a C compiler is modestly more "efficient" (whatever that means on this high of a level without seeing code) would you want to write applications in C over C# or Java? Is comparing an OO compiler to a SQL compiler/optimizer even valid?


title: Do software developers know what engineers actually do?

text: Software development is often contrasted with the traditional branches of engineering, most commonly civil or mechanical engineering. For example:   * "Software development isn't like engineering, it's like craftsmanship!"   * "Software development isn't like engineering, but it should be!" Do software developers understand what it is that engineers do and how they do it? At least, do they understand it well enough to be able to make an informed comparison with what software developers do?


title: Is it normal for a company to have programmers on such a rigid schedule?

text: So I've been working at this job for a couple of months. I'm a little frustrated because I do my best work from 2 to 7. In previous jobs, I've come in at 9:30-10:00 and leave at 7. Some companies have been okay with this, others have not. But my current company insists on my being there at 8:30. Any deviation from this is a big deal. Is this typical? I have colleagues who are more 9:30 to 6:30, 10:00-7:00 guys...but maybe that is just startup culture? I don't see why, given that I don't meet clients, etc. what the advantage to having things be so rigid could be. I also don't see why if there is 15 to 20 minute variation sometimes in coming in, why people don't just assume that I will adjust when I leave... Are these unreasonable expectations as a developer or am I missing something?


title: Authentication with If/Else

text: For keeping the "Administration Panel" secure to those who are logged in, for my web application, is the best practice to use an If/Else Statement?               if($_SESSION['logged_in'] == true) {        include '../styles/templates/admincp/header.php';        include '../styles/templates/admincp/content.php';        include '../styles/templates/admincp/footer.php';     }     else {        include '../styles/templates/login.php';     }      Is this how the "professionals' (such as CMS creators, etc) do this authentication style? OR is there a completely better route and method to the If/Else statement to authenticate pages for logged in users to access?


title: How to get familiar with "what happens underneath of Java"?

text: I did not study CS nor IT. I just became a developer, now working with Java. Actually, since I now work with a big company writing high-scalable web applications, I think I need to be better with details. I have no understanding of what happens underneath of Java. Java Performance, Server-Side Java might be the buzz words?!! I am very poor with those more of low-level details but I do not know where to look honestly. I started looking for some keywords in Amazon, ended up reading books like "pragmatic programmer", "clean code", "code complete" which IMO they are not what I am looking for. Could you please give me some learning resources (books, articles, blog posts, online trainings) for this matter? I also read this post as well: Approaching Java/JVM internals But I think I need a pre-step before jumping into the OpenJDK, right?!


title: What is the difference between dependent typing and contracts?

text: What is the difference between dependent typed languages and languages like Spec# and Eiffel that allow you to specify "contracts" for functions in your code for pre/postconditions? Is dependent typing basically the purely functional version of Eiffel's "contracts"? From what I understand, dependently typed languages let you specify your function's pre and post conditions using predicate logic as part of the type. Eiffel's concept of contracts seems to be similar, but based on imperative programming, not functional programming.


title: Core data syncing (deletion) using a custom REST web service

text: I need to sync my local core data stack against a server running a persistent data storage underneath the covers. (I've gone through other posts here and on SO on similar topics) My requirements:   1. One way syncing. Meaning my server is always updated and my clients just merely need to be fed incremental deltas which they feed into their core data stack.   2. The server could arbitrarily insert new records, modify existing ones or even delete them. I would rather not use RestKit because I can do the work of making queries and updating local state myself. I don't need an extra library to do this. My solution: I keep a last updated date (UTC) locally. I send this date to my server periodically and my server responds with the data I need to update or insert, based on a server timestamp for each record. **My problem:** I don't know how to handle deletes. How would I handle deletes in such a scenario? If I delete the record from the server, how will clients know to delete that record as well. Thoughts? I can think of a number of complicated ways to do it (e.g. don't really delete the record, or keep track separately of deleted records, etc.), but I'm looking for the simplest.


title: Why are pointers to literals not possible?

text: Reference to a literal is possible only if the reference is declared as constant. But why is a pointer to a const object not possible in case of literals? i.e.               int const& ref = 5;//      But why is the same feature not available for a pointer, pointing to a constant object?


title: Best practice for comments above methods in a grails application?

text: I'm writing a grails application and am not sure what the best practice is with regard to comments outside of method blocks. I've done a bit of research and there seems to be conflicting views on how and when these sort of comments should be used. In lots of source code I have seen there seems to be comments above every method detailing what that method does. I'm not sure if grails should be differnet? My question is should I have a comment above each method in my controllers, services and domain objects? i.e               /*     * This method displays the index page     */     def index(){     render view : "index"     }


title: Is it ever justifiable to write code without tests when doing TDD?

text: Is it ever justifiable to write production-code without also writing tests for it when doing Test Driven Development?


What are the most common mistakes and anti-patterns NHibernate user programmers make? Please explain why those are bad practices or give link to resource for further reading. **For example:**   * One anti-pattern common for new NHibernate programmers is to use identity/native POID's instead of ORM style onces. Read more here...


title: Is it a code smell if an object knows a lot of its owner?

text: In our Delphi 2007 application we are using a lot of the following constructs               FdmBasic:=TdmBasicData(FindOwnerClass(AOwner,TdmBasicData));      The FindOwnerClass travels the Owner hierarchy of the current component upwards to find a specific class (in the example TdmBasicData). The resulting object is stored in the Field variable FdmBasic. We use this primarily to pass datamodules along. Example: When generating a report, the resulting data is compressed and stored in a Blob field of a table accessed through a datamodule TdmReportBaseData. In a separate module of our application, there is functionality to show the data from the report in a Paged form using ReportBuilder. The main code of this module (TdmRBReport), uses a class TRBTempdatabase to convert the compressed blob data into different tables that are usable in the Reportbuilder runtime reportdesigner. TdmRBReport has access to TdmReportBaseData for all kinds of report-related data (type of report, report calculationsettings, etc). TRBTempDatabase is constructed in TdmRBReport but has to have access to TdmReportBasedata. So this is now done using the construction above:               constructor TRBTempDatabase.Create(aOwner: TComponent);     begin       inherited Create(aOwner);            FdmReportBaseData := TdmRBReport(FindOwnerClass(Owner, TdmRBReport)).dmReportBaseData;     end;{- .Create }      My feeling is that this means that TRBTempDatabase knows a lot of its owner, and I was wondering if this is some sort of code smell or Anti-pattern. What are your thoughts about this? Is this a code smell? If so, what is a better way?


title: Why do so many websites prefer "git rebase" over "git merge"?

text: One of the advantages of using a DVCS is the **edit-commit-merge** workflow (over **edit-merge-commit** often enforced by a CVCS). Allowing each unique change to be recorded in the repository independent of merges ensures the DAG accurately reflects the true pedigree of the project. Why do so many websites talk about wanting to "avoid merge commits"? Doesn't merging pre-commit or rebasing post-merge make it more difficult to isolate regressions, revert past changes, etc.? **EDIT:** Point of clarification: The default behavior for a DVCS **is** to create merge commits. Why do so many places talk about a desire to see a linear development history that hides these merge commits?


title: Design advice for building pluggable componentry in AngularJS

text: I'm currently working on a team that's developed several, extremely similar web applications in flash, and wants them ported into JavaScript. They also want a single application harness to host all of these applications, since they're all very similar. The application(s) are fairly standard. Each application consists of a set of selection/filter widgets, and a set of display(visualization) widgets. Selecting things in the "sidebar" will change what is displayed in the visualization area. Sometimes selecting things in the visualization area will affect what is in the selection/filter widgets. Both the set of selections, and the set of display widgets, may change from app to app, so they all have to be written to be pluggable. I've been working on this and have come up with the idea that a JSON based configuration file will be loaded into my next-gen application, and will essentially specify what the application will contain, and what interactions are permitted. I load an "application" file into my JavaScript application- harness, and that file tells my app what selections widgets to select from a set of pre-defined selection widgets (applications may share the same selections widgets). That's about as far as I've gotten as far as the implementation goes. it works, but I think the harder challenge lies ahead. Now I have to begin getting my display-visualization widgets working together, communicating with each other, and doing it in a way that's configuration based so that new applications can be created without writing any code for the client. My current plan is to define my display-visualization widgets in the same application file I currently define my selection widgets in, and for communication between these dynamically loaded components, I'll have a set of callback mappings from each selection widget to each display-visualization widget and vice-versa. Selection widgets will look through the file, see which functions they're supposed to call in an application-level namespace on certain events, and set those functions as callbacks for widget events. Display-Visualization widgets will do the same. So here are my questions:   1. Does this sound like a sane approach? Is there a better way to do something like this? Is there some kind of design pattern that people use in these situations that I might not be aware of?   2. I'm doing this in AngularJS, but I don't REALLY know AngularJS. I understand scoping, and some directives, but I'm very new to the framework, and I don't know what the AngularJS "way" of implementing this would be, so an angular-based design sketch would be very useful.  For instance, one thing that worries me is the design I have above is heavily based on eventing and callbacks, which I understand is really not the Angular way. On the other hand, many of the widgets (both types) cannot be angular. They'll be line graphs, data-grids, maps, bubble charts etc. I don't have the experience necessary to really understand how and whether my design should change based on my framework.


title: Why doesn't my IDE do background compiling/building?

text: Today I develop on a fairly complex computer, it has multiple cores, SSD drives and what not. Still, most of the time I'm programming the computer is leasurely doing nothing. When I need to compile and run/deploy a somewhat complex project at best it still takes a couple of seconds. Why? Now that we're living more and more in the "age of instant" why can't I press F5 in Visual studio and launch/deploy my application instantly? A couple of seconds might not sound so bad but it's still cognitive friction and time that adds up, and frankly it makes programming less fun. So how could compilation be instant? Well, People tend to edit files in different assemblies, what if Visual Studio/The IDE constantly did compilation/and building of everything that I modified anytime that it might be appropriate. Heck if they wanted to go really advanced they could do per-class compilation. The compilation might not work but then it could just silently do nothing (except adding error messages to the error window). Surely todays computer could dedicate a core or two to this task, and if someone found it annoying it could be disabled by option. I know there's probably a thousand technical issues and some fancy shadow copying that would need to be resolved for this to be seamless and practical but it sure would make programming more seamless. Is there any practical reason why this scenario isn't possible? Would the wear and tear of continually writing binaries be too much? Couldn't assemblies be held in memory until deployed/run?


title: Indexing data in C++. Could a constructor make a new entry if needed, or increment an existing one elsewhere in the larger object containing it?

text: I am indexing a file of key pairs, and counting number of appearances. The file goes: A B C A B A D E B F and so forth. Seems like a struct or object being pushed back into a vector is a good place to start, sortable on the first or second entry, etc. Once I have a relationship, A B or B A, I figure I can start counting when a pair is repeated, because what pairs with what and the frequency that they appear are the interesting thing I'm trying to find. If I had a very clever constructor for a class or struct containing the right hand entry and a count, I could have a meta object that looks like               struct entry     {       valueAndCount ID;       vector"<"valueAndCount">" pairsWith;     };       Which would then, itself, be used in a vector               class indexObj     {       vector"<"entry">" index;       bool exists( value );     };      In a given vector pairsWith pushback, if I gave the valueAndCount constructor a value, would it be proper for it to check if an entry for that value already existed? If not, go ahead and create a new one with count = 1. If it already exists, increment that (other) count, then free itself as redundant? Or is looking up from the instance constructor to the structure that contains it too messy?


title: Is it correct to keep version numbers of all components always the same?

text: We are planning to use a setup that uses several modules to complete a whole application, example modules include:   * The core (code shared by all other modules)   * The server   * The client (Windows, OS X, Linux)   * The client (iOS)   * The client (Android)   * Tool #1   * Tool #2 And now while we preparing to deliver our first release, it is a good time to think about the numbering scheme. We have defined to use a major.minor.patch format, but we are struggling about one question: **Should every module have the same version number as newest release, and consequently, should we bump version numbers if there has been no update to them?** Example to illustrate: 1) Assume all our components are running on version 0.1.0 (early development), once we do a significant update, should then all components be bumped to version 0.2.0? It also works the other way around: 2) Assume again every component is running 0.1.0 initially, and now we introduce a signifcant update (could be a GUI rework) on the Android client, should we then release a version 0.2.0 for _every_ component, even though the other versions have not received any update? And perhaps the most tricky one: 3) Assume that we still run 0.1.0 one very component in the start, and we figure out Tool #2 has a bug and we need to hotfix it to 0.1.1, should we also then update every component to 0.1.1? * * * I am currently doubting whether we should pursue correct versioning, or should go for compatability? People outside to the development team will most likely expect that all modules run on version 0.3.0 for example, while we as developers are a bit confused and perhaps feel uneasy with bumping a version number up, while the module did not have any change to it. What is the best way to deal with this? * * * **Edit** , something I have forgot to mention, but which may change opinions is that all releases will be done in automated way. On Github/git a specific commit will be tagged being version major.minor.patch and after that the build system (here: Travis CI) will pick up the tag and automatically build every release and publish it somewhere if necessary and/or wanted.


title: Design Patterns in Delphi

text: Delphi has a few problems implementing some design patterns because some features it lacks, like multiple inheritance and no pure abstract classes. Are there any good resources or "Adaptation-Patterns" to convert some or all of the Design Patterns in the GoF book, to Delphi applications?


title: Who organizes your MATLAB code?

text: After reading http://stackoverflow.com/questions/2326609/how-to-organize- matlab-cod, I had a follow up question. If you work in a group of MATLAB programmers, who enforces the organization of the shared MATLAB code and project matfiles? For example do you have a dedicated MATLAB IT person, or does the most senior programmer issue guidelines that everyone must follow, or does everyone agree to follow a system? In my small group, each person has their own 'system'. MATLAB code and project matfiles are either piled into a shared drive or tucked away on people's own computers. Hard to recreate work done by another person, or even to locate their code. There were lots of good suggestions on how to get organized. But it seems like someone has to make the trains run on time. Who does it in your group?


title: Better server to client communication mechanism over HTTP

text: I have a single server with several clients. I want to push messages to a particular client at a given time. Clients should not polling to the server. what are good patterns and practices to solve this problem?


title: Equating multiple new variables with an old one

text: Sometimes I run into a situation where I need to equate two new variables with an old one. Which of the following (if any) is a good practice (w.r.t. code readability or any other factor), under what conditions?               a=b;     c=b;      or               a=b;     c=a;      Note, `a`,`b` and `c` are just the names chosen in this example.


title: why is len not a reserved keyword in python

text: why is functions like **`len`** and **`max`** not a reserved keyword in python. Following are the only reserved words http://docs.python.org/2/reference/lexical_analysis.html#keywords


title: How to synchronize client and server model objects?

text: We have a client-server application with a thick client (GWT). There are client-side MVP presenters (MVC controllers) which hold references to some objects viewed in the GUI. Some user actions cause these objects to be updated on the server. After that we can send updated objects back to the client and reassign them to the presenter. The problem is that there are usually a few references to an object on the client (Lists, HashMaps, etc.) and it is hard to update all of them. Another approach is not to update the references but update the object itself, e.g. copy all the properties from the server object to the client one. But if an object is complex it is not easy too. Which approach is better? Or maybe I miss something?


title: How do libraries such as DirectX relate to drivers?

text: I've always been curious, how libraries such as DirectX, OpenGL and OpenAL are implemented. Do they use some sort of unified API provided by OS? Talk directly to kernel? Maybe hardware drivers provide unified API? Or vendors provide their own backends to such libraries? Even entire implementations of such libraries? Or such libraries handle different drivers on their own?


title: Is doing an assignment inside a condition considered a code smell?

text: Many times I have to write a loop that requires initialization of a loop condition, and an update every time the loop executes. Here's one example:               List<String> currentStrings = getCurrentStrings();     while(currentStrings.size() > 0) {       doThingsThatCanAlterCurrentStrings();       currentStrings = getCurrentStrings();     }      One things I dislike about this code is the duplicate call to `getCurrentStrings()`. One option is to add the assignment to the condition as follows:               List<String> currentStrings;     while( (currentStrings = getCurrentStrings()).size() > 0) {       doThingsThatCanAlterCurrentStrings();     }      But while I now have less duplication and less code, i _feel_ that my code is now harder to read. On the other hand, it is easier to understand that we are looping on a variable that may be changed by the loop. What is the best practice to follow in cases like this?


title: What is the word to describe languages that have classes and inheritance?

text: What is the word used to describe the type of programming languages that provide explicit syntax for defining classes and that support inheritance? For example: "A ______ language, such as C++, Java, C#, or D." I keep thinking "object oriented", but that also includes languages like Lua and JavaScript, which aren't quite what I'm thinking of. I am sure there is a definitive term for this group of languages, I just do not know what it is.


title: Do system background services affect languages benchmarking?

text: Today I was looking at some blogs on Ruby and Python. A Python loyalist wrote a few lines of code with a loop to show how Python is faster than Ruby, with a similar code. I also found a blog of a Ruby disciple who says that it is wrong and he too submitted a code sample and benchmarking results. I am wondering whether background programs or background processes may sometime hinder the results and we may not get exact benchmarking scenario. Please correct me if I am wrong.