Handling "unspecified" values in software

So I'm working on a software product where we have a number of fields that the customer can leave blank, some of which are numeric. To persist these in the database we use nullable columns. Easy peasy. I'm considering the utility of an object oriented domain model and one thing that bugs me is the issue of nullable fields. The reason is, in the world of Java and C# one often finds advice against having null values and indeed writing code with null checks all over the place sucks. And then you get null reference exceptions when you forget to check for null. And it's a mess. So a "good" approach is to initialize everything when you declare it. Now, the idea of null actually makes sense for these fields... the customer did not enter a value thus it has "no" value (not 0, not -1, etc). But application programmers and programming languages seem to be configured for binary rather than ternary logic, and also for variables just darn well having a value rather than maybe having a value but also maybe not. With object oriented design I presume one could come up with some clever system of representing cases where there is "no" value but I personally haven't done the analysis yet and the reason is I find incremental change more successfully sells to people than radical change does, so proposing an object oriented domain model that's "too object oriented" might kill the idea and thus my hopes of improving the structure of our software. I'd rather propose a "version 0" domain model that works and is easy to sell internally... and so this whole thing about null values weighs heavy on my mind. Since we are using C# I could just define nullable numbers, its very easy one just adds a question mark. But I'm not convinced that just because it's possible it's also the best approach. So, with all this background junk out of the way my question is: how have you/your company handled "nonexistent" values in an object oriented domain model, in what ways did you find it effective and in what ways did you find it ineffective? My selection criteria for the "answer" will be the one that seems most "sellable" as defined in the background junk. But really I'd like to see what people come up with and learn some new things so any answer with some thought behind it will receive an upvote from me. Note: I've seen other discussions about null values in other threads but nothing that quite lines up with what I want to talk about, hence a new question. EDIT: My question's scope includes value typed properties like numbers. So in C# one way to allow for representation of a null purchase price would be to declare "PurchasePrice" as "decimal?" which is the nullable decimal type. I just see a number of disadvantages to numbers (for example) that can also be null, so I'm looking for an alternative. EDIT 2: The Null Object Pattern makes sense for references, and using a nullable type for values appears as if it may be tractable with coalescing. What bothers me about coalescing null types is "what if someone forgets to coalesce and we're exposed to a null reference exception?"... and I suppose I could maybe use a static analysis tool which ensures that coalescing is used where expected to allay that worry. EDIT 2': In a sense, if someone has made a conscious decision to make a field nullable they are adding the ability to represent an extra piece of information that would otherwise need another field to represent it such as a boolean HasValue. Does that mean the "anti-null" zealots I've met in the past were perhaps incorrect, and measured use of nullity can in fact improve a design?


How can a self-taught programmer learn more about Computer Science?

I'm a self taught iOS (iPhone/iPad) programmer but didn't study CS in school. Are there any books or site I can study that will teach more about CS, in general. For example some common practices and how different languages work together etc. I don't need full details but simply just an overview of common CS stuff. I know this is a broad question but any info would be good.


Open Source Friendly IP Contracts for Freelancers

