title: Development-led security vs administration-led security in a software product?

text: There are cases where you have the opportunity, as a developer, to enforce stricter security features and protections on a software, though they could very well be managed at an environmental level (ie, the operating system would take care of it). Where would you say you draw the line, and what elements do you factor in your decision? ## Concrete Examples ### User Management is the OS's responsibility Not exactly meant as a security feature, but in a similar case Google Chrome used to not allow separate profiles. The invoked reason (though it now supports multiple profiles for a same OS user) used to be that user management was the operating system's responsibility. ### Disabling Web-Form Fields A recurrent request I see addressed online is to have auto-completion be disabled on form fields. Auto-completion didn't exist in old browsers, and was a welcome feature at the time it was introduced for people who needed to fill in forms often. But it also brought in some security concerns, and so some browsers started to implement, on top of the (obviously needed) setting in their own preference/customization panel, an `autocomplete` attribute for `form` or `input` fields. And this has now been introduced into the upcoming HTML5 standard. For browsers that do not listen to this attribute, strange hacks* are offered, like generating unique IDs and names for fields to avoid them from being suggested in future forms (which comes with another herd of issues, like polluting your local auto-fill cache and not preventing a password from being stored in it, but instead probably duplicating its occurences). In this particular case, and others, I'd argue that this is a **user setting** and that it's the **user's desire** and the **user's responsibility** to enable or disable auto-fill (by disabling the feature altogether). And if it is based on an internal policy and security requirement in a corporate environment, then substitute the user for the administrator in the above. I assume it could be counter-argued that the user may want to access non- critical applications (or sites) with this handy feature enabled, and critical applications with this feature disabled. But then I'd think that's what security zones are for (in some browsers), or the sign that you need a more secure (and dedicated) environment / account to use these applications. * I obviously don't deny the ingeniosity of the people who were **forced** to find workarounds, just the necessity of said workarounds. * * * ## Questions That was a tad long-winded, so I guess my questions are:   * Would you in general consider it to be the application's (hence, the developer's) responsiblity?   * Where do you draw the line, if not in the "general" case?


title: When creating a library for a simple program, what must I do to protect others from its lack of thread safety?

text: When creating a library for a simple program, is it more cost effective to make it thread safe or is there a way to detect the program's use in a multithreaded program and ASSERT() or otherwise determine (preferably at compile or link time) that it may create problems. Related help for this question would be automated tool support for finding potential problems with thread safety, programming language features that enforce it,


title: Should Swing knowledge be required from Java programmers?

text: Swing is an integral part of the Java API. It is also the most popular GUI framework for Java. I still wonder, should every Java programmer still know, or at least be pretty familiar with, Swing (possibly excluding web developers)? There are alternatives (e.g. SWT), but they are not very widely used (compared to Swing). What do you think about requiring Swing knowledge from Java programmers? If such knowledge is important, to what degree? Are the basics enough or not? The reason I wonder is because I really don't like Swing but wonder if I still should brush up my skills in it. I'm able to create simple GUIs in it, but I would definitely not say that I know Swing well.


title: Where to get experience with Big Data?

text: I have a strong interest in creating and learning about highly scalable web sites and applications which deal with Big Data. For example, many world class web companies and startups such as Twitter, Facebook, Google, etc deal with massive amounts of data and their software engineers use tools such as Hadoop/MapReduce, Cassandra/memcache, and other algorithms and techniques and tools to make sense of this data. To me this is a very interesting and challenging area and much more invigorating than just creating yet another e-commerce or web portal for a commercial company. Naturally working at a typical software development firm won't get you experience with this level of massively distributed data processing opportunity, and very few if any people have access to cpu clusters to run Hadoop, DryadLinq, etc. I wanted to inquire if there are certain geographic areas in the countries which have companies dealing with such Big Data problems - Silicon Valley would be an obvious one, any others? Also, feel free to mention any non-obvious startups and companies which are dealing with such challenging problems. EDIT: Just read this recent article by Matt Welsh of Harvard on his (sabbatical) at Google and the scale of problems he's working on (he sounds clearly excited): Computing at scale, or, how Google has warped my brain EDIT: Found another new link on getting experience with large scale data at government institutions Tackling Large Scale Data in Government Thanks,


title: When should I make the first commit to source control?

text: I'm never sure when a project is far enough along to first commit to source control. I tend to put off committing until the project is 'framework- complete,' and I primarily commit features from then on. (I haven't done any personal projects large enough to have a core framework too big for this.) I have a feeling this isn't best practice, though I'm not sure what could go wrong. Let's say, for example, I have a project which consists of a single code file. It will take about 10 lines of boilerplate code, and 100 lines to get the project working with extremely basic functionality (1 or 2 features). Should I first check in:   1. The empty file?   2. The boilerplate code?   3. The first features?   4. At some other point? Also, what are the reasons to check in at a specific point?


title: Continous Delivery TFS

text: Is it possible to achieve Continuous Delivery using TFS e.g. Windows Service? There are > 1000 posts on how to use msdeploy with TFS for WEB projects. I am trying to understand why there are no resources such as blogs, articles, msdn or best practises for Continuous Delivery for Windows service using TFS. I am not sure tow to achieve the following without any working reference materials. This is so frustrating.   1. Archive existing codebase on Remote server for Service as well for Web project not on Integration Server please!    2. How To Stop services on Remote server not on Integration Server    3. Copy New code Base on Remote Server    4. Start Services


title: On the frontier between work and home

text: I think we've all been there: You hear of someone say "hey, wouldn't it be nice if platform X had feature Y?" You look around (on SO!), the feature really doesn't exist, even though it probably would be useful in many contexts. So it's pretty generic. Your mind wanders for a bit. "How tough would it be? Well, it'd probably be just a snippet. And an ad-hoc function. And maybe a wrapper." And boom, before you know it, you've spent a dozen hours of **your free time** implementing a FooFeature that's really neat and generic. The kind of code you might not even have the time to spit and shine at work, that would be a bit rushed and not so documented. So now you wonder "wouldn't this be useful to others?" And you've got your blog, maybe a CodeProject account, and your colleague who asked if FooFeature exists might, haphazardly, come accross that blog entry, had it existed before they told you. On the otherhand, the NDA agreement. It's sort of vague and general. It doesn't forbid you from coding at home, but it's clear on sharing company code, that's a big NO. But this isn't company code. Or is it? Or will it be? So, what do you do with code (that's more than just a snippet) you wrote in your off time with universality in mind but an idea that came from work, and that will most likely be used at work? Can it be published?


title: Pitfalls in the Grails Framework

text: What are some of the biggest issues/pitfalls with using the Grails framework? I'm learning the framework now, and I really like it, but I need to know what major issues I may encounter when using it and how to avoid them.


title: Is there a name for the new "shake phone" interface convention?

text: Some mobile applications leverage the fact that smart phones have motion sensitivity to provide a "shake" feature. For example, I believe Urban Spoon has an app with which you can view a recommendation for a nearby restaurant; if you don't like the recommendation then you can shake your phone and it will immediately come up with another one. Is there a **word** for this new interface pattern/idiom/convention (or whatever you want to call it)?


title: Will taking courses in system administration help land a programming job?

text: I just completed a B.S. in Computer Science from a less-than-reputable college, and I am having trouble finding a job. Looking around for ways to find a job, I came across an institute that teaches system administration. Their claim is that, after finishing the course, I will be in a much better position than "normal" Java programmers and my salary will grow "exponentially". I don't buy that claim, but additionally, he kept saying that this course will help me choose jobs in country of my choice as there are very less people available in this particular domain. When asked why the salary grows "exponentially", he drew an analogy where he said it was "for the same reasons heart specialists are paid more than orthodontists". This is because the job profile will be maintaining important data and make sure that availability of the systems which is very critical in fields like health care and Banking (I am not sure about this claim). My whole point is, I am very interested in programming. Will taking a course in systems administration help me at all? Are any of the claims he's made reflective of reality?


title: To Repository Or Not To Repository

text: When I first learnt about Domain Driven Design, I was also introduced to the repository and unit of work patterns that once seemed to be top notch for the cool kids that threw SQL queries like cavemans against databases. The deeper I got into that topic, the more I learnt that they don't seem to be necessary anymore because of _ORMs_ like **EF** and **NHibernate** that implement both unit of work and repositories into one API, called session or context. Now I'm unsure what to do. To repository or not to repository. I really understand the argument that such leaky abstractions only over-complicate things while adding absolutely nothing that may simplify data access, however, it doesn't feel right to couple every possible aspect of my application to e.g. **Entity Framework**. Usually, I follow a few simple guidelines:   1. The domain layer is the heart of the system, containing entities, services, repositories...   2. The infrastructure layer provides implementations of domain interfaces of a infrastructural concern, e.g. file, database, protocols..   3. The application layer hosts a composition root that wire things up and orchestrates everything. My solutions usually look like this:               Domain.Module1     Domain.Module2         IModule2Repo         IModule2Service         Module2     Infrastructure.Persistence         Repositories             EntityFrameworkRepositoryBase     MyApp         Boostrapper             -> inject EntityFrameworkRepositoryBase into IRepository etc.      I keep my domain layer clean by using a `IRepository<'T>` which is also a domain concern not depending on anything else that tells me how to access data. When I now would make a concrete implementation of `IModule2Service` that requires data access, I would have to inject `DbContext` and by this, coupling it directly to the infrastructure layer. ( _Coming to Visual Studio project, this can end up really tricky because of circular dependencies!_ ) **Additionally** What can be an alternative to _depositories_ and _fucktons of works_? CQRS? How does one abstract a pure infrastructural framework?


title: structure problem in Relational DBMS creation

text: For learning and understanding purpose, I currently want to try to make a small relational `DBMS` with simple features like (for now) only sequential reading/writing and **CREATE TABLE** , **INSERT** , **SELECT** , **UPDATE** and **DELETE** management. I am currently on the " _think_ " part of the project and I am stuck on the way to store the read data in memory. First I was thinking of putting them properly on a structure, but the problem is that tables are all different, know the type of each column is not an issue, but I am not sure C provide a way to make fully dynamic structure. My second and current idea is to make a simple `char array` of the required length and just get the data by order with cast. But I am not sure if it is the good way to do that part, so I wanted to ask for your opinion and advices about that. Thanks in advance for your help. * * * nb: I hope my question is enough clear and understandable, I still lack of pratice in english


title: Conceptual question regarding the portability of a software from desktop to mobile

text: I am planning to create a web solution for the desktop, I would be dividing my task into three steps   1. Design   2. Coding   3. Automated use case I am wondering if in the future I have to port my web solution as mobile phone native application. How would I do that? Will I go back again to the design phase to redesign or will I just recode some of the already written stuff meant to be for the desktop?


title: Standard semantic name for 3rd table in 3NF

text: For 3 tables that are in 3NF, a many-to-many relationship, is there a standard name or term to describe the 3rd table, the one that associates the other tables? Basically, I'm looking for a semantic way to name the 3rd table. **Example** You have two tables: _users_ and _widgets_. A user can have multiple widgets and a widget can be owned by multiple users. What is the most semantic name for the 3rd table? In the past, I've used the following at one time or another:   * userWidgets   * userWidgetAssn (association)   * userWidgetXref (cross-reference) In my example, userWidgets is probably my top choice, but it doesn't always work as cleanly depending on the table names. Is there an industry standard?


title: Developing With Ruby/Rails Easier, Faster Than Developing With PHP/CakePHP?

text: What is your experience when developing web applications using one of these two languages/frameworks? Which have you found to be more convenient and faster to develop with?


title: Best way to implement database design for a set of entities

text: Lets say I have a scenario like so: I have many claims to get money from another entity and this claim has to go through two gateways. This claim is sent from an origin system and can possibly be rejected at each gateway. If the claim is rejected at either gateway, one or more messages will be sent back to the origin system that indicate why it was rejected at that gateway. Here's a diagram: ![enter image description here](http://i.stack.imgur.com/RTBvY.png) Note that the some attributes of messages of a rejection from Gateway #1 are different from #2 in my actual system, so they are not the same type of entity. Now, my requirement is to create a reporting system that can display various aggregations of that data by designing a database layout for it. The reporting needs to be able to aggregate by claim cost, number of claims, and be able to display reports at the rejection message level too. Another requirement is to be able to see if a claim was resubmitted through the process based on an ID representing an overall claim process. From my company there appear to be two routes to go about creating the database table layout for this reporting system, listed here: Have one table that displays all attriutes of the claim, and both rejection levels and put all necessary attributes of those entities as different aggregations on that table (denormalized). Or... Create a table layout in which there is a table that represents the claim, a table that represents a rejection at gateway 1, and a table that represents a rejection at gateway 2, with the claim table being the parent of the other two. Keep in mind that rejections at both gateways #1 and #2 contain different attributes. What is the best route to choose between these two choices? Is it situational, as in is there a best option depending on other requriements, and if so, can you explain what those requirements might be?


title: In Android, is there any reason to set up a content provider for a local database?

text: I have an android application with a custom content provider set up to load data asychonously. The database is a local file so I'm not sure if I needed to set up a content provider at all. Sometimes I just need to do something like get a name back from a short list by id. Is it ok to mix the content provider pattern with simple direct database calls, i.e open, query, close type of code blocks?


title: Functional Programming, JavaScript and UI - some neophyte questions

text: In the discussion here, the comments in the accepted answer suggest that I approach the given code from a functional perspective, which was new to me at the time. Wikipedia said, among other things, that FP "avoids state and mutable data", which includes according to the discussion global vars. Now, being that I am already pretty far along in my project I am not going to learn FP before I finish, but:   1. How is it possible to avoid global vars if, for instance, I have a UI whose entire functionality changes if a mousebutton is down? I have a number of things like this.   2. Why was there a strong negative reaction among some experienced coders to implementing FP in JS? When I brought up what seemed to me to be supportive comments by Crockford, people got even madder. Are there strong arguments against using fp in JS? What constitutes a "functional language" and why is JS "not it"?


title: Learning to program after a 9-5 job

text: I'm currently working as an IT administrator, but I'm thinking of making a slight career change into programming. I want to focus my time and effort into learning some web-based languages, but does it feel achievable when working full time to expect to make much progress after a long day's work? I love to read, but this is sometimes a hindrance. I have read on some resources that you will never make much progress unless you quit your 9-5 job and dedicate six months to getting a fundamental understanding.


title: How REST is used outside of the web

text: I was recently reading the Wikipedia article for Resource-Oriented Architectures (ROA) and stumbled across an article that made the assertion that, although REST is a technology that is very-well suited for web applications and web services, that it is nevertheless a standalone technology that can be used in non-web applications. This is the first I've ever heard of such a thing! I thought REST was a SOAP competitor, but that the two were strictly web service solutions. My question: can someone provide an example for how REST is used in something that isn't a web app? Like a Swing client, or a command line tool, or an EJB.


title: What effect does the utilization of pseudocode and comments have when a software engineer designs software?

text: I am a programmer by trade so in my English Class ENC 1102, when we were asked to come up with a discourse community in which we could relate the use of writing skills I thought about pseudocode and comments. So the question is as follows: What effect does the utilization of psuedocode and comments have when a software engineer or programmer designs software? I want to know how writing pseudocode and comments have had in your work process. Does it make it better, faster, worse? Share your experiences and opinions please.


title: Do you prefer conciseness or readability in your code?

text: Language shortcuts can often be used to make code more concise. For example, ternary and null coalescing operators can reduce the amount of code, but arguably to the detriment of readability: In C#:               Person newGuy = new Person();     if (boss == null) {         newGuy.Boss = GetDefaultBoss();     } else {         newGuy.Boss = boss;     }      is functionally equivalent to:               Person newGuy = new Person();     newGuy.Boss = boss ?? GetDefaultBoss();      but obviously a lot more verbose. **Where do you draw the line when it comes to conciseness vs readability?**


title: Noda Time vs Joda Time?

text: In the Noda Time User's Guide, the rationale section states: > the public API has been largely rewritten, both to provide an API which is > more idiomatic for .NET, and also to rectify some of the Joda Time decisions > which the Noda Time team view as "unfortunate". (Some of these are simply > due to having different goals; others I'd argue are really mistakes.) What are these decisions that are different/better? This would not count differences just for language syntax, but would include anything done to make the users less likely to make a programming error (library usability).


title: How do I create a potential shippable product (PSP) at the end of a sprint?

text: I'm running a team of 4 developers and 2 testers and trying to abide by the Scrum principle of creating a PSP with every sprint. That means I need to create a potential release with all the user stories that got to Done and store it on some publish server for the PO to do with as they please. My problem is how to technically create the build when some stories are not at Done at the end of the sprint? The code is checked in, but didn't completely pass testing. If I only check-in code that is Done, i.e. code complete-reviewed-tested, I run in to the possibility of diverging code bases and merges that may be disastrous. For instance Developers A and B work on different features that modify assembly X. Dev A finishes coding, pushes assembly X to test. The next day Dev B finishes coding and pushes assembly X to test. Feature A comes back with bugs, feature B is perfect. Oops, sprint is over. Now, how do I create a PSP with feature B but not A?


title: Resources on learning to program in machine code?

text: I'm a student, fresh into programming and loving it, from Java to C++ and down to C. I moved backwards to the barebones and thought to go further down to Assembly. But, to my surprise, a lot of people said it's not as fast as C and there is no use. They suggested learning either how to program a kernel or writing a C compiler. My dream is to learn to program in binary (machine code) or maybe program bare metal (program micro-controller physically) or write bios or boot loaders or something of that nature. The only possible thing I heard after so much research is that a hex editor is the closest thing to machine language I could find in this age and era. Are there other things I'm unaware of? Are there any resources to learn to program in machine code? Preferably on a 8-bit micro-controller/microprocessor. This question is similar to mine, but I'm interested in practical learning first and then understanding the theory.


title: Migrating from jdbc to MyBatis -- advice needed

text: I am working on a Java application (an ERP) that has grown pretty large, and will continue to grow for the next couple of years. We have been using Spring- JDBC for our DAO layer. But the amount of boilerplate code that needs to be written is slowing us down significantly, not to mention introducing silly bugs in the system. So now we're looking for a solution that will:   * Reduce the amount of time we need to spend on the DAO layer   * Doesn't have a very steep learning curve   * Gives us control over our queries, like we have with JDBC.   * We should be able port our existing code part-by-part, not all at once. I thought MyBatis would be a good choice, but I'm not sure if it would satisfy all our requirements. In particular, would it be able to work alongside our Spring-JDBC code without creating problems in transaction management, handling concurrency etc? Edit: Forgot to mention that we're using Spring-AOP for transaction management, which we'd prefer to continue with. Thanks!


title: What to do when the lead programmer is doing almost zero work?

text: I am currently working on a project with a small dev team. The problem is that the lead programmer is "working remotely", and does virtually no work. We have missed every deadline, and at this rate we will miss many more. The lead programmer is a great talker, and has convinced the CEO that everything is fine. It doesn't bother me that he gets paid for doing nothing. What bothers me is that he is harming every single employee and destroying the company. It's clear from our project management tool that the lead programmer hasn't delivered most of his tasks. The idea to critique the code and not the programmer ( My coworker is a nice guy, but his performance is sub-par. Do I tell my boss?) is great, but the problem is not the quality of the code. The problem is that code is not being created. I feel like I should tell the CEO what is going on, but I also feel like it's not fair to the lead programmer to go behind his back and tell the boss that he is not doing work. The other problem is that the boss is very direct. I think he will call the lead programmer and say, "This guy says that you aren't doing anything. What's going on?" The result will be that nothing will get solved and the lead programmer will get pissed off, making it difficult to work with him.


title: Parsing multiple file formats/protocols

text: We are starting a project where we will need to write parsers for a bunch of binary file formats, each of them representing very similar data (time-value series from different measurement devices). Since we are starting from scratch, I would like to get it right, and I see two possible approaches:   1. write dedicated, home grown binary parsers for each format separately, or   2. represent binary formats using a grammar, and then use some standard algorithms for lexical analysis/tokenization. Whenever I seek for advice on how to build a parser, I find most guys advocating the latter approach. However, I don't have much experience with formal grammars and languages, and I am afraid that there might be a learning curve before we get results. So, I basically have these questions:   * What is the problem with coding parsers "by hand"?   * Is there a practical "size limit" of a problem when it pays off to invest in learning the "formal approach"?   * Most parsing examples focus on textual files. What is the good way to specify grammar for a binary parser?


title: DVCS and different versions of the same Product

text: Let's say that we have an application, with two (or more) different versions. E.g. Professional and Lite editions. What would be the best way to keep the source under version control (DVCS in particular). The assumption here is that some or most of the code is common, but the Professional edition has some extra code as well. What would be the optimum way of versioning the code with a system like git or Mercurial?


title: Reinventing the Wheel, why should I?

text: So I have this problem, it may be my OCD (i have OCD it's not severe.....but It makes me very..lets say specific about certain things, programming being one of them) or it may be the fact that I graduated college and still feel "meh" at programming. Reading This made me think "OH thats me!" but thats not really my main problem. My big problem is....anytime im using a high level language/API/etc. I always think to myself that im not really "programming". I know I know...it sounds stupid. But Like I feel like....if i can't figure out how to do it at the lowest level then Im not really "understanding" it. I do this for just about every new technology I learn. I look at the lowest level and try to understand it. Sometimes I do.....most of the time I don't, I mean i've only really been programming for 4 years (at college, if you even call it programming.....our university's program was "meh"). For instance I do a little bit of embedded programming (with the Atmel AVR 8bits/Arduino stuff). And I can't bring myself to use the C compiler, even though it's 8 million times easier than using assembly......it's stupid I know... Anyone else feel like this, I think it's just my OCD that makes me feel this way....but has anyone else ever felt like they need to go down to the lowest level of the language to even be satisfied with using it? I apologize for the very very odd question, but I think it really hinders me in getting deep seeded into a programming language and making a real application of my own. (it's silly I know)


title: Developing wheel reinventing tendencies into a skill as opposed to reluctantly learning wheel-finding skills?

text: I am more of a **high-level wheel reinventor**. I definitely prefer to make use of existing API features built into a language and popular third-party frameworks that I know can solve the problem, however when I have a particular problem that I feel capable of solving within a reasonable time **I am very reluctant to find someone else's solution**. > ## Here are a few reasons why I reinvent: > >   1. **It takes time to learn a new API** >   2. **API restrictions might exist that I don't know about** >   3. **Avoiding re-work of unfamiliar code** > I am conflicted between doing what I know and shifting to a new technique I don't feel comfortable with. On one hand I feel like following my instincts and getting really good at solving problems, especially ones that I would never challenge myself with if all I did was try to find answers. And on the other hand I feel like I might be missing out on important skills like saving time by finding the right framework and expanding my knowledge by learning how to use a new framework. * * * I guess my question comes down to this: My current attitude is to stick to the built-in API and APIs I know well* and to not spend my time searching github for a solution to a problem I know I can solve myself within a reasonable amount of time. _Is that a reasonable **balance** for a successful programmer?_ *Obviously I will still look around for new frameworks that save time and solve/simplify difficult problems.


title: Does your company have a coding standard?

text: I recently saw that Microsoft released a coding standards document (All-In-One Code Framework Coding Standards) and it got me thinking... The company that I work for has no formal coding standards at all. There are only a few developers and we have been together long enough to have evolved into similar styles and its never been an issue. Does the company you work for have a documented coding standards? If no, why not? Does having a standard make a difference? Is it worth writing a standard from scratch or should you adopt another standard as your own (ie. make Microsoft's standards yours)?


title: sets of numbers that sum to a certain number?

text: I was asked this in an interview, and I'm not sure what the answer is or how to approach the problem. > Find a pair of numbers that sum up to zero (or any other number), then find > three (and then four) numbers that sum up to zero.


title: web vs desktop? (php vs c++?)

text: I need to write a simple file transfer mechanism (that isn't ftp). Firstly, it must have a GUI. Secondly, it must not be dropbox. Third, it may not use any paid libraries, and hopefully, it uses open source components. The question that came to my mind is, where is everyone moving, from desktop to web, or from web to desktop? Would it be more useful to be experienced in say, C++ than in PHP (or vice versa)?


title: The perfect crossfade

text: I find it hard to describe this problem in words, which is why I made a video (45 seconds) to illustrate it. Here's a preview of the questions, please have a look at it on Vimeo: http://vimeo.com/epologee/perfect-crossfade ![Using a linear crossfade the resulting image will have a 'dip' in transparency. How can I prevent this?](http://i.stack.imgur.com/EkLXN.png) The issue of creating a flawless crossfade or dissolve of two images or shapes has been recurring to me in a number of fields over the last decade. First in video editing, then in Flash animation and now in iOS programming. When you start googling it, there are many workarounds to be found, but I really want to solve this without a hack this time. **The summary:**   What is the name of the technique or curve to apply in crossfading two semi- transparent, same-colored bitmaps, if you want the resulting transparency to match the original of either one? Is there a (mathematical) function to calculate the neccessary partial transparency/alpha values during the fade? Are there programming languages that have these functions as a preset, similar to the `ease in`, `ease out` or `ease in out` functions found in ActionScript or Cocoa? **Update:** In addition to the video, I've made a sample project (requires Xcode and iOS SDK) and posted it on github. It shows the same animation as the video but this time with squares: https://github.com/epologee/StackOverflow- Example-Code


title: Breaking down CS courses for freshmen

text: I'm a student putting together a slide geared towards freshmen level students who are trying to understand what the importance of various classes in the CS curriculum are. Would it be safe to say that this list is fairly accurate?   * Data structures: how to store stuff in programs    * Discrete math: how to think logically    * Bits & bytes: how to ‘speak’ the machine’s language   * Advanced data structures: how to store stuff in more ways    * Algorithms: how to compute things efficiently    * Operating systems: how to do manage different processes/threads


title: When we say "sanity" when referring to user input, are we talking about the cleanliness of the input or whether or not it is sane?

text: I often hear people say they "sanitize input," which would mean make it clean. I understand this to mean "clean of potentially damaging contents," where the function that does the sanitizing would do something like character escaping. But then I hear things like "sane input," which to me, means the input isn't a string where a double was expected, or "January Third of Nineteen Ninety Five" where "1995/01/03" would have been correct. This represents a matter of formatting. Then we have "sanity functions," which handle user input to make it usable by the backend of the software. Can this refer to both types of input validation? Does it only deal with the formatting (like "sane input"), or with cleanliness of the input (like "sanitized input")? Are they two different classes of operations, or does sanity in this case just refer to both? I always thought it referred to sanitizing it (if that actually means something different than making it sane) since I thought "sanity" was a root for "sanitize." But I just looked it up and can't find any definition of "sanity" that has anything to do with cleanliness or sanitization. Is there idioms for each of these operations that I don't know about, or is it always just "sanity functions" which do both of these things? Would it be confusing to see "sanity" and "safety" functions?


title: Object oriented EDI handling in PHP

text: I'm currently starting a new sub project where I will:   1. Retrieve the order information from our mainframe   2. Save the order information to our web-apps' database   3. Send the order as EDI (either D01b or D93a)   4. Receive the order response, despatch advice and invoice messages   5. Do all kinds of fun things with the resulting datasets. However I am struggling with my initial class designs. The order information will be retrieved from the mainframe which will result in a "AOrder" class, this isn't a problem, I am not sure about how to mold this local object into an EDI string. Should I create EDIOrder/EDIOrderResponse/etc classes with matching decorators (EDIOrderD01BDecorator, EDIOrderD93ADecorator)? Do I need builder objects or can I do:               // $myOrder is instance of AOrder     $myOrder->toEDIOrder();     $decorator = new EDIOrderD01BDecorator($myOrder);     $edi = $decorator->getEDIString();      And it'll have to work the other way around as well. Is the following code a good way of handling this problem or should I go about this differently?               $ediString = $myEDIMessageBroker->fetch();     $ediOrderResponse = EDIOrderResponse::fromString($ediString);      I'm just not so sure about how I should go about designing the classes and interactions between them. Thanks for reading and helping.


title: What did Bjarne Stroustrup mean by his characterization of C and C++?

text: There's a quotation by Bjarne Stroustrup that says: > C makes it easy to shoot yourself in the foot; C++ makes it harder, but when > you do, it blows away your whole leg. I've often come across this quotation when reading library documentation and tutorials; particularly ones that wrap C functions in C++ classes, or are wrappers to C libraries. But what did he mean by this?


title: What can I do when the interviewer doesn't know the answer to his/her own question?

text: Yesterday I had a terrible experience in an interview. Interviewer asked me about pure virtual function. I said, It may or may not have definition in base class, but derived classes should provide definition unless they also want to be abstract class. But interviewer kept on asking that "Can pure virtual have definition !!! ???"... I said yes. Again he said "Pure ?" I said yes. It is allowed, derived classes can explicitly call that function if they want that particular behavior. He sent me out. I am sure that he doesn't know the fact that pure virtual function can have definition. How to deal with this kind of Interviewers ? After asking 2nd time, should i lie that it can't have definition ? :) Or i should stick to my words and loose the job opportunity ?


title: At what age could I reasonably teach my children about programming?

text: In case my child would be interested in what I am doing... At what age could I reasonably teach my child what programming is? What is your experience with teaching them to program if they want to? Are there great articles about this?


title: How to bill a client for frequently-interrupted time

text: I find that when I'm working on hourly-billable projects (in particular, those that are research/design/architecture-oriented as opposed to straight coding) that I'm easily distracted by any number of things (email, grab a drink (loss of focus, but nature happens), link off the webpage I was reading, wandering mind (easy when the job calls for a lot of thinking), etc.) This results in very fragmented time, far too incremental IMO to accurately track with a timeclock, and some time very gray. I frequently end up billing for only some fraction of the elapsed time I spent in order to feel fair, but sometimes it takes a really long time to put in an 8-hour day. By contrast, when I've worked for salary I've not worried about whether I'm actively working at any given minute, I just get the job done, and I've never had anything but stellar reviews/feedback from past salaried employers, so I think I get the job done well. I personally believe in an 80/20 cycle: I get 80% of my work done during an inspired 20% of my time. But I have to screw around the other 80% of the time in order to get that first 20%. So the question: what billing/time-tracking policy can I adopt in order to be fair to my hourly customers without having to write off my own less-productive 80% that a salaried employer is willing to overlook in light of the complete package? Note: This question is not about how to be more productive or focused. It's about how to work around whatever salient limitations that I have in a way that's both fair to me and to my customers. **Update** : A little clarification (to pre-emptively stop some righteous indignation): I currently have a half dozen different project/client groups. It's not a great situation and I'm working at reducing it down to two, but that's my current reality. It's very easy to get off on a thread related to a different project than the one I'm clocking, and I'm not always conscious of it at the time. [I did not intend the question to mean that I was off playing games or making personal calls, etc., and have adjusted wording above to be clearer. Most of the time. I am only human, and sometimes the mind does force you to take a break! :-)]


title: Integer sign and compilation via C

text: I'm writing a compiler that uses the time-honored strategy of using a C compiler as the back end, and I'm trying to figure out exactly how to handle integer sign. I'm using machine word integers as the default (translating into `intptr_t` and `uintptr_t` in the generated C), and while for myself I would prefer to make the default unsigned, I probably don't have much choice about making it signed just because that expectation is so widely ingrained. I'm defining the result of integer overflow to be wraparound (at least by default, might add an option to throw an exception later), but in C, signed integer overflow is undefined behavior, so I can't just emit code that performs signed integer arithmetic. It seems to me there are two options:   1. Emit signed integers, but convert to unsigned for all arithmetic operations except division and right shift (these are the only ones where the difference matters, and also the only ones that can't overflow - **edit:** except for `INT_MIN` / -1; I had been considering that in the same category as division by zero, but of course it is strictly speaking an overflow).   2. Emit unsigned integers, but convert to signed for division (resisting the temptation to make division of negative numbers undefined behavior), right shift and comparison other than equality.   3. Emit signed integers anyway, use `-fwrapv` when using GCC as the backend, and hope other C compilers either don't take advantage of signed overflow being undefined, or provide a switch to disable such optimizations. Does the third option work (e.g. are there any C compilers where you can't make signed overflow wrap)? If not, which of the first two is likely to involve less code and opportunity for error? Is there anything I'm missing?


title: Average size of in-house web development team for U.S. companies?

text: When I graduated, I thought getting into a web development job meant I get to work in a group of at least a handful of developers, and seniors can teach this young Padawan their tricks of the trade. In my experience, when I get hired as a junior web developer I'm usually have really limited contact and collaboration with one or two other developers (because we seldom work on the same projects), or sometimes I'm the only one that knows how to code. I've grown to hate these "lone wolf" positions and would rather work in a highly collaborative environment full of other programming geeks. Most of these places tend to outsource technical work, and I prefer face-to-face communication with peers in my dept. I like the small-company culture but at the same time, there's such a thing as too small, to the point where there's little actual technical work done in- house so I can't get any expert advice. Because my experience is anecdotal, I don't think I am getting the big picture as to the sizes and structures of web dev companies. So my related questions... Is my lack of experience with large in-house teams due to the fact that I mostly get hired by consulting firms that do client work? Do companies that create their own products have a vastly different structure? What should I look for in a company if I want to get into a larger, in-house development team?


title: Get/Post Controller Logic Best Practice

text: In an ASP.NET MVC project (Razor), I have a Get request, which loads two properties on a model, dependent on the property passed into the action method. So if the parameter has a value, the Group property is supplied data. But if not, the Groups collection property is supplied data. In the post action method, when I process the data, to repopulate the view, I have to provide similar logic, and could getaway with returning `Action(param)` (the get response) to the caller. My question is, based on experience, is that a good practice to get into? I see some downsides to doing that, but adds the lack of code redundancy. Or is there a better alternative?


title: How to generalize a classes that has identical function plus some additional function

text: I have some designing problems with my project. To illustrate my problem, I'll use the following two classes from my project.               public class RAM_UserManagement{       private Map<int,User> userList;       public User addUser(User user){//do stuff}       public User deleteUser(User user){//do stuff}       public User updateUser(User user){//do stuff}       public List<User> getAllUser(){//do stuff}       public User getUserById(int userId){//do stuff}     }          public class RAM_ServiceManagment{       private Map<int,Serivce> serviceList;       public Service addService(Service ser){//do stuff}       public Service deleteService(Service ser){//do stuff}       public Service updateService(Service ser){//do stuff}       public List<Service> getAllSerivces(){//do stuff}       public Service getServiceById(int id){//do stuff}       public Service getServiceByStatus(ENUM_STATUS status){//do stuff}       public Service getServiceByUserName(String Name){//do stuff}     }      As you can see, from the nature of these classes they both doing exact same thing with some extra functionality. I am trying to generalize it by creating an interface. This is what I have in mind               public interface IStorage<T>{       public T add(T item);       public T delete(T item);       public T update(T item);       public List<T> getAll();//This is where I am struggling..     }      So CUD operation in both classes are ok to implement but the R(Read) method in both classes varies. In RAM_ServiceManagement I have extra getAll, getById, getStatus, getByName than the other class. How can I generalize this? or generalization cannot be applied here at all? Really appreciate if you can give some suggestion. Thanks


title: As a programmer, what would you use a personal Wiki for?

text: Do any programmers out there keep a personal wiki? Either locally or online. What do you use your wiki for? or what might you use one for? I was thinking of starting a personal wiki as a place to record documentation and and other documents for my personal projects, and various notes etc, but how else is a personal (maybe private) Wiki useful to a programmer/developer? What type of things would you put in a personal Wiki?


title: Programming toolset for restricted typing ability?

text: This is a cousin to the question Programming with Speech Recognition for Typing Instead of the Keyboard: I program in Visual Studio 2010, and I find that programming takes a much greater toll on my hands than typing text does. I attribute this to (1) the extensive use of punctuation and other characters away from the home row, and (2) the extensive use of multi-key command such as Ctrl+Shift+B. So a question in three stages:   1. What programming language is "easiest" to type? BASIC? COBOL?   2. What editor/IDE is easiest (from a typing standpoint) for the edit/compile/execute roundtrip (and perhaps debugging)?    3. Is there a combined solution that's powerful enough to create, say, a web application? Ideally I'd like to hear about ideas for completely mouse-free solutions, compatible with (say) a one-handed chording keyboard.


title: I am now ready to publish my commercial Android/IPhone/Anything application - what disclaimers should I use to protect myself?

text: I have now written my last line of code and I am ready to publish my application to the Android Market, what disclaimers should I add to protect myself as a developer from customers who purchase my application, to prevent being sued by stupid people? It might be a harsh question, but how does developers protect themselves when publishing their software? Developers or small companies (for example all these iPhone/Android developers) that can't afford hiring a small army of lawyers, what should they do? Any solid text I can use?


title: OOP for unit testing : The good, the bad and the ugly

text: I have recently read Miško Hevery's pdf guide to writing testable code in which its stated that you should limit your classes instanciations in your constructors. I understand that its what you should do because it allow you to easily mock you objects that are send as parameters to your class. But when it comes to writing actual code, i often end up with things like that (exemple is in PHP using Zend Framework but I think it's self explanatory) :               class Some_class     {         private $_data;              private $_options;              private $_locale;              public function __construct($data, $options = null)         {             $this->_data = $data;                  if ($options != null) {                 $this->_options = $options;             }                  $this->_init();         }              private function _init()         {             if(isset($this->_options['locale'])) {                 $locale = $this->_options['locale'];                      if ($locale instanceof Zend_Locale) {                     $this->_locale = $locale;                 } elseif (Zend_Locale::isLocale($locale)) {                     $this->_locale = new Zend_Locale($locale);                 } else {                     $this->_locale = new Zend_Locale();                 }             }         }     }      Acording to my understanding of Miško Hevery's guide, i shouldn't instanciate the Zend_Local in my class but push it through the constructor (Which can be done through the options array in my example). I am wondering what would be the best practice to get the most flexibility for unittesing this code and aswell, if I want to move away from Zend Framework. Thanks in advance


title: What are good techniques for keeping your place in code?

text: I understand using _bookmarks_ to remember a single point in your code. However, how does one keep track of the _flow_ of the code they are investigating? Eg: multiple bookmarks and the order in which they were made. Example: >   1. Bug report: "Collisions aren't working on the corners of walls" > >     1. Reproduction of the bug puts it down to certain polygons not > colliding. >     2. The collision code was written by an unavailable dev. So > investigation goes something like: > > > ![Schema of a flow](http://i.stack.imgur.com/TBzUT.png) During the investigation, especially when reviewing non-code items such as Google, one may reasonably be expected to loose their place in the code ( _Have I already looked at this code path?_ or _Which code path was I investigating? There are multiple that lead to this function_ , etc). The same goes for unavoidable interruptions (Boss: _I need [Lengthy Pointless Report] NOW_ , etc) It would be useful to have a resource of techniques or tools for providing a way to keep track of one's place in the code. * * * _Edit_ : The above example is meant as a potential illustration, not as an actual problem that needs answering. Another way to phrase this question is: When learning a new system, how do you keep track of where you are up to in learning the code? It's not about understanding _why_ the code does what it does (which is what comments should be for), but _how_ it does it (which is only learned through reading the code, not comments).


title: Methodologies/tools for when developing on your own

text: Suppose you have to develop a medium+ sized software, fully on your own. Like if it was a personal project you want to accomplish. What methodologies/tools would you use to define what needs to be developed, learned and have a global idea of what the system is as well in its details? Basically to keep yourself in track and not get lost on the way.


title: What naming conventions do you use for php classes?

text: I really like using `ClassNames` and `memberNames` as convention but I am not sure how I would name the file containing a class. I like making my classes defined in a file with the exact same name as the class. But I also like making php files all lowercase. So I am conflicted. If I have a class called `ProductGroup` should that be defined in `ProductGroup.php`, `productgroup.php`, or `product_group.php`? I know there is no right answer, so I am looking for what is most common or your opinion of which to use.. which do you use?


title: Web Project Class Architecture

text: I think this is a good question for here but I'm not 100% sure. Please flag if it's too vague. I've worked on many websites where common framework classes are overridden. Since I work mostly in .net these days examples would include Page, Masterpage, UserControl, DbContext ect. I believe this could apply to any language though. Sometimes I can see why it's done, I overrode entity framework's DbContext to include some logging code. Allot of the time though I don't see why these base classes were created. Because I've inherited most of the sites I can't really ask why. My question: Is it a good idea/practice when creating a new site to Override the common framework classes mentioned above? Would doing so be considered more of an old style?


title: Any experience with "beginner's mind" in pair programming?

text: The article "Promiscuous Pairing and Beginner’s Mind" (PDF) suggests that you put someone in the pair that knows the least about the particular area of the code base. It also suggests that you swap **out** the senior member of the pair every 90 minutes or so. Not only will the newbies learn about that area of the code but they will also think differently compared to someone who already knows the area. Does anybody have experience with this strategy? Does it have any connection with reality? I found other questions about when to use pair programming and whether to accept a job where pair programming is required, but I didn't find any that are specifically about promiscuous pairing and this "beginner's mind" strategy. If you are unfamiliar with pair programming, there are interesting articles on Wikipedia and c2.com.


title: How to properly diagram lambda expressions or traversals through them in Architecture Explorer?

text: I'm exploring a piece of code in Architecture Explorer in Visual Studio 2010 to study the relations between methods. I noticed a strange behavior. Take the following source code. It generates a hello message based on a template and a template engine, the template engine being a method (a sort of strategy pattern simplified at a maximum for demo purposes).               public string GenerateHelloMessage(string personName)     {         return this.ApplyTemplate(             this.DefaultTemplateEngine, this.GenerateLocalizedHelloTemplate(), personName);     }          private string GenerateLocalizedHelloTemplate()     {         return "Hello {0}!";     }          public string ApplyTemplate(         Func<string, string, string> templateEngine, string template, string personName)     {         return templateEngine(template, personName);     }          public string DefaultTemplateEngine(string template, string personName)     {         return string.Format(template, personName);     }      The graph generated from this code is this one: ![enter image description here](http://i.stack.imgur.com/khnYr.png) Change the first method from this:               public string GenerateHelloMessage(string personName)     {         return this.ApplyTemplate(             this.DefaultTemplateEngine, this.GenerateLocalizedHelloTemplate(), personName);     }      to this:               public string GenerateHelloMessage(string personName)     {         return this.ApplyTemplate(             (a, b) => this.DefaultTemplateEngine(a, b),             this.GenerateLocalizedHelloTemplate(), personName);     }      and the graph becomes: ![enter image description here](http://i.stack.imgur.com/bWuuh.png) While semantically identical, those two versions of code produce different dependency graphs, and Architecture Explorer shows no trace of the lambda expression (while Visual Studio's code coverage, for example, shows them, as well as Code analysis seems to be able to understand that the link exists). How would it be possible, without changing the source code, to:   * Either force Architecture Explorer to display everything, including lambda expressions,   * Or make it traverse lambda expressions while drawing a dependency through them (so in this case, drawing the dependency from `GenerateHelloMessage` to `DefaultTemplateEngine` in the second example)?


title: What is O in Big O?

text: What is Big and O in Big O notation? I've read the definitions and it doesn't tell what is _O_ pronounced as 'oh'. For example - I understand that _O_ (n) is complexity of a linear algorithm where n could be the number of operations. but what is an _O_?


title: "Joel test" for B2B hardware/software developers

text: I discovered the Joel test recently and applied it to my team. However, I but found hard to apply some points to my company since we are developing small chips with both "wired" and programmable algorithm. > 5: Do you fix bugs before writing new code? Since we cannot patch the hardware/software once delivered, we cannot tolerate any know bug, and a whole team of senior developer are building tools used for tracking them. This point should be for example "do you have 2 different implementations for each of your products, and are you testing test against each other?" > 12: Do you do hallway usability testing? We don't develop UI. This point seems irrelevant. How can we adapt this test to the kind of development we do?


title: How good are (or have to be) programmers after study / education?

text: Since I don't have much practical experience and I'm not studiing computer science directly (rather multimedia focused programming) I really would like to know how good (and maybe how old) People are before they are taking their Jobs. Coming from Germany, it is not unusual to know little to nothing really useful (practically) when done with study. You just prove you're generally capable of leaning things and learn the real stuff after University. Or does that differ in Computer Science? Or to put it in another Question: Is the average computer-science first time employee capable to program serious things?


title: Which is the best style: for loop with unused control variable and expensive termination condition?

text: Which style is best when you have a for loop with an unused control variable and a computationally expensive termination condition? The number of iterations is important, but the control variable (n) is not used within the loop.               //1     for(int n=0; n</*termination condition*/; n++) {      //do something     }          //2     int limit = //termination condition     for(int n=0; n<limit; n++) {      //do something     }          //3     for(int n=/*termination condition*/; n>0; n--) {      //do something     }      Option 1 will cause the condition to be evaluated on each iteration of the for loop, which is not performant. I tend to use option 2, since it is performant and explicit. Option 3 is performant and concise.


title: Implementing Command Pattern in Web Application

text: I'm looking to implement the command pattern in a web application (asp.net c#)... Since the commands come in text format from the client, what is the best way to translate the string to a command object? Should I use reflection? Currently I just assume the command that comes in matches the file name of a user control. This is a bit of a hack. Rather than have a select case statement that says if string = "Dashboard" then call Dashboard.Execute(), is there a pattern for working with commands that originate as strings?


title: Any good examples of visualizations of performance test data?

text: I run some basic performance tests in `C#` on simple methods, but there are also legacy monolithic pieces written in `C#` as well as other languages. So, when testing, I often end up working with a black box that takes a number of parameters. I can write code to get a bunch of sample data out, but making sense of it (e.g. presenting it visually is a challenge). I think that most people will not bother looking at a bunch of data or a bunch of poorly done graphics. It better tell a story at a glance. I can draw pretty 2d graphs, surfaces, heat maps, surface heat maps, what have you. I am hoping to make the graphics so useful, that, when a somewhat trained eye looks at it, they can say "I think we have a problem there. It should not be that slow when we change from 5 to 10 securities." or "This piece is running 20% longer than last month. What feature is killing the performance now?" I do not have much experience with presenting complex data in a good way, but I know that clever tricks do exist. Good examples are shown here: http://www.datavis.ca/gallery/timelines.php The Napoleon’s March is a great one, as it packs many-dimensional data onto a 2D piece of paper. Can you suggest any good examples of how to visualize performance test data?