I am about to enter the world of consulting for the first time and am having to write my first contract. One problem I have is regarding open source work and intellectual property. I love working on open source projects, whether it's an existing project or a project that I start on my own. The question is: how can I write my contract to accommodate the following situations:   1. In the course of working on the client's project, I want to open source part of the code to the community under my own name.   2. In the course of working on the client's project, I am making use of some of my existing open source projects, and am making improvements to them.   3. In the course of working on the client's projects, I make improvements to third party open source projects and contribute them back.   4. In the course of working on the client's project, we decide to open source part of the code under the client's name. What are the precedents to this if any? _Update: I added a item in the list above(item #3)._


using GNU GPL v2 software as pointers to solution to problem

I am coding a PHP serial access class and have been taking pointers from the PHP-serial class on Google Code (here). That class is based on PHP 4 and I'm creating a PHP 5 class that allows more functionality and is specific to some business demands I have. There is no code copied and I have done all the coding. Does the class I'm writing fall under the Google Code's GPL or am I free to select a license that I feel is appropriate? I'm not sure of the standard that applies to licensing when you are only looking to another work for pointers.


How would somebody uphold a license on "illegal" code?

First off, I want to say that this is **purely hypothetical** ; it's just a scenario that came to mind. I am not looking for personal legal advice, but rather, I'm trying to gain a better understanding of software licensing in general. Suppose somebody open-sources code relating to a botnet (either the code to infect a zombie, control the zombies, or both) under some license, let's say GPL. A few questions.   * First off, are botnets illegal? I don't know if it differs from country to country. I ask because if it isn't, then my question would make no sense whatsoever.   * Can a software license be applied to "illegal" software?   * If a person decides to take that code and violates the license terms, could the original creator take action against said person?   * Even if they could, _should they_? What happens if somebody openly admits they are the creator of code that does illegal things?


Improving performance for grepping over a huge file

I have FILE_A which has over 300,000 lines and FILE_B which has over 30 million lines. I created a Bash script that greps each line in FILE_A over in FILE_B and writes the result of the grep to a new file. This whole process is taking over 5 hours. How can I improve the performance of my script? I'm using `grep -F -m 1` as the grep command. FILE_A looks like this:               123456789      123455321      and FILE_B is like this:               123456789,123456789,730025400149993,     123455321,123455321,730025400126097,      So with Bash I have a `while` loop that picks the next line in FILE_A and greps it over in FILE_B. When the pattern is found in FILE_B, I write it to file result.txt.               while read -r line; do        grep -F -m1 $line 30MFile     done < 300KFile


Generic Repositories with DI & Data Intensive Controllers

Usually, I consider a large number of parameters as an alarm bell that there may be a design problem somewhere. I am using a Generic Repository for an ASP.NET application and have a Controller with a growing number of parameters.               public class GenericRepository<T> : IRepository<T> where T : class     {         protected DbContext Context { get; set; }         protected DbSet<T> DbSet { get; set; }              public GenericRepository(DbContext context)         {             Context = context;             DbSet = context.Set<T>();         }         ...//methods excluded to keep the question readable          }      I am using a DI container to pass in the DbContext to the generic repository. So far, this has met my needs and there are no other concrete implmentations of `IRepository<T>`. However, I had to create a dashboard which uses data from many Entities. There was also a form containing a couple of dropdown lists. Now using the generic repository this makes the parameter requirments grow quickly. The Controller will end up being something like               public HomeController(IRepository<EntityOne> entityOneRepository,                           IRepository<EntityTwo> entityTwoRepository,                           IRepository<EntityThree> entityThreeRepository,                           IRepository<EntityFour> entityFourRepository,                           ILogError logError,                           ICurrentUser currentUser)     {     }      It has about 6 IRepositories plus a few others to include the required data and the dropdown list options. In my mind this is too many parameters. From a performance point of view, there is only 1 DBContext per request and the DI container will serve the same DbContext to all of the Repositories. From a code standards/readability point of view it's ugly. Is there a better way to handle this situation? Its a real world project with real world time constraints so I will not dwell on it too long, but from a learning perspective it would be good to see how such situations are handled by others.


types of encoding in xml

How the encodings work? Which encodings can be used in XML?               To avoid errors      XML encoding while using PHP I heard about               Character Encodings:     Source Encodings:     Target Encodings:      May i know what is the Difference between them?


How can a beginning programmer begin to learn and apply testing best practices when developing software?

While learning to develop in PHP it has been easy enough that my short, one page, 20 line little scripts I could add "testing code" directly to my functions to figure out where I am or get close to the area in the code where the issue is found (for example, "print_r($var)," "var_dump($var)," "print 'you are here') type stuff. Now that my code bases are growing lines and lines deep and accross multiple files, it's becoming a pain to go through and uncomment out all of my test code, and then go back and recomment it out again once an issue is resolved. Recently I have discovered git in managing my larger applications. I've latched onto branches, and I have a testing branch and production branch I jump between when debugging. The testing branch of course has all my 'print this or that' testing code. However, this still doesn't feel right. As code grows, what are ways I can test and debug it? What are best practices for testing and debugging code as applications get larger and more complex? The phrase "Unit testing" catches my eye now and then, but it's still unfamiliar to me. Is this something I should be paying attention more to? Do large projects have different testing and production code bases and is a version control system the correct way to approach managing it?


Code Design question, circular reference across classes?

I have no code here, as this is more of a design question (I assume this is still the best place to ask it). I have a very simple server in java which stores a mapping between certain values and UUID which are to be used by many systems across multiple platforms. It accepts a connection from a client and creates a clientSocket which stores the socket and all the other relevant data unique to that connection. Each clientSocket will run in their own thread and will block on the socket waiting for a read. I expect very little strain on this system, it will rarely get called, but when it does get a call it will need to respond quickly and due to the risk of it having a peak time with multiple calls coming in at once threaded is still better. Each thread has a reference to a Mapper class which stores the mapping of UUID which it's reporting to others (with proper synchronization of course). This all works until I have to add a new UUID to the list. When this happens I want to report to all clients that care about that particular UUID that a new one was added. I can't multicast (limitation of the system I'm running on) so I'm having each socket send the message to the client through the established socket. However, since each thread only knows about the socket it's waiting on I didn't have a clear method of looking up every thread/socket that cares about the data to inform them of the new UUID. Polling is out mostly because it seems a little too convoluted to try to maintain a list of newly added UUID. My solution as of now is to have the 'parent' class which creates the mapper class and spawns all the threads pass itself as an argument to the mapper. Then when the mapper creates a new UUID it can make a call to the parent class telling it to send out updates to all the other sockets that care about the change. I'm concerned that this may be a bad design due to the use of a circular reference; parent has a reference to mapper (to pass it to new ClientSocket threads) and mapper points to parent. It doesn't really feel like a bad design to me but I wanted to check since circular references are suppose to be bad. Note: I realize this means that the thread associated with whatever socket originally received the request that spawned the creation of a UUID is going to pay the 'cost' of outputting to all the other clients that care about the new UUID. I don't care about this; as I said I suspect the client to receive only intermittent messages. It's unlikely for one socket to receive multiple messages at one time, and there won't be that many sockets so it shouldn't take too long to send messages to each of them. Perhaps later I'll fix the fact that I'm saddling higher work load on whatever unfortunate thread gets the first request; but for now I think it's fine.


Logging failed login attempts exposes passwords

I started logging failed logins attempts on my website with a message like `Failed login attempt by qntmfred` I've noticed some of these logs look like `Failed login attempt by qntmfredmypassword` I'm guessing some people had a failed login because they typed their username and their password in the username field. Passwords are hashed in the database, but if somehow the db got compromised, these log messages could be a way for an attacker to figure out passwords for whatever small percentage of people end up having a failed login such as this. Is there a better way to handle this? Should I even worry about this possibility?


Do your managers prefer to create proof of concept (POC) before working prototype?

At last team meeting I heard from managers that we need to create proof of concept (POC) before main prototype and integrate this concept with the main system for proving a new feature.   1. Could you explain me the main features or this method?   2. Do you use the POC in your projects before implementation?   3. What is the main advantages and disadvantages of this method?


Flowgraph Aptitude question

I recently looked a Flow-Graph question. Consider 8 boxes with following values               Box 1 = 2     Box 2 = 7     Box 3 = 2     Box 4 = 1     Box 5 = 5     Box 6 = 7     Box 7 = 1     Box 8 = 4      Now follow the instructions:   1. Put the number from Box 7 into Box 1   2. Add the numbers from Box 1 and Box 2 , and put the result in Box 1   3. Change Instruction 2, Increase the number in Box 2 by 1   4. If the second box number mentioned in instruction 2 is greater than the number in box 8, stop. If not, go to step 2. What number is in Box 1 now? Note: When you are told to put a number into a box, it is understood that whatever number was previously in that box has just been erased. When I tried to solve:   1. b[1] = 1   2. b[1] = 1+7 = 8   3. b[b[2]] = b[7]+1 =b[7]=2   4. b[2] > b[8] 7 > 4 : true result: 8 But the solution is 11! how? I got stuck.Am I misinterpreting something?


Sharing dlls in a software deployment

We are moving our software project from the practically auto-creating Visual Studio Installer in Visual Studio 2010 to a WiX installer. I'd like to use this change to make sure things are right. The application is a subsidiary to our company's main app that will already be installed in its own folder. The main app has a lot of dlls, some of which the subsidiary app needs to load to work. With the previous installer, the required dlls are pulled into the project and included in the subsidiary app's installation folder. However, this seems to create possible problems:   * Multiple versions of the same dll creates confusion, especially if we produce another app in the future.   * If the version of the main app changes, the updates are missed by the subsidiary app. I'm not comfortable with adding our app to the same folder, because they are developed and maintained by different groups. Instead of this, perhaps I could add the path of the main app to the PATH environment variable. Would this work, and are there concerns with doing this? Is there some other way to approach this issue?


Are Parameters Needed?

I am wondering if my parameters are need for the methods? Here is the psuedo-code I currently have:               class Transaction is        Must contain Date, Payee, Balance      Can have Deposit, Withdrawal, Check Number, Memo, Cleared          class TransactionBuilder is         method getTransaction() is         output: A transaction with all the correct features and values        Construct and return the transaction          method setDate(date) is         input:  the date that the transaction took place       Tell the builder the transaction date               method setPayee(payee) is         input:  the person receiving the funds from the transaction       Tell the builder who the payee is          method setDeposit(depositAmt) is         input:  the amount of the deposit       Tell the builder the amount of the deposit          method setWithdrawal(withdrawalAmt) is         input:  the amount of the withdrawal       Tell the builder the amount of the withdrawal          method setBalance(balanceAmt) is         input:  the amount of the balance       Tell the builder the amount of the balance          method setClear() is         Make the builder remember that the transaction has cleared the bank          method setCheckNum(checkNum) is          input:  the number of the check wrote       Tell the builder the check number for this transaction          method  setMemo(memo) is         input:  the memo about the transaction       Tell the builder the memo of the transaction


How to make a license to prohibit redistribution?

I have a script I want to sell. It's written in PHP, but that's not relevant here I guess. I want to secure my script with a license, so the buyer is forbidden from redistributing it. This is the first time I am selling my own script, so I have no idea how to start with this. Please let me know how I can protect my script with a license and what kind of license.


Referring to hardware/software in first-person?

At my company, there is a habit for the engineers to refer to their respective hardware/firmware/software in the first-person as if the device they are responsible for is a manifestation of themselves. I'll give you an example: > **Hardware Engineer:** "I don't receive the first byte, so I stay off." > > **Software Engineer:** "I'm sending you the first byte after the ack flag, > so I thought you were getting it." > > **Hardware Engineer:** "No, you're not turning me on." It was this very example I overheard today that nearly had me giggling in fits. _"You're not turning me on."_ Well, I should hope not! So, is it common practice for engineers to do this, or simply unprofessional? Any suggestions for changing this apparently bad habit?


How did you learn about security in your web development?

I've been developing intranet web sites and public web sites with no big issues concerning security. There were nothing to steal and nothing to gain. Nothing to attract people to try to reach the website behind the scene. I don't talk about login & password but more about the security against user attacks. So, what's the best way to learn to secure the access to a site, to learn about common mistakes or weakness to think about ? Do I have to find a framework related to the language I use and rely on it or is there a source (book, website, ...) where I can find information about general design and tricks ?


Why should I use Zend_Application?

I've been working on a Zend Framework application which currently does a bunch of things through Zend Application and a few resource plugins written for it. However, looking at this codebase now, it seems to me that using Zend_Application just makes things more complicated; and a plain, more "traditional" bootstrap file would do a better job of being transparent. This is even more the case because the individual components of Zend -- Zend_Controller, Zend_Navigation, etc. -- don't reference Zend_Application at all. Therefore they do things like "Well just call setRoute and be on your way," and the user is left scratching their head as to how to implement that in terms of the application.ini configuration file. This is not to say that one can't figure out what's going on by doing spelunking through the ZF source code. My problem with that approach is that it's to easy to depend on something that's an implementation detail, rather than a contract, and that all it seems to do is add an extra layer of indirection that one must wade through to understand an application. I look at pre ZF 1.8 example code, before Zend_Application existed, and everywhere I see plain bootstrap files that setup the MVC framework and get on their way. The code is clear and easy to understand, even if it is a bit repetitive. I like the DRY concept that Application gets you, but particularly when I'm assuming first people looking at the app's code aren't really familiar with Zend at all, I'm considering blowing away any dependence I have on Zend_Application and returning to a traditional bootstrap file. Now, my concern here is that I don't have much experience doing this, and I don't want to get rid of Zend_Application if it does something particularly important of which I am unaware, or something of that nature. Is there a really good reason I should keep it around?


SOAP message testing

I am working in Scala/Java. I'm testing the messaging infrastructure of a part of my system that I did several years ago with CXF and Java. More specifically, I'm re-writing the specification of the message exchange. This is because i'm changing few part of it. At the time, I was not using TDD/BDD. Now I'm driving out everything with BDD. Actually, the owner of the system specifically wants to have the BDD style Specification before i'm done with the project. I also find it actually useful anyway. > I'm particularly interested in writing an end-to-end test, where I would > check that the server read the message properly. > > Optionally I would like to send a message and in the middle check that what > is sent is conform and forward the message to the server. (Actually i think > that unit testing the sending on one side and the receiving on the other > side should be enough here) The end to end test should be something like: ->Client one prepare a message ->Client one send a message to the Server ->On reception of the message on the server verify, that the message received correspond to is expected to have been sent. In particular, check that resulting composite object constructed out of the raw message is right.  This, on its own, should drive out several unit test in the middle. The other nonfunctional constraint will also help for the matter. The problem here is that the end-to-end test describe here actually involve writing a Test with asynchronous code. I saw things like awaitlity or scala future to handle that. However, the part is bogging me down, is the observation of an the new message received inside the server. I read things about polling the system through a probe, but i still can't figure out the probe part. In any case, in all and all, the problem is that the message received is an internal variable of the server, well encapsulated. I'm wondering how to deal with that ? What techniques could be recommended here ??? There must be some existing hooks for that? Any one has any idea? Serializing the object in a log file :), making the variable publicly accessible trough some getter? Creating some trace object for the matter. etc.... I would appreciate if someone could suggest something.


JSON-based Ajax Checkout experience - is it safe?

For a mobile, e-commerce site, that follows the client-server model, where all the views are json-ajax calls to return data from a secure service, is it safe to also pass the "checkout" process through an ajax call? The entire site is presented by making json-formatted ajax-calls to the service (which is controlled). If the service will return responses ONLY from the client-server (i.e. lockdown on the IP-range) would that make it secure? Are there other considerations? **EDIT:** JSON-based ajax is to give context to the mobile-site setup. Client-server model is more accurate, where the business logic / authorization is handled via another server. But because it's using JSON-Ajax, the calls are easily read in javascript (or through a http proxy for the transaction). SSL Certificate will be installed. I'm just trying to find out if there are specific security holes to protect against in this setup.


Chasing DirectX versions

We're a small-medium size enterprise (~50 devs), working on several DirectX 9 applications. ( _not_ games) DirectX 10 and 11 both were deep interface overhauls, as DX12 will probably be. We didn't upgrade to any of them, and since VS2013 (now migrating) working with DX9 is getting very inconvenient to say the least - while DX9 is not technically deprecated, MS is very actively pushing devs away from it. I wonder, how are other dev shops handling the DX interface instability? Are you actually re-writing your graphics engine every ~2-3 years? Are you using 3rd party middleware? Both OGRE and Unity seem like tons of code, have design goals I don't care about (cross platform), and I'm not even sure their interface is more stable. Are there other ways I'm missing? Important note: _We're not developing AAA games, and we've not much use for fancy shaders or a need to squeeze every bit of performance from modern hardware_. Our products just display data mostly in 3D. * * * it seems some clarifications are in order. The current state of graphics development is that MS issues a completely overhauled DX interface roughly every ~2-3 years. It seems - whether deliberately or not - they are targeting major game shops (or even: game-engine shops), which would happily devote the needed HR to rewrite the 3D graphics engine to conform to the latest and greatest. Our shop (and I suspect many others) is nothing like that. We present a lot of data in 3D, but do not use exotic shaders and don't care about the latest consoles or GPUs. It makes no business sense for us to rewrite our rendering engine for new features we don't care about - and yet the old engines are becoming deprecated fast. A DX dev from MS writes: > the ability to support a Direct3D 9 application at all is diminished on the > latest versions of Windows, and that's likely to continue And regarding D3DX - while not technically deprecated, is very hard to work with on VS2013. MSDN diplomatic Quote: > Investigate alternate solutions for working with the Direct3D API. I'm curious: how are other shops with similar 3D needs handling this? e.g., how are you guys in the CAD business doing?


Advantages of using pure JavaScript over JQuery

What are the advantages of using Javascript-only versus using JQuery-only? I have limited experience with JavaScript and JQuery coding. I've added bits and snippets of each to HTML pages but I've mostly coded server-side stuff in other languages. I've noticed that while you can theoretically do the same things using either of the two approaches (and of course you can even mix 'em up in the same project) there seems to be a tendency to always start using JQuery from the very beginning no-matter what the project demands are. So I'm simply wondering, are there any punctual benefits to not use JQuery- only but instead to just use plain old JavaScript? I know this looks like a non-question because it can be said about it that "there's no definite answer" or "it can be debated for ever", but I'm actually hoping for punctual answers such as "You can do this in one approach and you cannot do it with the other". * * * As per scrwtp's comment, I'm not referring just to the DOM Handling part. My question is rather: JQuery is a library. For Javascript. What I find strange about this library as opposed to other libraries for other languages is that in JQyery's case it seems to be designed to be able to use it exclusively and not need to touch Javascript directly. This is as opposed to let's say Hibernate and SQL, where even though the library (or rather framework in this case, but I think the analogy still applies) takes the handle on A LOT of aspects, you still get to use SQL when using it, at least for some fringe cases. However in JQuery & Javascript case, you could do anything you do with Javascript using only JQuery (or at least that's how it seems to me). * * * As per Stargazer712's comment: yes, I agree with you, the question here is, as you put it "just a matter of how you will be using JavaScript". That's what I was actually thriving to ask, but I've made some bad formulations. Here's another analogy: Spring Expression Language. It's a Java library. You can't use it without Java, it's based on Java, and down through it all you still get to use Java. But in practice what you can do is add this library to a Java project, and then write all your code using Spring EL's expression language which effectively makes your code not resemble Java at all, and it's even paradigm shifting (for example you no longer have strong type enforcement when using this). While I do understand that JQuery is just a JS library, to me it seems that in practice it has the same effect as Spring EL has with Java, i.e you can only use it's APIs through out a project and avoid JavaScript's APIs. And I was wondering if that's a good thing to do, what might be the pitfalls etc. (and yes, after reading everyone's answers I do understand that : a. my question is somewhat non-sensical up to a point b. even if the question were completly accurate, the answer to it would be pretty much "no you can't just use JQuery-only all the time)


Design patterns: Extract instance types into different buckets

I have the following type hierarchy:               interface I:         ----+class B implements I         ----+class C implements I         ----+class D implements I      I have another class `Consumer1` that supports types `C` and `D` but not `B` (in its various methods) and a class `Consumer2` that supports type `B`. I have total control over `Consumer1` and `Consumer2` so I can choose how to implement them. Now, at runtime I expect my callers to give me a collection of `I`s and I will decide internally whether to route them to `Consumer1` or `Consumer2`. Now, a very bad non-OOP way is to do an `if instanceof` check all over the place and mess things up. One alternative is to register a supporting class `Map<Class<?>, Class<?>>` that shall contain `{{B,Consumer2}, {C,Consumer1}, {D,Consumer1}}`. This is as bad as the previous one because I shall have to cast objects after figuring out whether to send them to `Consumer1` or `Consumer2`. A second alternative is to apply a `Visitor` pattern which would solve this rather neatly but prevent my interface from being extended further (unless I modify the visitor). Is there a neater alternative?


Is (1/(1/x)) always a perfect round trip?

Is the following guaranteed to return true for all numerical and non-zero values of `x`?               bool IsRoundTrip(double x)     {         double y = 1 / (1 / x);         return x == y;     }      What conditions would cause a discrepency?


How do you program effectively when it takes a long time to simply test your code?

My workflow has always been to write one logical step and then run the program and inspect the output. This process have served me incredibly well for assignments in university. However, as I do more development, there are often times when simply compiling and running your code takes 1 to 2 minutes. Examples include uploading a program to a microcontroller, requiring interaction with an external server, and unable to implement automation due to authentication, software architecture, or complexity. These types of tasks are very unsuitable to how I usually program, and I'm having difficulties coding effectively. I usually make a lot of syntax errors and logic errors, most of which I easily catch by testing. However, with such a long wait time, this method is too time consuming.


Using stock images in open source project

I have started an open source project and would very much like to have a cute and catchy icon to label the project with. My dilemma is that I have little to no experience designing vector graphics for use in such a project. To compensate I thought I might purchase a graphic from one of the stock photo service (shutterstock, etc.). My project produces HTML documentation from Gherkin language files and my intention was to use this icon on the footer of each page for an "output produced by ..." kinda thing. My question is what implications would it have on my licensed software if I were to use this graphic in it. I am releasing the software under the Apache v2 license.


Changed The Customer's World - how do we handle this?

Some time ago, we were tasked with a project to come in and replace a customer's old Mainframe system with a new intranet ASP.NET solution using SQL Server as the back end. Part of this was a re-engineering of the business as well - essentially, as we change the system, we were to be thinking of how we can better do business. So, the first task was to come in and do the logical and then physical data models. The customer was in on these dicussions and had complete sign off. The next phase was to actually do the design and building of each module. Well, to make a long story short, the programming has been done and we are now into parallel testing of the system. Things are going wonderful for most of the modules so far - Except One. We have one system where - if you would only let the business users see the application and reports, all would be well. It works with the new integrated workflow and automates previously manual processes and performs great per the specifications. Parallel testing has uncovered a few issues though with the migrated legacy data. The builders of the legacy system are having a very hard time understanding the new schema and business process, therefore, they are having a very hard time understanding how to take the legacy data and put it into the new schema. Because of this, they are calling meetings of the business users and stakeholders and telling them that the new system doesn't provide data that the old system did (when it really does) - this does make the new system look bad. This is frustrating, to say the least. The new system works great, and provides everything they need and wanted, and if not for the inability of the IT staff to fill in the new tables with the old data, the business users would be happy with the new features and functionality. I'm asking for suggestions for how to handle this. Because of some political moves, the new "architect" has no idea of how the system works, and cannot fully understand the ramifications of the changes the IT staff is requesting. The IT staff wants some fundamental changes to the system, which are essentially un-necessary and actually are a bad design - but they ARE the customer. Any thoughts?


Company Size and Career development

I am currently working as a software engineer for a large company (around 1000 employees). I recently got a job offer for a smaller company but with more pay (enough that I am really considering the move). The smaller company has about 17 employees and only about 4 developers. It also has a different title, I would be an application developer. Say in five years or so when I am looking to move to another job, will going from a larger company to a smaller company be viewed as negative on my resume? Will the change in title have any effect? The big question here is: How does the size of a company and title of the position affect your career?


Comparing Academic Curriculum Specificity: Generalist vs Specialist

For someone that is relatively new to web development, would you recommend pursing an academic curriculum that is more diverse (introducing several languages and frameworks with other classes on analysis, networks, databases, etc.) or a curriculum that is very focused and rigorous (i.e. mostly classes on Java-related technologies)? **Background** : I am trying to transition into the web development field. I currently have a Bachelor's in Biology and have almost two years of "webmaster" experience for my current employer along with a little bit of freelance web design work on the side. I've applied to several jobs over the past year and the resounding feedback that I get is that I need a degree in Computer Science or related field. I have decided to pursue a Master's degree and have been accepted into two programs. **Boston University** \- Master's in Computer Information Science with Concentration in Web Application Development **Brandeis University** \- Master's Degree in Software Engineering BU's program is very eclectic and provides classes on a variety of different topics like HTML5, CSS3, Javascript, JQuery, JavaSE, Oracle database, networks, etc. Brandeis' program goes really deep into Java technologies (basic Java SE, J2EE, Struts, Hibernate, Spring, JDBC, etc.). I currently have a pretty good understanding of HTML, CSS, Javascript, and Java SE through about 2 years of self-study. I'm just not certain if it's a good idea to try and broaden my general understanding of website design or if it's better to try and develop a niche (i.e. Java) before I try and get my first developer position. Thanks and have a great day.


Is taking a semester or year off from college a good idea?

I am currently a Junior majoring in Computer Science at a top university (in the USA). As I'm really getting tired of taking classes, I was wondering if taking a semester or year off to do an internship(s) is a reasonable idea? It seems like it would give me more experience programming (making classes a bit easier), and give me a chance to recover from the burnout that comes from taking 18 credits a semester. A friend suggested that I just take a lighter course load, but I only have 2 more semesters of financial aid, so I need to take 18 credits in each of them in order to finish. Taking time off from school is not a normal thing to do, at least at this school. Since more internships are advertised for the summer (that I've seen), I was wondering if there are internships available in times other than the summer? If I took off for a whole year, would it be more valuable to try to stay at the same company for the whole time or to try to get a series of internships at different ones? Valuable in both the sense of resume value and personal value. Would it be easier or harder to get multiple shorter internships?


Securely storing secret data in a client-side web application

I have this web application that is going to be all client-side technology (HTML, CSS, JavaScript/AngularJS, etc...). This web application is going to be interacting with REST API in order to access and modify data. Right now it is undecided on what type of authentication system the REST API is going to use. From my understanding, any type of API authentication system (API Keys, OAuth 1/2, etc...) is going to have certain data that needs to be kept secret otherwise access can be compromised. For API Keys, they keys themselves need to be secret, for OAuth 2 the client secret/access tokens/refresh tokens need to be kept secret, I am sure a few of the 4 keys involved in OAuth 1 needs to be kept secret (not too much experience with OAuth 1). I have been trying to think if there is a way to store this secret stuff in a pure client-side web application without a middle layer of sorts on the server side. I have been trying to think about this and I can't think of any place to do that. I mean I can't store it in javascript because anyone can just view the source or open up the console and get the data. I am not 100% sure how secure localStorage is and if users can access/modify that data. Even if local storage was secure, the two ways I can think of getting data into it are not. One way is to just store the data in the javascript source code which is the most insecure thing I can think of. Now if I was using something like OAuth 2 in which the rest api itself would give me the tokens, that would still not be that secure (better than the first option) because those tokens would be returned as plain text that anyone who can see the requests the computer is making could see. Is there any way to have an application that is completely running client side be able to store secret pieces of data securely without some sort of middle layer on the server side?


Views, View Controllers, Properties and Object-Oriented Programming

I'm new to OOP, having been a procedural programmer for many years. I'm learning iOS development in Objective-C and could use some clarity on when and how objects and properties are used. Say I have a view controller, MyViewController. Within that is a UIView, MyView, with a property, viewProperty. How do I reference viewProperty from within MyViewController? My hunch is that I need to instantiate an instance of MyView, say:               MyView *instanceView;      and then reference instanceView.viewProperty. But without having instantiated a MyView at all, a MyView view shows up in MyViewController when I run the iPhone Simulator. Is that because my XIB file implicitly instantiates an instance of MyView? If so, how do I reference that instance in code? If I have to instantiate a MyView instance within MyViewController, which method(s) should contain the declaration, and why? I hope I explained my foggy perceptions adequately for someone to clear things up for me. Apologies if I'm not making sense, but I feel like if someone just connects the dots for me I'm almost there.


Google best practices for software developers

It seems to me that googling has become an integral part of software development. I spend about as much time googling for an answer and copying code from blogs and examples, as writing new code myself. Are there any best practices for google? Examples off the top of my head:   * use trusted sites for answers, i.e stackoverflow, API project page   * read the comments for blogs listing code snippets   * understand and test code copied from blogs   * when in doubt, google for a solution first before coming up with a new one anymore?


What GUI tools are available for which DVCS?

When I worked at Sun, we used a DVC system called Forte SCCS/Teamware, which used the old SCCS file format, but was a true distributed source code revision control system. One nice feature is that it had strong GUI support:   * You could bringover and putback changes by simply clicking and dragging.   * It would draw trees/graphs showing how workspaces relate to each other.   * You also could have a graph view to display a single file's complete history, which might have had several branches and merges. Allowing you to compare any two points.   * It also had a strong visual merge tool, to let you accept changes from one of two conflicting files. Naturally, many of the current DVCSs have command line support for these operations, but I'm looking for GUI support in order to use this in a **lower- level undergraduate course** I'll be teaching. I'm not saying the Forte Teamware solution was perfect, but it did seem to be ahead of the curve. Unfortunately, it's not a viable option to use for my class. **Question:** What support do the current DVCSs have with regards to GUIs? Do any of them work on Windows, and not just Linux? Are they "ready for prime- time" or still works in progress? Are these standalone or built as plug-ins, e.g., for Eclipse? **Note:** To help keep this discussion focused I'm _only_ interested in GUI tools. And not a meta-discussion if GUI tools should be used in teaching.


Using Mercurial repository inside a Git one: Feasible? Sane?

I am thinking on creating a Mercurial repository under a Git repository. e.g.               ..../git-repository/directory/hg-repo/      The 2 repositories Is it possible to manage (keeping your sanity)? How similiar is it to this? * * * I am a computer science student at University. I manage my work in Git, mainly as a distribution mechanism (after realizing that rsync fails when you have changes in more than one place) between my desktop and usb drive. I try use of Git as a VCS as I do work. I have finished a semester where I did a small group project to prepare for a larger group project next year. We had to use Subversion, and experienced the joys of a centralised VCS (including downtime). I tried to keep the subversion repository separate to my Git repository for the subject**, however it was annoying that it was seperate (not in the place where I store assignments). I therefore moved to using an Subversion repository inside my Git repository. As I think ahead (maybe I am thinking too far ahead) I realise that I will have to try and convince people to use a DVCS and Mercurial will probably be the one that is preferred (Windows and Mac GUI support, closer to Subversion). Having done some research into the whole Git vs Mercurial debate (however not used Mercurial at all) I still prefer Git. Can I have a Mercurial repository inside a Git one without going mad (or it ruining something)? Or is it something that I should not consider at all? (Or is it a bad question that should be deleted?) ** I think outside of Australia it is called a course


How do I validate the html/css and JS code outsourced to an external company.

We have outsourced the html and css design to an external company. We want to make sure the quality of code is good. What benchmarks can we set to achieve this.


Template method within one class without subclasses or inheritance

I have an algorithm with mostly invariant parts that needs to be reused within one class so as to stay DRY. ### Code duplication with repeating method structure               public void save(String key, int value) {         try {             if (isValidWrite()) {                 // Only variable part                 editor.putInt(key, value);                 if (!writeOnDisable){                     write(editor);                                         Log.v(TAG, "Saved " + key + " | "+ value);                 }             }         } catch (Exception e) {             Log.e(TAG, "save", e);         }     }          public void save(String key, String value) {         try {             if (isValidWrite()) {                 // Only variable part                 editor.putString(key, value);                 if (!writeOnDisable){                     write(editor);                     Log.v(TAG, "Saved " + key + " | "+ value);                 }             }         } catch (Exception e) {             Log.e(TAG, "save", e);         }     }      ### Solution?   * The template method pattern is not applicable, because it requires sub-classing.    * Strategy - do I really need to create an interface and provide different implementations to pass into a generalized method as a delegate? Maybe I'm just complaining about proper support for delegates in Java.. (in C# could just use a generic Action<>)


binary representation in Python and keeping leading zeros

I wanted to use the base64 Python library to encode a sequence of binary digits into base 64. Would it be possible to do it without converting to a string? If not, what is the best way to do it, assuming that my string of 1/0 digits may not be an integer multiple of 8, it may even be an odd number. In addition, I have the following question: is it possible to assign a specific binary string to a variable? For example,               x = 0b00010101010     y = 0b1110000        I want x to hold the three initial zeros, and I would like to be able to concatenate these to to obtain               z = 0b000101010101110000


How do CDNs protect failover sites from DDoS attacks?

I'm in the design process for a Java web app that I will probably end up deploying to Google App Engine (GAE). The nice thing about GAE is that I really don't have to worry about fortifying my app from the dreaded DDoS attack - I just specify a "billing ceiling", and if my traffic peaks up to this ceiling (DDoS or otherwise), GAE will just shut my app down. In other words, GAE will essentially scale to any amount until you simply can't afford to keep the app running any longer. So I'm trying to plan a contingency whereby, if I do hit this billing ceiling and GAE shuts my app down, my web app domain DNS settings "fail over" to another, non-GAE IP address. Some initial research has shown that certain CDNs like CloudFlare offer services for this exact situation. Basically, I just keep my DNS settings with them, and they provide an API I can hit to automate a failover procedure. Thus, if I detect that I'm at 99% my billing ceiling for my GAE app, I can hit this CloudFlare API, and CloudFlare will dynamically change my DNS settings to point away from the GAE servers to some other IP address. My initial contingency would be to failover to a "read-only" (static content only) version of my web app hosted somewhere else, maybe by GoDaddy or Rackspace. But then it suddenly dawned on me: **if DDoS attacks target the domain name, what difference does it make if I rollover from my GAE IP address to my (say) GoDaddy IP address?** In essence, the failover wouldn't do anything other than allows the DDoS attackers to bring down my backup/GoDaddy site! In other words, DDoS attackers coordinate an attack on my web app, hosted by GAE, at `www.blah-whatever.com`, which is really an IP address of _100.2.3.4_. They cause my traffic to spike to 98% my billing ceiling, and my custom monitor triggers a CloudFlare failover from _100.2.3.4_ to _105.2.3.4_. The DDoS attackers don't care! They're still launching an attack against `www.blah-whatever.com`! The DDoS attack continues! So I ask: what protection do CDNs like CloudFlare offer so that - when you need to fail over to another DNS - you aren't at risk for the same, continued DDoS attack? If such protection exists, are there any technical restrictions (e.g. read-only, etc.) that are placed on the failover site? If not, what good are they?! Thanks in advance!


Is a .com domain name worth it for a mobile app?

I'm starting to develop a mobile app, and have a first choice name I'd like to use. However the .com domain of the name has already been taken. Is it actually worth it buying it, or would you tempted to go with CoolNameApp.com or CoolName.net instead? If you couldn't afford the .com domain name, would you use a different name for the actual app?    Also just to let you know I'm a student with not much money.    Am fascinated to hear your ideas and opinions on the importance of .com domains for mobile apps :-)


How to get developers to do code reviews in a timely manner

The company I work for requires all code to be reviewed by other developers before it is committed. The members of my team are often frustrated because the other developers are too busy coding to do a review, especially if it is very long. How do you incentivize other developers to do timely code reviews? (We use git-svn so we are able to continue coding while waiting for a review. However, I still find it frustrating when I have to wait a long time before I can commit my code.)


Technical IPhone, iPad or general iOS programming article sites

i just want to know what are the good websites to read technical articles on the iPhone, iPad or in generally iOS. Any subscription based services can also be named. i am talking about sites like http://drdobbs.com, which have articles on mobility but indeed very generic. so can you name some good sites with technical articles on IPhone, iPad or general iOS programming.


Is rewriting project a good way to practice the skills?

I find nothing to do in my spare time. And I want to practice my c++ skills on project. The idea is to rewrite a project in c++, such project like Minix. Is this a good way to improve my programming and architecting skills or it's a waste of time?


Considering consistent change, how short of a planning period is too short?

Change is not uncommon, change in requirements, change in specs change in workflow. I've accepted that there will be change, but I wonder: knowing that change is going to happen, how short of a planning period is too short? (Justifications are encouraged)   * An iteration (2-4 weeks)?   * A week?   * A 2-3 day period?   * A day?   * 1/2 a day? Assume that the company 'plans' 1 [time interval (from above)] in advance from the current so that any plan sounds like: "[this morning/today/this week/etc.] you'll work on _this_ and [this afternoon/tomorrow/next week/etc.] you'll be working on _that_. Also assume that the changes in focus/direction will consistently occur every second to third time interval.