title: Is it possible to tag only a portion of a git push?

text: I'm very new to git, but last week I installed it, set up bitbucket, and pushed my current project to my first bitbucket repo. All went well and I'm pleased with git as a simple, powerful, yet free way to back up my source code offsite, as well as keep track of my changes. My next step is to keep track of actual version numbers. I'm developing in Visual Studio, where the version numbers live in the project's assembly information. I've read that version numbers are usually tracked in git with tags, so I went to tag my commit with the current version number I'm on. At this point I realized that the project that I linked to my bitbucket repo contains two projects, an application and a set of web services. At this moment they share the same version number, but most likely in the future they will have differing version numbers. Right now each of these projects is in their own folder in the repo's root directory. Is there a way for me to mark one of these directories with one tag, and the other directory with another? Or should I step back and create two separate repos, one for the application, and the other for the web services?


title: Optimal number of years per job

text: Some developers keep their job for too little, as if they have commitment issues. Some keep their job for too long, as if they're afraid to leave their safety zone. What is the optimal number of years a developer should keep a job?


title: Why don't Python and Ruby make a distinction between declaring and assigning a value to variables?

text: Two of the most popular dynamically typed scripting languages, Python and Ruby, do not make a distinction in syntax between the declaration of a variable and assignation of a value to it. That is in both languages, declaring a variable `n` and assigning a value to it would look like so:               n = 10      And assigning a new value to the variable later on would look just the same. This creates two major problems:   1. A typo in a variable's name when changing it's value would create a new variable and cause bugs.   2. It makes the intentions of the code less clear. Hard to know where a variable is first declared and used, might make the code more confusing. What I don't understand is why these languages don't have a `var` keyword to use on declaration, to make a distinction between a declaration and an assignment. This doesn't make the language any less dynamically typed, and I see no drawbacks. What is the advantage of not having to explicitly define a variable?