How compilers know about other classes and their properties?

I'm writing my first programming language that is object orientated and so far so good with create a single 'class'. But, let's say I want to have to classes, say `ClassA` and `ClassB`. Provided these two have nothing to do with each other then all is good. However, say `ClassA` creates a `ClassB`\--this poses 2 related questions: -How would the compiler know when compiling `ClassA` that `ClassB` even exists, and, if it does, how does it know it's properties? My thoughts thus far had been: instead of compiling each class at a time (i.e scan, parse and generate code) each "file (not really file, per se, but a "class") do I need to scan + parse each first, then generate code for all?


How do I take responsibility for my code when colleague makes unnecessary improvements without notice?

One of my teammates is a jack of all trades in our IT shop and I respect his insight. However, sometimes he reviews my code (he's second in command to our team leader, so that's expected) without a heads up. So sometimes he reviews my changes before they complete the end goal and makes changes right away... and has even broken my work once. Other times, he has made unnecessary improvements to some of my code that is 3+ months old. This annoys me for a few reasons:   1. I am not always given a chance to fix my mistakes   2. He has not taken the time to ask me what I was trying to accomplish when he is confused, which could affect his testing or changes   3. I don't always think his code is readable   4. Deadlines are not an issue and his current workload doesn't require any work in my projects other than reviewing my code changes. Anyways, I have told him in the past to please keep me posted if he sees something in my work that he wants to change so that I could take ownership of my code (maybe I should have said "shortcomings") and he's not been responsive. I fear that I may come off as aggressive when I ask him to explain his changes to me. He's just a quiet person who keeps to himself, but his actions continue. I don't want to banish him from making code changes (not like I could), because we are a team--but I want to do my part to help our team. Added clarifications:   * We share 1 development branch. I do not wait until all my changes complete a single task because I risk losing some significant work--so I make sure my changes build and do not break anything.   * My concern is that my teammate doesn't explain the reason or purpose behind his changes. I don't think he should need my blessing, but if we disagree on an approach I thought it would be best to discuss the pros and cons and make a decision once we both understand what is going on.   * I have not discussed this with our team lead yet as I would prefer to resolve personal disagreements without getting management involved unless it is necessary. Since my concern seemed more of personal issue than a threat to our work, I chose to not bother the team lead. I am working on code review process ideas--to help promote the benefits of more organized code reviews without making it all about my pet peeves.


What specific branches of Mathematics are useful for a programmer to learn?

I have less than 6 months to learn mathematics for my Master course in CS. (With no prior formal education in any computer/mathematics related area.) So I need to prepare my self to be tested on math as it relates to computer science. As I found in Wikipedia, mathematics has many branches. Which ones are the most important for a programmer?   * Arithmetic   * Algebra (elementary, linear, multilinear, abstract)   * Geometry (discrete, algebraic, differential)   * Calculus/Analysis   * Set theory   * Logic   * Category theory   * Number theory   * Combinatorics   * Graph theory   * Topology   * Lie theory   * Differential equations/Dynamical systems   * Mathematical physics   * Numerical analysis   * Computation   * Information theory   * Probability   * Statistics   * Optimization   * Control theory   * Game theory


Separation of concerns between objects

I have two objects which work together to provide interaction with HIDs on a machine. One object is responsible for the communication (read/write) to the HID and the other object is responsible for modelling the HID. Information is read and written to the HID as byte arrays. As a contrived example:               class Hid     {       private HidComms comms;            public DateTime? GetPropertyB()       {         return comms.GetPropertyB();       }     }          class HidComms     {          public DateTime? GetPropertyB()       {         // request property B from HID         // get 1 or more byte[] in response         return new DateTime();       }     }      Which of these two objects should be responsible for encoding/decoding the byte arrays, or should a third object be responsible for this? Meaning the `Hid` object only knows about state and the `HidComms` object only knows how to read/write with a third object responsible for the conversion?


TryUpdateModel vs Parameter and ModelState.IsValid

As I was originally learning about MVC, the book I was using taught the following technique for Controller actions:               public ActionResult MethodName(Model model) {         if (ModelState.IsValid) { }         else { }     }      However, I quickly ran across an unrelated issue, and someone on Stack Overflow pointed me to a new function in MVC3 that was like this:               public ActionResult MethodName() {         var model = new Model();              if (TryUpdateModel(model)) { }         else { }     }      That new `TryUpdateModel()` technique did help with a separate issue that I was encountering (aside from the one my question was about), so I was using that for a while. However, I've recently run into a couple of minor issues which caused me to go back to the original with `ModelState.IsValid`. Neither bugs have ever been that major, so it just seems to me that this is more of a "best practice" scenario. Those minor bugs might have been from other issues in the code that I've written. What is everyone's experience been between the two of these methodologies? (For the record, this is with MVC3 and MVC4 in C# 4.0 and Visual Studio 2010.)


What's the shortest generating one-way hash algorithm?

I have a 24 character long id which is guaranteed to be unique. I would like to shorten that to 7-10 (or even shorter) characters long. If I generate an short id randomly then I would have to check every time if that shortid is available. Is there an one-way hash algorithm that could return back 7-10 character hash from passing in the 24 character id. Are there any other ways to guarantee that the generated short id is unique without checking?


Why does the Java collections APIs not have a last method?

This is for ordered collections e.g. java.util.List. Why did the language designers not include a last method? The only reasons I can think of are:   * ambiguity when the collection is empty (return null or throw exception)   * API bloat Any other reasons?


In agile environment, how is bug tracking and iteration tracking consolidated.

This topic stemmed from my other question about management-imposed waterfall- like schedule. From the responses in the other thread, I gathered this much about what is generally advised:   * Each story should be completed with no bugs. Story is not closed until all bugs have been addressed. No news there and I think we can all agree with this.   * If at a later date QA (or worse yet a customer) finds a bug, the report goes into a bug tracking database and also becomes a story which should be prioritized just like all other work. Does this sum up general handling of bugs in agile environment? If yes, the part I'm curious about is how do teams handle tracking in two different systems? (unless most teams don't have different systems). I've read a lot of advice (including Joel's blog) on software development in general and specifically on importance of a good bug tracking tool. At the same time when you read books on agile methodology, none of them seem to cover this topic because in "pure" agile, you finish iteration with no bugs. Feels like there's a hole there somewhere. So how do real teams operate? To track iterations you'd use (whiteboard, Rally...), to track bugs you'd use something from another set of products (if you are lucky enough, you might even get stuck with HP Quality Center). Should there be 2 separate systems? If they are separate, do teams spend time creating import/sync functionality between them? What have you done in your company? Is bug tracking software even used? Or do you just go straight to creating a story?