title: Sorting an array when values are decreased by each swap

text: Recently in an interview I come across a question: > We have an unsorted array, we need to sort it with minimum number of swap. > We have in sort a 'tax' of 1 is deducted from the number we are swapping. so suppose initially we have an array as               2 4 1 3 5     ^   ^      on swaping say 2 and 1, the new state of the array is:               0 4 1 3 5  // 'tax' of 1 is deducted from 1 and 2      ^   ^      // so we have 0 and 1 at there place after the swap      So we need to sort the array in min. number of swap. Any suggestions regarding the algorithm design? I thought of doing this with merger sort but still not sure if this is the best approach.


title: PHP: frequent file system write

text: I am building a game based on PHP and MySQL. Basically there is a player-vs- player mode but I figured I should add a player-vs-computer mode as well, since players may not be online at all times, especially in the beginning. Basically it is a combat type of game where players have up to 2 characters and can fight each other, taking turns. I decided to save the computer's units on the filesystem instead of in a database. There are different monster camps which players may attack. If multiple players attack the same camp, separate instances are being created. However what I'm having my doubts about is whether I should save the full unit information in the instance or just the properties that can change in the course of battle. Let me give an example. Here's the unit class               class Unit {         // Generic         protected $id = null;         public function getID(){ return $this->id; }              public $owner = null;         public $name;              // Vitality         public $HP          = 100;         public $HPmax       = 100;         public $energy      = 100;         public $NRGmax      = 100;              // Physical         public $strength    = 0;         public $endurance   = 0;              // Psychical         public $knowledge   = 0;         public $wisdom      = 0;             // ...     }      And here's how the file structure looks like               /PvC/prototypes/     /PvC/clones/      in prototypes are saved the preset settings of individual units, while in clones are saved the instances that the players are fighting against currently. How it works at the moment is in clones I save `serialize($computer->units)` which inserts the complete full information of the unit. My concern is that some properties, such as name, owner and others, will never change during the battle, so rewriting those each time is pretty pointless. And the instance file is getting rewritten pretty often I'd say, with almost every single request during battle. In order to avoid that continuous overwriting I could serialize only the properties that can change during battle and then load the unit from the prototype as is, then overwrite that with the properties from the clone. However the problem with that is that I'm loading 2 files instead of one, then loading a bunch of data from the first file that I won't use, and is going to get overwritten. I know this is not really something that would matter, as file size will rarely exceed 10kb, but it is just bugging me so bad. What are your thoughts on this, I'm open for advice. Thanks!