How to remove duplicate code (in general)?

In an OO language (e.g. but not limited to Java) how do you fix duplicate code depending on the scope of it's occurrence? I would start with (for example)   * in the same class (scope) perform the Extract Method refactoring (fix)   * in classes of the same hierarchy (scope) perform Extract Method and Pull Up (fix)   * ...


C# foreach improvements?

I run into this often during programming where I want to have a loop count index inside of a foreach and have to create an integer, use it, increment, etc. Wouldn't it be a good idea if there was a keyword introduced that was the loop count inside of a foreach? It could also be used in other loops as well. Does this go against the use of keywords seeing as how the compiler would not allow this keyword used anywhere but in a loop construct?


What kinds of development jobs require knowledge of advanced concepts?

When I was in university, I participated in a programming contest; the problems turned out to be extremely difficult and boring, and they required previous knowledge about a particular set of problem, e.g. graph theory, algebra. Our team failed completely at that competition, without solving any problems at all. After I graduated and got my first job as programmer, my daily tasks have revolved around business logic and have nothing to do with the difficult problems I encountered in university. Most of the calculations involve mathematics and nothing more; besides that we only need some general database and good database design knowledge. What kinds of job require knowledge about those advanced problems that I encountered in university?


What programming problems are best solved by using pointers?

Well, I basically understand how to use pointers, but not how best to use them in order to do better programming. What are good projects or problems to resolve involving the use of pointers so I can understand them better?


Are there any academic papers on the merits of imperative over functional programming?

There are lots of academic papers on the merits of functional programming floating around. There's also a lot of debate that I see (on the internet) going on about the relative merits of imperative vs. functional programming. I'm interested to know if that debate extends in academia with actual published papers (the more recent the better I think) discussing the advantages of imperative programming over functional programming.


What is a good design pattern / lib for iOS 5 to synchronize with a web service?

We are developing an iOS application that needs to synchronize with a remote server using web services. The existing web services have an "operations" style rather than REST (implemented in WCF but exposing JSON HTTP endpoints). We are unsure of how to structure the web services to best fit with iOS and would love some advice. We are also interested in how to manage the synchronization process within iOS. Without going into detailed specifics, the application allows the user to estimate repair costs at a remote site. These costs are broken down by room and item. If the user has an internet connection this data can be sent back to the server. Multiple photographs can be taken of each item, but they will be held in a separate queue, which sends when the connection is optimal (ideally wifi). Our backend application controls the unique ids for each room and item. Thus, each time we send these costs to the server, the server echoes the central database ids back, thus, that they can be synchronized in the mobile app. I have simplified this a little, since the operations contract is actually much larger, but I just want to illustrate the basic requirements without complicating matters. Firstly, the web service architecture: We currently have two operations: GetCosts and UpdateCosts. My assumption is that if we used a strict REST architecture we would need to break our single web service operations into multiple smaller services. This would make the services much more chatty and we would also have to guarantee a delivery order from the app. For example, we need to make sure that containing rooms are added before the item. Although this seems much more RESTful, our perception is that these extra calls are expensive connections (security checks, database calls, etc). Does the type of web api (operation over service focus) determine chunky vs chatty? Since this is mobile (3G), are we better handling lots of smaller messages, or a few large ones? Secondly, the iOS side. What is the current advice on how to manage data synchronization within the iOS (5) app itself. We need multiple queues and we need to guarantee delivery order in each queue (and technically, ordering between queues). The server needs to control unique ids and other properties and echo them back to the application. The application then needs to update an internal database and when re-updating, make sure the correct ids are available in the update message (essentially multiple inserts and updates in one call). Our backend has a ton of business logic operating on these cost estimates. We don't want any of this in the app itself. Currently the iOS app sends the cost data, and then the server echoes that data back with populated ids (and other data). The existing cost data is deleted and the echoed response data is added to the client database on the device. This is causing us problems, because any photos might not have been sent, but the original entity tree has been removed and replaced. Obviously updating the costs tree rather than replacing it would remove this problem, but I'm not sure if there are any nice xcode libraries out there to do such things. I welcome any advice you might have.


What was the need of introducing Python 3 when we already had Python 2

I am still learning python and I started with Python 3. This question not Python 2 vs 3 or difference between them like print() is a function and not language construct and 3/2 = 1.5 My question is even if it is still python, what was the need of introduce something new which is not backward compatible, when -   1. Syntax is the same   2. Language philosophy is the same (import this) Uh .. To confuse millions developers out there, no definitely not. I know switching between two will not be that difficult, but as I don't understand internals, Python 3 is definitely have to do with Python's future. **Edit** \- Lets say all the popular packages are ported to Python 3, does that mean we no longer need Python 2


Should I add parameters to instance methods that use those instance fields as parameters?

I have an instance method that uses instance fields in its work. I can leave the method without that parameters as they're available to me, or I can add them to the parameter list, thus making my method more "generic" and not reliable on the class. On the other hand, additional parameters will be in parameters list. Which approach is preferable and why? Edit: at the moment I don't know if my method will be public or private. Edit2: clarification: both method and fields are instance level.


Evaluating mean and std as simulations are added

I have simulations that evaluate a certain value X. I run the simulations several times and save the value of X in a vector V. When all the runs have finished I evaluate the mean and standard deviation for the vector V. This approach works, but implies saving all the values for X. As my computer is quite old and with limited ram, I was wondering if there is a way to update the mean value M and the standard deviation S, knowing the value of X at the (n+1)-th run, and the values of M and S after n runs. How can I update the mean value and the standard deviation as simulations are added to the set? Please note that this is just a conceptual example, I don't save only one number X but thousands at each simulations, so I really have problems running a big number of runs if I have to keep all the past values into the memory.


5 years of university education vs. 5 years of work experience - Which would you pick if hiring?

Say you need to hire a programmer. You have two candidates at your table: one has studied 5 years at uni (and holds a Master's degree, of course), but has no work experience; and the other holds no university degree but has worked for 5 years. Also assume that they both know the same programming languages, have about the same personality and spend equal amount of time programming on their spare time. If you only had this information to go on, which would you pick?


How to answer the question whether I'm a front-end, middle-tier or back-end developer

This was an interview question I got asked. As a software developer I work on whatever task is assigned to me, sometimes it's a GUI component requiring me to add a new dialog box, or change the existing GUI, other times it's a business logic that I need to add/modify, or a new interface required to expose some 3rd party library's functionality - so when I asked this question in an interview, how should I answer it? What exactly are they looking for?


Is it ok to learn from C# 2002 materials?

I've found some videos that explain C# but it back to C#.NET when it is first appeared, if I learn from these videos will I learn something that has been removed from the language? will I miss alot?


What is the good explanation of Tennent's Correspondence Principle?

I found myself struggling to see what is this principle about and why is it so important for language design. Basically, it states, that for every expression `expr` in language should be exactly the same as this construct:               (function () { return expr; })()      Also, I have heard that Ruby obeys this principle, while Python doesn't. I don't understand why this is true, or if it is true at all.


What's a good Programming Metaphor?

I am referring to explaining to the non-programmer what programming is. I made sure to search for similar questions before creating this one, but the few ones I did find seemed to dodge the question, and I specifically would like to see some metaphors or analogies. I personally find it easier to explain something technical to someone through the use of metaphors or analogies. The reason I'm interested in this is because many people encounter the work of a programmer on a daily basis, but if you ask the average person what a programmer is or does, they don't really know. This leads to certain situations of misunderstanding (ex. "[...] but I thought you were good with computers!") I really would like to find the best one out there. I would like to be able to easily explain to someone what my career choice is about. Of course, at least the general idea. I personally don't have a solid one, but I have long thought about it and I have usually gravitated towards the 'language' metaphor, where we happen to know a language that computers understand, and therefore we are able to tell computers what to do, or "teach" them, to solve our problems. For example: > Imagine that in an alternate reality, humanoid robots with artificial > intelligence exist, and some people are able to communicate with them > through a common language, which is a variation of English. These people who > can communicate with the robots are able to teach them how to solve certain > problems or do certain tasks, like doing our chores. > > Well, although robots like that don't exist yet, programmers of our time are > like those people, but instead of communicating with the robots, they > communicate with computers. Programmers "teach" the computers how to perform > certain tasks or solve certain problems by means of _software_ which they > create by using this "common language". > > Programmers and this "common language" are what give us things like email, > websites, video games, word processors, smart phones ( _to put it simply_ ), > and many other things which we use on a daily basis. I don't mean to put programming on the throne or anything, it's just the best metaphor I could come up with. I'm sure someone will find some issue with this one, it's probably a bit contrived, but then again that's why I'm asking this question.


Newbie question about Decorator design pattern

I was reading a programming article and it mentioned the Decorator pattern. I've been programming for awhile but without any kind of formal education or training, but I'm trying to learn about the standard patterns and such. So I looked up the Decorator, and found a Wikipedia article on it. I now understand the concept of the Decorator pattern, but I was a bit confused by this passage: > As an example, consider a window in a windowing system. To allow scrolling > of the window's contents, we may wish to add horizontal or vertical > scrollbars to it, as appropriate. Assume windows are represented by > instances of the Window class, and assume this class has no functionality > for adding scrollbars. We could create a subclass ScrollingWindow that > provides them, or we could create a ScrollingWindowDecorator that adds this > functionality to existing Window objects. At this point, either solution > would be fine. > > Now let's assume we also desire the ability to add borders to our windows. > Again, our original Window class has no support. The ScrollingWindow > subclass now poses a problem, because it has effectively created a new kind > of window. If we wish to add border support to all windows, we must create > subclasses WindowWithBorder and ScrollingWindowWithBorder. Obviously, this > problem gets worse with every new feature to be added. For the decorator > solution, we simply create a new BorderedWindowDecorator—at runtime, we can > decorate existing windows with the ScrollingWindowDecorator or the > BorderedWindowDecorator or both, as we see fit. OK, when they say to add borders to all windows, why not just add functionality into the original Window class to allow for the option? The way I see it is, subclassing is just for adding specific functionality to a class, or overriding a class method. If I needed to add functionality to all existing objects, why wouldn't I just modify the superclass to do so? There was another line in the article: > The decorator pattern is an alternative to subclassing. Subclassing adds > behavior at compile time, and the change affects all instances of the > original class; decorating can provide new behavior at run-time for > individual objects. I don't get where they say "...the change affects all instances of the original class" -- how does subclassing change the parent class? Isn't that the whole point of subclassing? I'm going to assume that the article, like many Wiki's, is just not written clearly. I can see the usefulness of the Decorator in that last line - "...provide new behavior at run-time for individual objects." Without having read about this pattern, if I needed to change behavior at run- time for individual objects, I would have probably built some methods into the super- or subclass to enable/disable said behavior. Please help me really understand the usefulness of the Decorator, and why my newbie thinking is flawed?


How to get hold of the existing code base/projects in squeaksource.com?

I am very new to smalltalk. And I am currently trying to wrap my head around GNU smalltalk (pharo environment). Upon browsing through the introductory session of pharo by example, I came to know that there is a lot of code base in the squeaksource repository submitted by the programmers. The pharo site very well says that anyone can refer this huge code base available. I would like to know how I can actually browse, load and peek into the source code of the projects within my IDE so that I can get a basic understanding about smalltalk syntax and how to code in pharo? Please help me with this.


Terms of Service responsibility when developing a library service that wraps a 3d party API

For my own amusement and instruction I've been developing a C# / .NET library that is basically a wrapper around the Google Geocoding API. It simplifies the entire process and enables users to perform geocoding entirely within .NET code. At some point I was thinking of making the library freely available and, possibly, open-sourcing the entire project by uploading it to somewhere like GitHub or CodePlex. However, Google have a whole host of restrictions on using their service in their Terms of Service. One of these restrictions is: > Note: the Geocoding API may only be used in conjunction with a Google map; > geocoding results without displaying them on a map is prohibited. So my questions are:   1. If I do release my library for other people to use (for free) then do I need to include a license of some sort and does that need to reference the Google Terms of Service?   2. If people use my library in a way that violates Google's terms then who is responsible? I don't want to in anyway to open myself up for liability for other peoples' actions when using my code. **Edit:** I appreciate people here are not lawyers and I don't expect legal advice. I'm just more interested in what people have done in similar situations or would do in this situation. I'll won't hold anyone to account, honest!


How do you decide site availability requirements?

I work on a web application to file a specific kind of county taxes. Our company wants our state to mandate that counties must accept electronic filings (as opposed to paper) from any system that meets some sensible requirements for uptime, security, data validation, etc. (Yes, this would help us as a business, but it would also force county governments to be more efficient.) We're creating a draft of those requirements to be reviewed and tweaked with the state. One of the sections is "availability." We want to specify something reasonably high, but not so high that any unexpected problem will get us (or a competitor) penalized. How do we decide what's reasonable for availability requirements?


Responding to interview questions involving unknown algorithms

Is there any acceptable/effective way to deal with interviewers who ask you to implement an algorithm that you aren't familiar with? I've been interviewing a lot lately and encountering this a lot. Interviewers asking me to implement data structures or algorithms that I have never implemented, and will never implement, throw me completely off guard. In my case, specifically, I'm primarily a system developer, so I spend most of my time dealing with parallelism issues and related, rather than reinventing algorithms, so these questions are very irrelevant to me. As an example, I was asked to implement a function that takes a string and returns a container with all the permutations of that string (C++). I suggested that there were functions dealing with permutations in the standard library that may be usable, but I wasn't sure exactly what the standard library offered, because I had never used these functions before. I can easily solve the problem by nesting multiple loops for a fixed length string, but in this case, the length of the string is dynamic. I couldn't give a solution. After the interview, I looked up the implementation of `next_permutation` in my standard library, and now I'm not surprised that I couldn't come up with this when put on the spot. I doubt many could have answered without knowing the algorithm before hand. What are some ways to deal with questions like this? Is there any acceptable response or way around these questions?


What's good practice for holding a very short, predefined set of data?

When I was working on a programming project. I came across a problem where I had to store data in two different variables. The first one was a piece of data, and the second one was, well, another piece of data, and the order in which the information arrived really didn't matter. So I had to make a choice: I could have either named them `city1` and `city2`, or I could've named them `firstCity` and `secondCity`. With the issue of time in mind, I simply decided to stick to `city1` and `city2`. But, what would've been a ~~better~~ good choice, or at least what could I have done instead?


New license similar to AGPL, but only for Javascript and CSS

I'm developing a piece of software (a WordPress plugin) in PHP and Javascript and CSS. The PHP code must be licensed under GPL, but CSS and Javascript can be under another license (as far as I've understood). I'm thinking about writing a more permissive version of the AGPL license, and use it, for Javascript and CSS. It would be like the AGPL, but it would **only concern files accessible over the network** (e.g. Javascript and CSS). Motivation:   1. I want users of my software, and small companies that use and produce open source software, to be able to use my plugin for free, without having to publish any GPL licensed server side code (PHP code).   2. At the same time, I might not want "big companies" to copy all code I've written, without paying me something. — Most "big companies" would probably be unable to use the AGPL-like license discussed here, and instead I would offer them to buy a commercial license. **Question 1:** Is this a bad / impossible idea, for some reason? **Question 2:** Are there any obvious problems with the below license text? (Is this okay to ask here? If not, please consider editing this question to remove this part of it — or add a comment to me, that I should remove it)               ...The AGPL v3 license text..., see http://www.gnu.org/licenses/agpl-3.0.html          Additional permission under the GNU Affero GPL version 3 section 7:          If you modify or combine this Program, or any covered work,     by linking or combining it with other code, then any such     other code not accessible remotely through a computer     network, is not, for that reason alone (i.e. linking or combining     it) subject to any of the requirements of the GNU Affero GPL     version 3 or later.      Related link: Lesser Affero GPLv3


Programming task organization

My friend and I decided to create a large programming project together. Before that, I have never worked in a pair (I had quite many projects on my own and at work the boss defined the task for me). But now we have an idea of what kind of app we are going to do, how to plan it...but how can we divide the responsibility for the code in the project so that we don't do each other's work and it is not so closely related that we have to overlap each other's code? How would you divide the tasks, what is the original way to do that? How would you divide the tasks in modules if they represent one application and are very closely related?


"I", "We", or Neither in code documentation

I find myself writing (hopefully) helpful comments in code (C++) documentation of the type:               The reason we are doing this is...      The reason I use "we" instead of "I" is because I do a lot of academic writing where "we" is often preferred. So here's the question. Is there a good reason to prefer one over the other in documenting code:   1. **Use "We":** The reason we are doing this is...   2. **Use "I":** The reason I am doing this is...   3. **Use my name:** The reason `[my name]` did this is...   4. **Passive voice:** The reason this was done is...   5. **Neither:** Do this because... I choose #1 because I'm used to writing that way, but documentation is not for the writer, it's for the reader, so I'm wondering if adding the developer name is helpful or if that just adds yet another thing that needs to be changed when maintaining the code.


I need some help with defining a shell syntax

I'm trying to understand more about shells. I'm looking to implement one and want to look at what's been done in the past. In a regular shell, you have features like aliases and relative paths, and strong syntactic conventions, like `--flag` and so on. The IPython community have added loads of nice features to their shells with only a tiny bit of new syntax. Are there other projects that demonstrate innovative features, or novel use of syntax, that could be useful when designing a shell language? _As examples, the answers given below, onBoo and on Forth and Rebol, are perfect._