title: Extending Internet Explorer to use a credit card machine and cash drawer

text: I have a software application which is currently a win forms application using an embedded IE web browser control. The win forms application provides access to an attached credit card machine and cash drawer to the web site running in the IE web control. Its does this by creating JavaScript objects in the IE web browser control which the web applications calls to do operations such as perform a credit card swipe or open a cash drawer. Those js objects are mapped to methods in the win forms application which then interacts with the devices. Its a pretty cool solution except that the embedded IE web control lacks all of the great development tools of a standard web browser window. So... I want to move the web application to being used in a normal web browser window (sticking with IE is fine for this client) while still having access to the credit card machine and the cash drawer. So my question is this... What solution is best or even possible?   * Active X Control - I do not really like this option   * Java Applet   * Flash   * Create an IE Extension - with an IE extension is it possible to do something like we are doing with our current solution? - Preferred option if possible Does anyone have any experience with this or any ideas? Thank you very much for your help!


title: Do we achieve 100% Persistence Ignorance solution if we're not using ORM's POCO objects to model the Domain?

text: Persistence ignorance is ability to retrieve/persist standard objects, where standard objects are considered as classes focused on particular business problem and thus don't contain any `infrastructure-related logic`. In DDD a _Repository pattern_ is used to achieve PI. Assuming we don't use ORM's POCO objects to model the _Domain_ , then our _Domain objects_ don't have to adhere to design requirements of a particular O/RM ( such as using _default constructor_ or marking properties as `virtual` ). Such _Domain objects_ would be considered _Persistence Ignorant_. But if we want these _Domain Objects_ to also support features such as _lazy loading_ , then their properties must contain some logic which at some point would need to check whether related data was already loaded and if it wasn't, it would contact the appropriate _Repository_ and request the related data. Now even though these _Domain Object_ are completely unaware of how they are being persisted and as such their _Domain_ is completely decoupled from the underlying _DAL provider_ , couldn't we still argue that such _Domain Objects_ contain `Infrastructure-related logic` and thus still violate _PI_? Thank you


title: Why do Haskell functors only have derived types in their target category?

text: In Haskell, the Functor typeclass functor is defined as follows (see e.g. Haskell wiki):               class Functor (f :: * -> *) where       fmap :: (a -> b) -> f a -> f b       As far as I understand (please correct me if I am wrong), such a functor can only have as target category a category constructed using a type constructor, e.g. `[]`, `Maybe`, etc. On the other hand, one may think of functors having any category as target of a functor, e.g. the category of all Haskell types. For example, `Int` could be an object in the target category of a functor, not just `Maybe Int` or `[Int]`. What is the motivation for this restriction on Haskell functors?


title: Standards in Enterprise Development

text: Is it perhaps time for enterprise systems to be developed to strict enforced standards? Many books list optional 'standards' and best practices, but these are purely suggested practices. Still, every time I look at the code for an enterprise system I have not been a part of, I spend a lot of time trying to work out the architecture. Should we not have some form of ISO accreditation for our systems? We could have a selection of standard architectures such as Domain Model, Transaction Script etc, but once we choose one of these, we have to follow a strict architectural template. Systems could be audited to ensure we are working to these standards, and our companies would carry this accreditation. This would be better for developers because when we take on legacy work that was written by another company, we will not have to spend time deciphering the architecture. It would benefit clients because they would know that if they used the services of an accredited development company, they could used another company to maintain/amend it, and not be tied to the original developers.


title: What do you optimize for?

text: Generally speaking, what type of optimizations do you typically slant yourself towards when designing software? Are you the type that prefers to optimize your design for   * Development time (i.e., quick to write and/or easier to maintain)?   * Processing time    * Storage (either RAM, DB, Disc, etc) space Of course this is highly subjective to the type of problems being solved, and the deadlines involved, so I'd like to hear about the reasons that would make you choose one form of optimization over another.


title: Why does C# allow properties in interfaces?

text: In C#, the following code is valid               interface I{         int property{get;set;}     }      Which doesn't make any sense to me. This seems to break one of the most important principles of interfaces: lack of state (in other words, no fields). Doesn't the property create an implicit private field? Wouldn't that be really bad for interfaces?