Why does F. Wagner consider "NOT (AI_LARGER_THAN_8.1)" to be ambiguous?

In his article on Virtual Environments (a part of his VFSM specification method) Ferdinand Wagner describes some new ways of thinking about Boolean Algebra as a software design tool. On page 4 of this PDF article, when describing operators in his system he says this: > Control statements need Boolean values. Hence, the names must be used to > produce Boolean results. To achieve this we want to combine them together > using Boolean operators. There is nothing wrong with usage of AND and OR > operators with their Boolean meaning. For instance, we may write: > > DI_ON OR AI_LARGER_THAN_8.1 AND TIMER_OVER > > to express the control situation: digital input is on or analog input is > larger than 8.1 and timer is over. > > We cannot use the NOT operator, because the result of the Boolean negation > makes sense only for true Boolean values. The result of, for instance, > > NOT (AI_LARGER_THAN_8.1) > > would be ambiguous. If "AI_LARGER_THAN_8.1" is acceptable, why would he consider "NOT (AI_LARGER_THAN_8.1)" to be ambiguous?


In FP languages, calling a function with the same parameters over and over again returns the same result over and over again (i.e. referential transparency). But a function like this (pseudo-code):               function f(a, b) {         return a + b + currentDateTime.seconds;     }      is not going to return the same result for the same parameters. How are these cases handled in FP? How is referential transparency enforced? Or is it not and it depends on the programmers to behave themselves?


Store build server configuration in same repository as source code?

Some co-workers and myself are tasked with a "rewrite" of an ancient, unmaintainable application and to shape it into something workable. I am setting up a continuous integration server, and since we are developing for .NET, I think I will use CruiseControl.net The software being built will have a large amount of build targets (language, features, etc), so changes to the build server config might be more on the frequent side. Since they'll also include drivers and will run a suite of QA tests, they might get pretty complicated too. So one question I have, is should I put the configuration files and settings for the build server in the same source repository as the code base. Then it's easy to know what version of build configuration was used with a revision of the code base. But something about that seems kind of "icky" to me but I don't know why. Or, I can have a separate repository or location for the build server configuration, and maintain the lineage of the config relative to the main code base with the commit messages. Does anyone have any familiarity with either situation and did you run into problems doing one or the other? I believe CC.NET can automatically check out its config info, so both options should work.


Question about new buzzwords about old concepts

What is the fascination with taking old concepts coming up with a buzzword for them and pitching it as new technology complete with 800 page tome with nerd on the cover? A long long time ago, lets say the 80's, I wrote software. It was designed reasonably well and it worked and was maintainable. It separated out different high level functions into different libraries of code and so on. Sometime in the past 10 years, I lose track of the exact time, "Patterns" became popular. Whole encyclopedias were written about design patterns and this patterns and that patterns. We've been doing it for decades (and I'm sure long before I started programming) yet it is suddenly new and novel. Is this just a gimmick to sell books and educational classes? Why add so much noise to the already overcomplicated world of programming when getting things done well is really what matters.


synchronization web service methodologies or papers

I am building a web service (PHP+JSON) to sync with my iphone app. The main goals are:   1. Backup   2. Provide a web view for printing / sorting, manipulating.   3. allow a group sync up and down. I am aware of the logic problems with all of these items, Ie. if one person deletes something, do you persist this change to other users, collisions, etc. I am looking for just any book or scholarly work, or even words of wisdom to address common issues.   * when to detect changes of data with hashes, vs modified dates, or combination.   * how do address consolidation of sequential ID's originating on different client nodes (can be sidestepped in my context, but it would be interesting.)   * dealing with collisions (is there a universally safe way to do so?).    * general best practices.   * how to structure the actual data transaction (ask for whole list then detect changes...)


Easy way to serve mercurial?

I am currently using TortoiseHg on windows. I want my server to be available automatically as it is switched on. But I need to do these:   1. when I set up a new project, I need to enter the localdir=URL pairs under the [web] each time I set up a project.   2. I need to run the hg serve or the Tortoise frontend each time to get it 'up'. I saw many tutorials for setting up Apache as the server. I want something that can be deployed faster. I also saw some web frontends of questionable stability. Is there **mature and easy-to-use software** with push and pull capability, which serves all repos in a given folder? Something that starts/stops without user intervention and can be **easily set up**? Or should I stick with setting up Apache to do it?


What does 'enumerable' mean?

My background in mathematics is very poor (i.e. last relevant math class taken was high school Trigonometry two years ago - another story for another time). I'm reading 'Javascript: The Definitive Guide' and it's a term that is being repetitively used and I've sort of just ran with it. But I've come to a chapter (Chapter 6 - Objects) where my lack of understanding of the term and its application in programming/OOP is starting to become detrimental to the learning process. The online dictionaries aren't helping out, so does somebody have a more explainable definition and/or example to show?


Best way to reliably recognize open source licenses?

In many projects these days most of the novel code consists of glue code that helps combine dozens of different libraries, plugins and helpers that are licensed under a variety of open source licenses. In many cases the licenses are fairly obvious as they carry the name of the license in the license file or comment. In others this is a bit harder and requires memorizing certain wordings to tell the more common licenses apart. I am wondering: Is there an easy way to recognize particularly the very similar licenses (say, MIT/BSD-2/BSD-3) without having to memorize complete license texts or check out the OSI copies as reference?


Best practices for managing deployment of code from dev to production servers?

I am hoping to find an easy tool or method, that allow's managing our code deployment. Here are the features I hope this solution has:   1. Either web-based or batch file, that given a list of files, will communicate to our production server, to backup those files in different folders, and zip them and put them in a backup code folder.   2. Then it records the name, date/time, and purpose of the deployment.   3. Then it sends the files to their proper spot on the production server. I don't want too complex an interface to doing the deployment's because then they might never use it. Or is what I am asking for too unrealistic? I just know that my self-discipline isn't perfect, and I'd rather have a tool I can rely on to do what needs to be done, then my own memory of what exact steps I have to take every time. How do you guys, make sure everything get's deployed correctly, and have easy rollback in case of any mistakes?


Versioning APIs

Suppose that you have a large project supported by an API base. The project also ships a public API that end(ish) users can use. Sometimes you need to make changes to the API base that supports your project. For example, you need to add a feature that needs an API change, a new method, or requires altering of one of the objects, or the format of one of those objects, passed to or from the API. Assuming that you are also using these objects in your public API, the public objects will also change any time you do this, which is undesirable as your clients may rely on the API objects remaining identical for their parsing code to work. (cough C++ WSDL clients...) So one potential solution is to version the API. But when we say "version" the API, it sounds like this also must mean to version the API objects as well as well as providing duplicate method calls for each changed method signature. So I would then have a plain old clr object for each version of my api, which again seems undesirable. And even if I do this, I surely won't be building each object from scratch as that would end up with vast amounts of duplicated code. Rather, the API is likely to extend the private objects we are using for our base API, but then we run into the same problem because added properties would also be available in the public API when they are not supposed to be. So what is some sanity that is usually applied to this situation? I know many public services such as Git for Windows maintains a versioned API, but I'm having trouble imagining an architecture that supports this without vast amounts of duplicate code covering the various versioned methods and input/output objects. I'm aware that processes such as semantic versioning attempt to put some sanity on _when_ public API breaks should occur. The problem is more that it seems like many or most changes require breaking the public API if the objects aren't more separated, but I don't see a good way to do that without duplicating code.


How to make an app more intuitive?

In the industry, there are few standard checklists on how to make a web application more :   1. Scalable   2. Easy to understand/maintain   3. Perform better   4. Robust etc. etc. Are there any standard checklists for how to make an app more 'intuitive'? This of course will differ from app to app...but I am sure there will be some generic ones that apply to all.


Scrum: relaxing "done" or using spikes?

Consider what it takes to completely finish a story in our organization.   * Demo requirements were met   * UI design finalized (layout, styles, fonts, controls, colors, etc...)   * User text finalized and mistake-proofed   * All text translated to Spanish, Germal, Italian and French.   * User manual updated   * All bugs deemed by PO as need fixing for release were fixed   * Documents for FDA updated (SRS,STD,STP,STM,UFMEA, DFMEA, SDD, installation)   * Requirements were written and approved by PO   * UI spec was written and approved by PO   * All tests (final acceptance and integration) written/updated and executed - synced and agreed with test manager   * All FAT tests were approved by QPE   * Regression testing was done   * Code was reviewed and documented   * Unit tests were written and executed - synced and agreed with software manager.   * Refactoring, if needed, was done - synced and agreed with software architect.   * Design was documented   * Installer was updated (If needed) With so much work needed to fully complete a story, the team stops being nimble and it becomes more difficult to try out new features quickly. As far as I see there are 3 ways to solve this problem:   1. Do more "Spike" stories which don't meet the "Done" definition but serve as quick prototypes to gather feedback from users.   2. Get feedback from users all the time during the Sprint rather than at the end of it. So half-way through the story you could already gauge what users think of the story and quickly adapt before doing all the heavy stuff (translations, user manual and such).   3. Relaxing the "Done" definition to require just basic testing and bug fixing. This way the team won't have a potentially shippable product at the end of the Sprint, but it will be very quick to try new features and technical innovations without suffering from the burden of documenting everything, writing user manual, doing design polishes, etc... Which option would you pick and why? Thank you.