title: Downsides of GNU LGPL v3 vs. GNU LGPL v2.1?

text: Firstly, I realize that this is a programming Q&A site, and not a place for legal advice.... Just trying to get a basic idea of what the downsides to using an LGPLv3 library might be. What are the differences between GNU LGPL v2.1 and GNU LGPL v3? In particular, I know that regular GPLv3 has many anti-drm and anti-patent clauses. In principal I don't have anything against these clauses, but I will these suddenly apply to the main application if I choose to use an LGPLv3 library. The rules of LGPL v2.1 seems to only apply to the library that you use or modify. It says nothing about the main application. (Assuming no static linking etc.) Thus, in the niche-market software provider where I work, we regularly use (and contribute to) LGPL licensed libraries, without needing to open-source our main application. Does this change in LGPLv3? The question http://stackoverflow.com/questions/1108238/differences-between- gnu-lgpl-v2-1-and-gnu-lgpl-v3 got a couple of answers, but none that address any new obligations that the main application might have. To clarify: I'm asking about the LGPL v3, not plain GPLv3. Do any of the Tivoization / patent grant requirements "bleed through" from an LGPLv3 library to the host application?


title: Relation and differences between SGML, XML, HTML and XHTML

text: 1. I was wondering what "profile" means in Wikipedia: > XML is a profile of an ISO standard SGML, and most of XML comes from SGML > unchanged.   2. According to http://xml-tips.assistprogramming.com/sgml-xml-html-xhtml-all-together.html: > HTML is a subset of SGML. > > XML is a highly functional subset of SGML. > > XHTML extends and subsets HTML. Does "one being a subset of another" mean that code in the first is also syntactically correct and semantically the same as in the second? As in the sense of elementary set theory,     * are HTML, XML and XHTML all different subsets of SGML?     * do XML and HTML almost not intersect each other?     * is XHTML a superset of both XML and HTML?   3. Can I expect some more concise and clear summation of the differences in the purposes of the four and/or when to use which, than the link above? I am really confused about the clear line between their intended purposes.   4. According to http://xml-tips.assistprogramming.com/sgml-xml-html-xhtml-all-together.html: > XML is not a single Markup Language. It is a metalanguage to let users > design their own markup language. I was wondering how to understand XML and HTML are both subsets of SGML, but HTML is a markup language while XML is not a markup language but a metalanguage for designing markup languages? Are SGML and XHTML both also metalanguage for designing markup language?   5. As in both links mention that HTML is an applicaiton of SGML as well as a subset of SGML, and XHTML is an application of XML. I wonder what differences are between saying one language is an application of another, and one language is a subset of another? Thanks and regards!


title: Should I comment Tables or Columns in my database?

text: I like to comment my code with various information, and I think most people nowadays do so while writing some code. But when it comes to database tables or columns, I have never seen anyone setting some comments, and, to be honest, I don't even think of looking for comments there. So I am wondering if some people are commenting their DB strcuture here, and if I should bother commenting, for instance when I create a new column to an existing table?


title: Can a lone programmer become a mid or senior level programmer without a mentor?

text: **Question:**   Can a mere entry level programmer become a mid or senior level programmer working in a company as the only programmer without a mentor? **Background:**   I was hired as an entry level programmer for a mid size company that does not do programming except for internally. I am regarded as a genius inside the company with a decent salary but after 2 years I decided I wanted to move to an actual software company. The interview processes have been extremely demoralizing because even though I have wrote intra-company enterprise applications these interviews have made me aware of how little I actually know.


title: Free tool to design Java user interfaces

text: While in the process of developing GUIs for my Java project, I am wondering if there is something that lets you visually design your GUI for Java and correspondently generates the needed code, just to speedup the task. I am using Eclipse, and I already tried Window Builder, but I'm not keen on the code it produces. Does anyone know some alternatives (possibly non-commercial)?


title: When applying for an entry level programming position, how do I include my coding examples?

text: I will soon begin the process of applying for entry level programming positions. As of now I have no professional coding experience, so all I have to show is some personal projects and code samples to show what I am capable of. How do I present such things as code samples, my specific work on collaborative projects, personal projects, etc, to a prospective employer? Something like a digital business card? a web link on the resume to a page where it is all laid out? links to individual project pages? Basically, is there a preferred method for listing or displaying what I have done aside from just a few lines on a resume describing it?


title: What's the Content-Security-Policy-friendly way to hand data from the server to the browser on page load?

text: When developing for the web, I often find myself wanting to pass a few variables from the server scripts to my javascript - data pulled from a database, and set differently on different pages running basically the same code. (Typically, this is something along the lines of `example.com/slideshows/1` needing to know that that slideshow 1 has 8 images, and what their urls are, but that's just a random example; I'm looking for a general answer.) My normal approach is to include a short block of inline javascript that sets a few global variables or calls some initializer functions, which is straightforward and effective. It is not, however, Content Security Policy- friendly, since inline javascript is blocked by default, and not without reason. (I know the policy can be set to allow inline javascript if you have access to it, but even if you do that opens potential security issues.) I need a strategy that plays nicely with proper CSPs. I know that it could be done with an ajax call, but that's overkill for something that only needs to be set once, and adds an extra call that slows down the page load. In some cases, like the slideshow I mentioned, this could be handled by having the javascript examine other dynamically-constructed page elements to reconstruct the desired data, which is fine, but not a very general solution. What's the best way to handle this? (I almost posted this question on SO, but it seems kind of subjective; I can think of ways to do this, I just don't _like_ any of them.)


title: Organizing Business and Presentation entities

text: **Background** I am developing a WPF project. This is the basic structure:   * **User Interface** (WPF Project);   * **Interfaces** (class library, contains all the interfaces and the entities used by the application;   * **Modules** (every module contains the logic of a specific argument, e.g. File Management, and can eventually contains Wpf User Controls). In the WPF Controls, to facilitate the binding operations I have created a BaseViewModel class which contains a Raise method that automates the binding mechanism (for further details, I used a technique similar to that one described in this article). * * * **The problem** Understand which is the best way to separate Presentation form from the Business form in the entities classes. * * * **The case** In the **Interfaces** project I have, for instance, the class `User`               public class User     {         public virtual string Name { get; set; }              // Other properties     }      In one of the modules I need to use the `User` class and to bind its properties to the User Interface controls. To do so I have to use a custom implementation of the `get` and `set` keywords. At first point, I thought to create a class in the Module called, for instance, ClientUser and override the properties that I need:               public class ClientUser : User      {         private string name;              public override string Name { get { return name; } set { Raise(out name, value); } }              // Other properties     }      The problem is the Raise method, which is declared in the `BaseViewModel` class, but due to C# single inheritance constraint, I can't inherit from both classes. Which is the right way to implement this architecture?


title: How do I access a web service from Windows 8.1 mobile app?

text: Over the last few months, I've been making a Windows Phone 8.1 Runtime application. I have little experience with this (although a decent amount of other programming experience), but I've managed to make my way through. Now, however, I've hit a wall. What I need to do is, from the mobile app, send a query to some sort of web service, which will do some things with the query based on a database and return a result. The problem is I have zero experience with any sort of web service, and although I am fairly confident in my ability to work out how to do it once I know what I'm doing, the last few days I've been running into the issue of what exactly I should be doing. There's a lot of options that I can hardly distinguish between, and not a lot of introductory explanations to which one should be used where. There's also this issue which keeps coming up: http://social.msdn.microsoft.com/forums/windowsapps/en- US/9ab43a4c-499a-4f2e-81e5-c1ab5acbe9bf/wcf-add-service-reference-not- supported-for-windows-phone-81-xaml-applications?forum=wpdevelop So in all, I'm left not really knowing in what direction I should be heading. On the web service-side, should I be making a WCF application? ASP.NET? On the phone-side, should I be accessing the web service using an HttpClient? StreamSocket? Something else? Does it matter? Really, what I'm asking is -- what are the differences between these options, and which ones will work for what I'm trying to do?


title: Which tips helped you learn touch-typing?

text: I've been learning touch-typing for about two weeks now, and I'm really commited to mastering this skill. Eventhough I'm doing ok with prose already, I'm struggling with **programming syntax** and even more with **keybindings**. Those stray you away from the home row more than regular words, and aren't as easy to practice. So I often hunt and peck in order to just get it out, but when reverting to old habits like this, I find it hard to get back into the touch-typing mindframe quickly. One little trick that has helped me so far when getting lost is to reposition every finger on its home row key, and mentally visualize the layout bias of the keyboard, ie the backslash kind of alignment of key columns. It's hard to describe though and probably a bit weird... Hope you guys have better tips !


title: What is an inconsistent state?

text: I've been trying to experiment with coded user interface testing (CUITS) lately and I get the following error whenever I try to create one. > The following package failed to load: C:\Users[File Path Goes > Here]\Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll. Coded UI > Test is now in an inconsistent state. Remove this package and restart Visual > Studio to work with Coded UI Test. I have a question on Stack Overflow about the error, which seems to have no solution, but that made me wonder, what exactly is an inconsistent state? I have never encountered this error before and I have not seen a good explanation of what it means.


title: Whats the difference between syntax and grammar?

text: I understand the difference between syntax and semantics - **syntax** - how the symbols are combined to form a valid expression or statement.   **semantics** - the meaning of those symbols that form an expression or statement. But what is the grammar? for example: Sometimes I hear people say that some construct is "grammatically incorrect but syntactically it is correct" what does it mean?


title: Advantage of Learning Lisp for a Python Programmer

text: I am primarily a Python, Java, C++ programmer, and I've gained a recent interest in functional language. I'm thinking of picking up a LISP dialect: Clojure. Now, I've been working through tutorials and whatnot, but I've noticed that beyond syntax differences, I don't feel that I am learning any fundamentally different way of solving problems. So, are there any advantages of learning Clojure after Python in the way I can write programs?


title: Problem Understanding the IEEE definition of Software Engineering

text: **Background** _Software engineering is the application of a systematic, disciplined, quantifiable approach to the design, development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software._ My instructor, when explaining this definition has told me that the terms "systematic", "disciplined" and "quantifiable" imply "one after another, structured", "repeatable", and "measurable" among various other possible interpretations. However, it's the second part of the definition that confuses me. When talking about what "operation" implies, he described it this way: _"it's the process of maintaining the software, like updating or patching pieces of it. Earlier we used to remove the whole software and change the source, recompile it and install it back. This part of definition is more or less of historical significance - the way engineering was thought of in other disciplines like Mechanical Engineering."_ **Question** I am really confused about what the definition implies about SE.   * If "operation" was just the process of maintaining the software, why include it in the definition independently?   * If not, What do the terms "Operation" and "Maintenance" imply in the definition?   * Don't maintenance and Operation and everything come under development? Let's say we are developing an automatic updater component of a software for maintenance, doesn't that mean we are "developing" the "maintenance" part too? Why include the other two in definition then? Please explain me what SE really means. Thank You!


title: Legal proof of when a feature been implemented

text: For various reasons I need to supply "proof" my company's lawyer that I implemented a feature by a certain date. I have used source control since the late 90s and even the oldest databases are still working. I also have the all the old setups. Our release notes are not always as clear as they could be and most of them are not dated but organized by revision number. I figure rather than guessing I as other software developer if they know what is typically provided in this situation given what I have. I am particularly confused when a feature is spread among several source files. One feature we need to document is not just dependent on an algorithm but the UI as well and there a half-dozen files that were modified to this. **Update** By Completed, the feature was tested and released to the customer and it worked. And listed in the release notes. Also I already handed the lawyer the release dates, and the release notes (when they existed). However that was not sufficient. I need to show how I got dates. I got them out of my source control databases (Sourceforge, Subversion, Mercurical) so how to I put data that in my source control in a form that a non-technical layman can understand. Note: If you wondering why we have multiple database it is because the software in question been in continuous development since the late eighties.


title: How does the GPL static vs. dynamic linking rule apply to interpreted languages?

text: In my understanding, the GPL prohibits static linking from non-GPL code to GPL code, but permits dynamic linking from non-GPL code to GPL code. So which is it when the code in question is not linked at all because the code is written in an interpreted language (e.g. Perl)? It would seem to be too easy to exploit the rule if it was considered dynamic linking, but on the other hand, it would also seem to be impossible to legally reference GPL code from non-GPL code if it was considered static! Compiled languages at least have a distinction between static and dynamic linking, but when all "linking" is just running scripts, it's impossible to tell what the intent is without an explicit license! Or is my understanding of this issue incorrect, rendering the question moot? I've also heard of a "classpath exception" which involves dynamic linking; is that not part of the GPL but instead something that can be added on to it, so dynamic linking is only allowed when the license includes this exception?


title: Why should one use a single-use temporary variable?

text: Let's say we have a class called 'Automobile' and we have an instance of that class called 'myCar'. I would like to ask why do we need to put the values that our methods return in a variable? Why don't we just call the method? For example, why should one write:               string message = myCar.SpeedMessage();     Console.WriteLine(message);      instead of:               Console.WriteLine(myCar.SpeedMessage());


title: Data Flow Diagrams - Difference between Lines and Arrows

text: I'm currently working with Visio to create Data Flow Diagrams for a System Analysis and Design class but I'm unsure what the difference between `\------` and `\------>` is. I can connect 2 shapes together with a line (process, entity, data store) but does the single line connecting the two mean data flow? Do I need to explicitly use the data flow arrow to show which way data is flowing? (There doesn't seem to be tags for this topic, maybe im in the wrong place?)


title: A metric to measure the cost of cut and paste programming

text: I'm hunting a metric to measure the cost of cut-and-paste programming. We already use tools to detect duplicated code - but if we don't clean up our duplicated code, how much will it cost us? We know that the DRY principle, Don't Repeat Yourself, is a core principle of Extreme Programming. How can we actually measure the impact of non-DRY code on our projects? I'm referring to the simplest duped code problem of the same expressions in two or more places. Other cases of duplication such as the same logic written differently in different places is trickier to detect. I'm hunting a metric, a solid number that I can offer management. I am aware of the "WTF" metric of Robert Martin, but that is not precise enough. What is the purpose of insisting on a metric? Management is insisting on this metric and they won't be dissuaded. I'm really afraid that they may mandate that duplicated code be reduced on each sprint. Because we are so pressed to deliver, developers will find the duplicated code and hack it so it does not get detected. This would be a ticking time bomb!


title: Is it better to have separate Create and Edit actions or combine Create and Edit into one?

text: We are using ASP.NET MVC 2 with a Controller/View Presentation Layer and Model consisting of A Business Logic Layer, Data Access Layer [Stored Procedures and classes/methods to talk to the stored procedures]. In the business layer and above for most purposes Edit seems to be capable of representing both the creation of an object and the editing of an object. This coincides well with our Repository Design Pattern that defines a "Save" method. We can simply check in the stored procedure if the ID is 0 and then create a new object if it is 0 otherwise we can just update the existing object, since the category id should match one. **The primary point of discussion is if it makes the most sense to split Edit that includes Creation into it's separate parts of Create and Edit beyond the DAL layer.** An obvious example can be shown as routes: _Create_ - http://someurl/somearea/edit/0 _Edit_ - http://someurl/somearea/edit/254 **vs.** _Create_ - http://someurl/somearea/create _Edit_ - http://someurl/somearea/edit/254 **Are there any established standards or best practices in regard to this?** I know this is a small detail, but I think it's logistically an important one.


title: How to commit in-progress refactoring?

text: So, I have this big project, which is in the process of being refactored by me. I am changing a lot of stuff, so there is no chance to get it to compile some time soon. I am living in a special git branch which I named `cleanup` (which is going to get merged into `master` eventually, of course). The problem is, that I/we have the policy to never commit non-compiling code (ideally it should also work, but it must compile and link, at the very least). So, until I am finished with this huge task, I am unable to commit anything (for review or for bookkeeping).   This is not the way I like to work (I believe most people commit at least once a day or so). What do you think? Is there a solution I am overlooking?   Can I later tell git to aggregate commits or something? I could live with non- compiling commit as long as they _stay_ in the `cleanup` branch. ## Edit To the subject of pushing/committing: I am aware that it is a huge difference, but later, there will be broken revisions, when I merge my stuff into `master`. So if you browse through the history (or `git bisect` ...) then the "local" revisions will be world accessible. So only committing locally and not pushing is not the best solution, because it will cause you trouble later on (when the subject is closed and forgotten for some time). In short: Local commits will be pushed eventually. The global history should not show non-compiling commits.


title: What is the limit to the number of a class methods?

text: In different design books that I read, sometimes big emphasis is put on the number of methods that a class must have (considering an OO language, as java or C# for instance). Often the examples reported in those books are very neat and simple, but rarely they cover a "serious" or complex case.   **However the range seems to be between 5 and 8.** In a project I developed a class "Note", with its attribuse as properties: Title, Desctiption, CreateDate, etc.   Then some basic methods like: getRelations (if the note is assigned to different documents), getExpiryDate, ect. However proceeding in the development of the application, more functionalities were required, and, therefore, more methods. I know that the less methods a class has, the more loosly coupled it is. That is indeed a good advantage in terms of modularity and reusability, plus easier to edit.   By the way if in our context there is no need (or even sense) to create sub- classes and all the needed functions are related to that class, how many methods can we further attach? I agree that having more than 15 methods, then maybe a little re-design might be required.   But even in that case, if deleting some of the methods or inheritance is not an option, which would be the proper way?


title: How to Identify the Programmers with the Appropriate Skill Sets?

text: I'd appreciate help in fleshing out a set of criteria or "outline" for determining the most appropriate programmers for my situation as well as avenues to find these programmers. I've put together a fully functional web application, which is build using jvm based languages, HTML, CSS, and JavaScript. My background is in Finance and CS, and as a result I'm very comfortable with development/IT. In the initial stage, I need to: sure up security, refactor the current code base, and implement two relatively simple features. As I'm finishing my project/business plan I'm struggling with what criteria to use in order to identify the programmers I need. At a high level, I know I need 2-3 (backend) programmers:   * 1 "Senior" or "Expert" programmer   * 1 to 2 "Mid-level" or "Competent/Proficient" programmer(s) I know I should (and I will) find programmers that have worked on similar-type projects, but beyond that I'm unsure what criteria to look at. For example, should the senior/expert programmer have 10 years, 15 years or more of experience?